From aefdbccb4886173679fff7f8e7e0a7807cf02974 Mon Sep 17 00:00:00 2001 From: juanf <juanf> Date: Fri, 24 Mar 2017 09:55:19 +0000 Subject: [PATCH] SSDM-3501 : Save button on toolbar + other toolbar options only shown on VIEW mode. SVN: 37948 --- .../ExperimentForm/ExperimentFormView.js | 30 ++++++------------- .../js/views/SampleForm/SampleFormView.js | 5 ++-- 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ExperimentForm/ExperimentFormView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ExperimentForm/ExperimentFormView.js index 408deef8648..1ebad6adcf8 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ExperimentForm/ExperimentFormView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ExperimentForm/ExperimentFormView.js @@ -27,8 +27,7 @@ function ExperimentFormView(experimentFormController, experimentFormModel) { var $formColumn = $("<form>", { "class" : "form-horizontal form-panel-one", 'role' : "form", - 'action' : 'javascript:void(0);', - 'onsubmit' : 'mainController.currentView.updateExperiment();' + 'action' : 'javascript:void(0);' }); var $rightPanel = null; @@ -74,7 +73,7 @@ function ExperimentFormView(experimentFormController, experimentFormModel) { // Toolbar // var toolbarModel = []; - if(this._experimentFormModel.mode !== FormMode.CREATE) { + if(this._experimentFormModel.mode === FormMode.VIEW) { //Create Experiment Step if(profile.getSampleTypeForSampleTypeCode("EXPERIMENTAL_STEP") && !profile.isSampleTypeHidden("EXPERIMENTAL_STEP")) { var $createBtn = FormUtil.getButtonWithIcon("glyphicon-plus", function() { @@ -120,6 +119,13 @@ function ExperimentFormView(experimentFormController, experimentFormModel) { }); }); toolbarModel.push({ component : $export, tooltip: "Export" }); + } else { //Create and Edit + var $saveBtn = FormUtil.getButtonWithIcon("glyphicon-floppy-disk", function() { + _this._experimentFormController.updateExperiment(); + }, "Save"); + $saveBtn.removeClass("btn-default"); + $saveBtn.addClass("btn-primary"); + toolbarModel.push({ component : $saveBtn, tooltip: "Save" }); } var $header = views.header; @@ -198,24 +204,6 @@ function ExperimentFormView(experimentFormController, experimentFormModel) { $formColumn.append($dataSetUploaderContainer); } - //Create/Update Buttons - if(this._experimentFormModel.mode === FormMode.EDIT || this._experimentFormModel.mode === FormMode.CREATE) { - var btnTitle = ""; - switch(this._experimentFormModel.mode) { - case FormMode.CREATE: - btnTitle = "Create"; - break; - case FormMode.EDIT: - btnTitle = "Update"; - break; - } - - - $formColumn.append($("<br>")); - var $updateBtn = $("<input>", { "type": "submit", "class" : "btn btn-primary", 'value' : btnTitle }); - $formColumn.append($updateBtn); - } - // // INIT // 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 6a7437b138c..e14d485a7fb 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 @@ -30,8 +30,7 @@ function SampleFormView(sampleFormController, sampleFormModel) { var $formColumn = $("<form>", { "class" : "form-horizontal form-panel-one", 'role' : "form", - 'action' : 'javascript:void(0);', - 'onsubmit' : 'mainController.currentView.createUpdateCopySample();' + 'action' : 'javascript:void(0);' }); var $rightPanel = null; @@ -228,7 +227,7 @@ function SampleFormView(sampleFormController, sampleFormModel) { toolbarModel.push({ component : $export, tooltip: "Export" }); } else { //Create and Edit var $saveBtn = FormUtil.getButtonWithIcon("glyphicon-floppy-disk", function() { - mainController.currentView.createUpdateCopySample(); + _this._sampleFormController.createUpdateCopySample(); }, "Save"); $saveBtn.removeClass("btn-default"); $saveBtn.addClass("btn-primary"); -- GitLab