replaced checkbox with switch button widget

git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/share-updates@163171 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2018-02-11 09:12:25 +00:00
parent a28e65c7dd
commit 3e78a3044b
7 changed files with 48 additions and 45 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/share-updates-2.5.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/share-updates-2.6.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/share-updates-2.5.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<classpathentry excluding="**" kind="src" output="target/share-updates-2.6.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
@ -38,5 +38,5 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/share-updates-2.5.0-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/share-updates-2.6.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -1,4 +1,8 @@
<ReleaseNotes>
<Changeset component="org.gcube.portlets-user.shareupdates.2-6-0"
date="2018-02-07">
<Change>restyled checkbox for notifications</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.shareupdates.2-5-0"
date="2017-12-07">
<Change>drop down menu replaced with checkbox for notifications, see Task #9971</Change>

View File

@ -13,7 +13,7 @@
<groupId>org.gcube.portlets.user</groupId>
<artifactId>share-updates</artifactId>
<packaging>war</packaging>
<version>2.5.0-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
<name>gCube Share Updates Portlet</name>
<description>
gCube Share Updates for exchanging updates with other users of VREs.
@ -94,6 +94,11 @@
<artifactId>gcube-widgets</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>switch-button-widget</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId>

View File

@ -19,6 +19,7 @@ import org.gcube.portlets.widgets.fileupload.client.events.FileUploadCompleteEve
import org.gcube.portlets.widgets.fileupload.client.events.FileUploadCompleteEventHandler;
import org.gcube.portlets.widgets.fileupload.client.view.FileSubmit;
import org.gcube.portlets.widgets.fileupload.client.view.UploadProgressPanel;
import org.gcube.portlets.widgets.switchbutton.client.SwitchButton;
import org.jsonmaker.gwt.client.Jsonizer;
import com.github.gwtbootstrap.client.ui.Button;
@ -152,7 +153,9 @@ public class ShareUpdateForm extends Composite {
ListBox privacyLevel = new ListBox();
@UiField
SaveInWorkspaceBox saveInWorkspaceCheckbox;
@UiField
SwitchButton sb;
// requested user's information
private UserInfo myUserInfo;
@ -210,7 +213,6 @@ public class ShareUpdateForm extends Composite {
if (myUserInfo.isAdmin())
privacyLevel.addItem("Share with: Everyone", PrivacyLevel.PORTAL.toString());
//change css if deployed in VRE scope
if (!userSettings.isInfrastructure()) {
setNotifyCheckboxValue(notificationEmail);
@ -282,10 +284,8 @@ public class ShareUpdateForm extends Composite {
* Bind events to manage
*/
private void bind() {
//get the uploaded file result
eventBus.addHandler(FileUploadCompleteEvent.TYPE, new FileUploadCompleteEventHandler() {
@Override
public void onUploadComplete(FileUploadCompleteEvent event) {
String absolutePathOnServer = event.getUploadedFileInfo().getAbsolutePath();
@ -471,13 +471,13 @@ public class ShareUpdateForm extends Composite {
onSubmitClickHandlerBody(e);
}
public final native boolean getNotifyCheckboxValue() /*-{
return $doc.getElementById("notifyCheckbox").checked;
}-*/;
private boolean getNotifyCheckboxValue() {
return sb.getValue();
}
public final native void setNotifyCheckboxValue(boolean value) /*-{
$doc.getElementById("notifyCheckbox").checked = value;
}-*/;
private void setNotifyCheckboxValue(boolean value) {
sb.setValue(value);
}
/**
* Publish a post.

View File

@ -1,18 +1,13 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:m="urn:import:org.gcube.portlets.user.shareupdates.client.view"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui" xmlns:j="urn:import:org.gcube.portlets.widgets.fileupload.client.view">
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui" xmlns:s="urn:import:org.gcube.portlets.widgets.switchbutton.client"
xmlns:j="urn:import:org.gcube.portlets.widgets.fileupload.client.view">
<ui:style>
.attachment-container {
width: 100%;
}
.checkbox-inline {
display: inline-block;
vertical-align: middle;
float: left;
}
.paragraph-inline {
display: inline-block;
width: 25%;
@ -52,14 +47,12 @@
<b:Form>
<b:ListBox styleName="wizardListbox" ui:field="privacyLevel"
visible="false" />
<g:SimplePanel styleName="{style.checkbox-inline}">
<g:HTMLPanel styleName="checkboxNotify">
<input type="checkbox" id="notifyCheckbox" />
<label for="notifyCheckbox">
<span></span>
Notify members
</label>
</g:HTMLPanel>
<g:SimplePanel styleName="checkbox-inline">
<g:HorizontalPanel>
<g:HTML>Notify members:&nbsp;</g:HTML>
<s:SwitchButton ui:field="sb"></s:SwitchButton>
</g:HorizontalPanel>
</g:SimplePanel>
<g:HorizontalPanel styleName="{style.paragraph-inline}">
<b:Button ui:field="attachButtonScreen" icon="UPLOAD_ALT"

View File

@ -8,6 +8,7 @@
<inherits name="com.github.gwtbootstrap.Bootstrap" />
<!-- inherits GCUBE Widgets -->
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
<inherits name='org.gcube.portlets.widgets.switchbutton.SwitchButton' />
<inherits
name="net.eliasbalasis.tibcopagebus4gwt.testsubscriber.TestSubscriber" />

View File

@ -1,19 +1,3 @@
input#notifyCheckbox[type="checkbox"] {
display:none;
}
input#notifyCheckbox[type="checkbox"] + label span {
display:inline-block;
width:19px;
height:19px;
margin:-2px 10px 0 0;
vertical-align:middle;
background:url(images/check_radio_sheet.png) left top no-repeat;
cursor:pointer;
}
input#notifyCheckbox[type="checkbox"]:checked + label span {
background:url(images/check_radio_sheet.png) -19px top no-repeat;
}
@media screen and (max-width: 1050px) {
label.wizardListbox {
width: 100% !important;
@ -50,6 +34,22 @@ input#notifyCheckbox[type="checkbox"]:checked + label span {
.share-updates-table {
width: 100% !important;
}
.checkbox-inline {
display: block;
vertical-align: middle;
}
}
@media screen and (min-width: 1051px) {
.checkbox-inline {
display: inline-block;
vertical-align: middle;
float: left;
}
}
div.switch-button-background {
margin: 4px 10px !important;
}
.attachment-container-full-width {