fixed css. Improved Add Resources

This commit is contained in:
Francesco Mangiacrapa 2021-03-30 12:24:44 +02:00
parent a008757303
commit f0fcf09b0e
5 changed files with 47 additions and 18 deletions

View File

@ -12,6 +12,7 @@
border: 1px groove #444 !important; border: 1px groove #444 !important;
box-shadow: 0px 0px 0px 0px #000 !important; box-shadow: 0px 0px 0px 0px #000 !important;
padding: 10px !important; padding: 10px !important;
margin: 5px !important;
} }
.legend-style { .legend-style {
@ -46,8 +47,10 @@
font-weight: bold; font-weight: bold;
} }
.the-margin-left { .the-margin-gotoitem {
margin-left: 5px; margin-left: 5px;
margin-top: 10px;
margin-bottom: 10px;
} }
</ui:style> </ui:style>
<g:HTMLPanel ui:field="createDatasetMainPanel"> <g:HTMLPanel ui:field="createDatasetMainPanel">
@ -419,7 +422,7 @@
<g:Label>Go to the Item</g:Label> <g:Label>Go to the Item</g:Label>
<b:Button title="Go to the Item" <b:Button title="Go to the Item"
ui:field="goToDatasetButton" type="LINK" visible="false" ui:field="goToDatasetButton" type="LINK" visible="false"
styleName="{style.the-margin-left}"></b:Button> styleName="{style.the-margin-gotoitem}"></b:Button>
</g:HorizontalPanel> </g:HorizontalPanel>
<b:Button title="Add resources to the just created item" <b:Button title="Add resources to the just created item"

View File

@ -319,8 +319,9 @@ public class MetaDataFieldSkeleton extends Composite{
// get vocabulary fields // get vocabulary fields
List<String> vocabulary = field.getVocabulary(); List<String> vocabulary = field.getVocabulary();
GWT.log("Vocabulary: "+field.getFieldName());
for (String term : vocabulary) { for (String term : vocabulary) {
GWT.log("Adding term: "+term);
tempListBox.addItem(term); tempListBox.addItem(term);
} }

View File

@ -7,9 +7,11 @@ import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElement
import com.github.gwtbootstrap.client.ui.AlertBlock; import com.github.gwtbootstrap.client.ui.AlertBlock;
import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.ControlGroup;
import com.github.gwtbootstrap.client.ui.TextArea; import com.github.gwtbootstrap.client.ui.TextArea;
import com.github.gwtbootstrap.client.ui.TextBox; import com.github.gwtbootstrap.client.ui.TextBox;
import com.github.gwtbootstrap.client.ui.constants.AlertType; import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.github.gwtbootstrap.client.ui.constants.ControlGroupType;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.ClickHandler;
@ -53,6 +55,8 @@ public class AddResourceToDataset extends Composite{
@UiField Button addResourceButton; @UiField Button addResourceButton;
@UiField AlertBlock infoBlock; @UiField AlertBlock infoBlock;
@UiField Button goToDatasetButton; @UiField Button goToDatasetButton;
@UiField ControlGroup urlControlGroup;
@UiField ControlGroup nameControlGroup;
public AddResourceToDataset(HandlerManager eventBus, String datasetId, String datasetOrg, String owner, final String datasetUrl) { public AddResourceToDataset(HandlerManager eventBus, String datasetId, String datasetOrg, String owner, final String datasetUrl) {
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
@ -80,19 +84,31 @@ public class AddResourceToDataset extends Composite{
@UiHandler("addResourceButton") @UiHandler("addResourceButton")
void onAddButtonClick(ClickEvent e){ void onAddButtonClick(ClickEvent e){
infoBlock.setVisible(false); infoBlock.setVisible(false);
urlControlGroup.setType(ControlGroupType.NONE);
nameControlGroup.setType(ControlGroupType.NONE);
// validation // validation
if(resourceUrlTextBox.getText().isEmpty() || resourceNameTextBox.getText().isEmpty()){ if (resourceUrlTextBox.getText().isEmpty()) {
showAlert("Url and name fields cannot be empty", AlertType.ERROR); showAlert("'URL' field cannot be empty", AlertType.ERROR);
urlControlGroup.setType(ControlGroupType.ERROR);
return;
}
// validation
if (resourceNameTextBox.getText().isEmpty() || resourceNameTextBox.getText().isEmpty()) {
showAlert("'Name' field cannot be empty", AlertType.ERROR);
nameControlGroup.setType(ControlGroupType.ERROR);
return; return;
} }
//THE URL must be HTTPS, see #21068 //THE URL must be HTTPS, see #21068
if(!(resourceNameTextBox.getText().toLowerCase().startsWith("https://"))){ if(!(resourceUrlTextBox.getText().toLowerCase().startsWith("https://"))){
showAlert("The URL must be HTTPS and starts with \"https://\" (e.g. https://your-resource.com)", AlertType.ERROR); showAlert("The URL must be HTTPS, so start with \"https://\" (e.g. https://your-resource.com)", AlertType.ERROR);
urlControlGroup.setType(ControlGroupType.ERROR);
return; return;
} }
@ -169,6 +185,6 @@ public class AddResourceToDataset extends Composite{
} }
}; };
t.schedule(4000); t.schedule(8000);
} }
} }

View File

@ -1,6 +1,7 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui" xmlns:g="urn:import:com.google.gwt.user.client.ui"> xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:style> <ui:style>
.form-main-style { .form-main-style {
margin-left: 10px; margin-left: 10px;
@ -56,19 +57,23 @@
is required is required
</small> </small>
</b:Legend> </b:Legend>
<b:Alert type="INFO" close="false">Only HTTPS URLs are allowed.
If you have a desktop file upload it to Workspace and use the 'Public Link' facility to get its HTTPS URL</b:Alert>
<b:ControlGroup> <b:ControlGroup ui:field="urlControlGroup">
<b:ControlLabel for="url" title="File url"> <b:ControlLabel for="url" title="File url">
<font color="red">*</font> <font color="red">*</font>
URL: URL:
</b:ControlLabel> </b:ControlLabel>
<b:Controls> <b:Controls>
<b:TextBox alternateSize="LARGE" placeholder="https://example.com/image.jpg" <b:TextBox alternateSize="LARGE"
b:id="url" title="Product's title" ui:field="resourceUrlTextBox" /> placeholder="https://example.com/image.jpg" b:id="url"
title="Product's title" ui:field="resourceUrlTextBox" />
</b:Controls> </b:Controls>
</b:ControlGroup> </b:ControlGroup>
<b:ControlGroup> <b:ControlGroup ui:field="nameControlGroup">
<b:ControlLabel for="name" title="Resource name"> <b:ControlLabel for="name" title="Resource name">
<font color="red">*</font> <font color="red">*</font>
Name: Name:
@ -80,19 +85,22 @@
</b:ControlGroup> </b:ControlGroup>
<b:ControlGroup> <b:ControlGroup>
<b:ControlLabel for="description" title="Resource description"> <b:ControlLabel for="description"
title="Resource description">
Description: Description:
</b:ControlLabel> </b:ControlLabel>
<b:Controls> <b:Controls>
<b:TextArea alternateSize="LARGE" <b:TextArea alternateSize="LARGE"
placeholder="Some useful notes about data" b:id="description" placeholder="Some useful notes about data" b:id="description"
title="Resource description" ui:field="resourceDescriptionTextArea" /> title="Resource description"
ui:field="resourceDescriptionTextArea" />
</b:Controls> </b:Controls>
</b:ControlGroup> </b:ControlGroup>
<!-- Alert blocks for info/errors --> <!-- Alert blocks for info/errors -->
<b:AlertBlock type="INFO" animation="true" visible="false" <b:AlertBlock type="INFO" animation="true"
close="false" ui:field="infoBlock" styleName="{style.block-alert-style}"></b:AlertBlock> visible="false" close="false" ui:field="infoBlock"
styleName="{style.block-alert-style}"></b:AlertBlock>
<!-- Add resource button --> <!-- Add resource button -->
<b:Button title="Add resource" ui:field="addResourceButton" <b:Button title="Add resource" ui:field="addResourceButton"

View File

@ -67,6 +67,7 @@
width: 100%; width: 100%;
border-collapse: separate; border-collapse: separate;
display: table; display: table;
border-spacing: 5px;
} }
.wizard-creator div { .wizard-creator div {