diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/css/style.css b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/css/style.css index 9501bb4285c72737292c815dffbd9373599f0e39..f787389d1e260939b7865035e617a743bf0d420c 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/css/style.css +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/css/style.css @@ -69,6 +69,15 @@ h1, h2, legend { margin-top: 10px; } +.btn-showhide { + background : none; + opacity: 0.5; +} + +.btn-showhide:hover, .btn-showhide:focus, .btn-showhide:active { + background : none; + opacity: 1; +} /* * Scroll management diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/FormUtil.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/FormUtil.js index ffaa033c6cc1926cbae6c106b20201242755068c..ae482aba5b010d13d01e3a53a28d27032257e36b 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/FormUtil.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/FormUtil.js @@ -479,6 +479,38 @@ var FormUtil = new function() { return $btn; } + this.getShowHideButton = function($elementToHide, key) { + var $showHideButton = FormUtil.getButtonWithIcon('glyphicon-chevron-down', function() { + $elementToHide.slideToggle(); + var $thisButton = $($(this).children()[0]); + + if($thisButton.hasClass("glyphicon-chevron-right")) { + $thisButton.removeClass("glyphicon-chevron-right"); + $thisButton.addClass("glyphicon-chevron-down"); + mainController.serverFacade.setSetting(key,"true"); + } else { + $thisButton.removeClass("glyphicon-chevron-down"); + $thisButton.addClass("glyphicon-chevron-right"); + mainController.serverFacade.setSetting(key,"false"); + } + + }, null, "Show/Hide section"); + + mainController.serverFacade.getSetting(key, function(value) { + if(value === "false") { + var $thisButton = $($showHideButton.children()[0]); + $thisButton.removeClass("glyphicon-chevron-down"); + $thisButton.addClass("glyphicon-chevron-right"); + $elementToHide.toggle(); + } + }); + + $showHideButton.addClass("btn-showhide"); + $showHideButton.css({ "border" : "none", "margin-bottom" : "4px", "margin-left" : "-11px" }); + + return $showHideButton; + } + this.getHierarchyButton = function(permId) { var $hierarchyButton = $("<a>", { 'class' : 'btn btn-default'} ) .append($('<img>', { 'src' : './img/hierarchy-icon.png', 'style' : 'width:16px; height:17px;' })) diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormView.js index e93f4473929c7580b577870e6878846c077b6900..0ea7239440514e3d3438572553ac33a081b166cd 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormView.js @@ -410,11 +410,18 @@ function SampleFormView(sampleFormController, sampleFormModel) { // Storage // if(isStorageAvailable) { + var $fieldsetOwner = $("<div>"); + var $legend = $("<legend>").append("Storage"); var storageListContainer = $("<div>", { 'id' : 'sample-form-storage-list' }); - $formColumn.append($("<legend>").append("Storage")); - $formColumn.append(storageListContainer); - var storageListController = new StorageListController(this._sampleFormModel.sample, this._sampleFormModel.mode === FormMode.VIEW); + $fieldsetOwner.append($legend); + $fieldsetOwner.append(storageListContainer); + $formColumn.append($fieldsetOwner); + + $legend.prepend(FormUtil.getShowHideButton(storageListContainer, "SAMPLE-" + this._sampleFormModel.sample.sampleTypeCode + "-storage")); + + var storageListController = new StorageListController(this._sampleFormModel.sample, this._sampleFormModel.mode === FormMode.VIEW); storageListController.init(storageListContainer); + } // @@ -507,10 +514,12 @@ function SampleFormView(sampleFormController, sampleFormModel) { var sampleTypeCode = this._sampleFormModel.sample.sampleTypeCode; var sampleType = mainController.profile.getSampleTypeForSampleTypeCode(sampleTypeCode); + var $fieldsetOwner = $('<div>'); var $fieldset = $('<div>'); - var $legend = $('<legend>'); - $fieldset.append($legend); - + var $legend = $('<legend>'); + + $fieldsetOwner.append($legend).append($fieldset); + if((propertyTypeGroup.name !== null) && (propertyTypeGroup.name !== "")) { $legend.text(propertyTypeGroup.name); } else if((i === 0) || ((i !== 0) && (sampleType.propertyTypeGroups[i-1].name !== null) && (sampleType.propertyTypeGroups[i-1].name !== ""))) { @@ -629,7 +638,8 @@ function SampleFormView(sampleFormController, sampleFormModel) { $legend.remove(); } - $formColumn.append($fieldset); + $legend.prepend(FormUtil.getShowHideButton($fieldset, "SAMPLE-" + sampleTypeCode + "-" + propertyTypeGroup.name)); + $formColumn.append($fieldsetOwner); return false; } @@ -639,9 +649,15 @@ function SampleFormView(sampleFormController, sampleFormModel) { // // Identification Info // - $formColumn.append($("<legend>").append("Identification Info")); - $formColumn.append(FormUtil.getFieldForLabelWithText("Type", this._sampleFormModel.sample.sampleTypeCode)); - $formColumn.append(FormUtil.getFieldForLabelWithText(ELNDictionary.getExperimentKindName("/" + this._sampleFormModel.sample.spaceCode), this._sampleFormModel.sample.experimentIdentifierOrNull)); + var $fieldsetOwner = $("<div>"); + var $legend = $("<legend>").append("Identification Info"); + var $fieldset = $("<div>"); + + $fieldsetOwner.append($legend); + $fieldsetOwner.append($fieldset); + + $fieldset.append(FormUtil.getFieldForLabelWithText("Type", this._sampleFormModel.sample.sampleTypeCode)); + $fieldset.append(FormUtil.getFieldForLabelWithText(ELNDictionary.getExperimentKindName("/" + this._sampleFormModel.sample.spaceCode), this._sampleFormModel.sample.experimentIdentifierOrNull)); // // Identification Info - Code @@ -670,7 +686,7 @@ function SampleFormView(sampleFormController, sampleFormModel) { $codeField = FormUtil.getFieldForLabelWithText("Code", this._sampleFormModel.sample.code); } - $formColumn.append($codeField); + $fieldset.append($codeField); // // Identification Info - Registration and modification times @@ -679,17 +695,20 @@ function SampleFormView(sampleFormController, sampleFormModel) { var registrationDetails = this._sampleFormModel.sample.registrationDetails; var $registrator = FormUtil.getFieldForLabelWithText("Registrator", registrationDetails.userId); - $formColumn.append($registrator); + $fieldset.append($registrator); var $registationDate = FormUtil.getFieldForLabelWithText("Registration Date", Util.getFormatedDate(new Date(registrationDetails.registrationDate))) - $formColumn.append($registationDate); + $fieldset.append($registationDate); var $modifier = FormUtil.getFieldForLabelWithText("Modifier", registrationDetails.modifierUserId); - $formColumn.append($modifier); + $fieldset.append($modifier); var $modificationDate = FormUtil.getFieldForLabelWithText("Modification Date", Util.getFormatedDate(new Date(registrationDetails.modificationDate))); - $formColumn.append($modificationDate); + $fieldset.append($modificationDate); } + + $legend.prepend(FormUtil.getShowHideButton($fieldset, "SAMPLE-" + this._sampleFormModel.sample.sampleTypeCode + "-identificationInfo")); + $formColumn.append($fieldsetOwner); } //