Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ public List<DatasetField> copy(List<DatasetField> sourceCompounds, DatasetField
DatasetField targetMapping = getChildrenField(target, copyMapping.get("to"));

targetMapping.setValue(sourceMapping.getValue());
setControlledVocabulary(targetMapping);
if(targetMapping.getValue() != null) {
setControlledVocabulary(targetMapping);
}

}
if (!type.equals("copy")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,20 @@ private String returnToDraftVersion() {
return "/dataset.xhtml?faces-redirect=true&version=DRAFT&persistentId="
+ dataset.getGlobalId();
}

public List<DatasetField> findCopySources(String sourceId) {
List<DatasetField> sourceFields = new ArrayList<>();
for (List<DatasetFieldsByType> datasetFieldsByTypeList : metadataBlocksForEdit.values()) {
for (DatasetFieldsByType datasetFieldsByType : datasetFieldsByTypeList) {
for (DatasetField datasetField : datasetFieldsByType.getDatasetFields()) {
if (sourceId.equals(datasetField.getTypeName())) {
sourceFields.add(datasetField);
}
}
}
}
return sourceFields;
}

// -------------------- SETTERS --------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
import javax.faces.convert.FacesConverter;
import javax.inject.Inject;
import javax.inject.Named;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -206,6 +209,10 @@ private Try<Template> tryToSave(BiFunction<Dataverse, Template, Try<Template>> s
return saveHandler.apply(dataverse, template)
.onSuccess(op -> JsfHelper.addFlashSuccessMessage(BundleUtil.getStringFromBundle(successMessage)));
}

public List<DatasetField> findCopySources(String sourceId) {
return Collections.emptyList();
}

// -------------------- SETTERS --------------------

Expand Down
1 change: 1 addition & 0 deletions fairchive-webapp/src/main/webapp/createDataset.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
<ui:param name="inputRenderersByFieldType"
value="#{CreateDatasetPage.inputRenderersByFieldType}" />
<ui:param name="operation" value="CREATE_DATASET" />
<ui:param name="page" value="#{CreateDatasetPage}"/>
</ui:include>
<!-- END Create editMode -->

Expand Down
2 changes: 2 additions & 0 deletions fairchive-webapp/src/main/webapp/editDatasetMetadata.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@
<ui:param name="metadataBlocks" value="#{editDatasetMetadataPage.metadataBlocksForEdit.entrySet().toArray()}"/>
<ui:param name="inputRenderersByFieldType" value="#{editDatasetMetadataPage.inputRenderersByFieldType}" />
<ui:param name="operation" value="EDIT_DATASET" />
<ui:param name="page" value="#{editDatasetMetadataPage}"/>

</ui:include>

<!-- Bottom action buttons -->
Expand Down
2 changes: 1 addition & 1 deletion fairchive-webapp/src/main/webapp/editMetadata.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
<ui:repeat id="copyFromFields" value="#{fieldsByType.datasetFieldType.getMetadata('copyFrom')}" var="copyFromFields">
<p:commandLink title="#{bundle['dataset.edit.copy.hint']}"
styleClass="btn btn-default btn-sm bootstrap-button-tooltip #{fieldsByType.datasetFieldType.compound ? 'compound-field-btn' : ''}"
actionListener="#{fieldsByType.copyValues(editDatasetMetadataPage.findCopySources(copyFromFields.source), copyFromFields.source, valCount.index)}"
actionListener="#{fieldsByType.copyValues(page.findCopySources(copyFromFields.source), copyFromFields.source, valCount.index)}"
update=":#{p:resolveClientIds('@id(fieldsByTypeFragment)', view)}">
<span class="icon-text" style="font-size: smaller;">#{bundle[copyFromFields.text]}</span>
<o:skipValidators />
Expand Down
2 changes: 2 additions & 0 deletions fairchive-webapp/src/main/webapp/template.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
<ui:param name="inputRenderersByFieldType" value="#{TemplatePage.inputRenderersByFieldType}" />
<ui:param name="operation" value="#{TemplatePage.editMode == 'CREATE' ?
'CREATE_TEMPLATE' : 'EDIT_TEMPLATE'}" />
<ui:param name="page" value="#{TemplatePage}"/>

</ui:include>
</ui:fragment>

Expand Down