From 0fd768842739b0e43e2788555217d3ad01d59751 Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Mon, 9 Jan 2017 13:34:23 +0100 Subject: [PATCH] Fix hiding of error messages in the samples datatable [SCI-853] --- .../samples/sample_datatable.js.erb | 2 -- app/assets/javascripts/samples/samples.js | 22 +++++++++---------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/app/assets/javascripts/samples/sample_datatable.js.erb b/app/assets/javascripts/samples/sample_datatable.js.erb index b73c975b3..6497af8d4 100644 --- a/app/assets/javascripts/samples/sample_datatable.js.erb +++ b/app/assets/javascripts/samples/sample_datatable.js.erb @@ -501,13 +501,11 @@ function onClickSave() { data: data, success: function (data) { sampleAlertMsg(data.flash, "success"); - HelperModule.hideFlashMsg(); onClickCancel(); }, error: function (e, eData, status, xhr) { var data = e.responseJSON; clearAllErrors(); - sampleAlertMsgHide(); if (e.status == 404) { sampleAlertMsg(I18n.t("samples.js.not_found_error"), "danger"); diff --git a/app/assets/javascripts/samples/samples.js b/app/assets/javascripts/samples/samples.js index e648e1872..2f194282c 100644 --- a/app/assets/javascripts/samples/samples.js +++ b/app/assets/javascripts/samples/samples.js @@ -56,28 +56,28 @@ function updateSamplesTypesandGroups() { } function sampleAlertMsg(message, type) { - var alertType, glyphSign; - if (type == 'success') { + var alertType; + var glyphSign; + if (type === 'success') { alertType = ' alert-success '; glyphSign = ' glyphicon-ok-sign '; - } else if (type == 'danger') { + } else if (type === 'danger') { alertType = ' alert-danger '; glyphSign = ' glyphicon-exclamation-sign '; } - var htmlSnippet = '
' + + var htmlSnippet = '
' + '
' + - '' + + '' + '' + - ''+ message +'' + + '' + message + '' + '
' + '
'; $('#notifications').html(htmlSnippet); $('#content-wrapper').addClass('alert-shown'); -} - -function sampleAlertMsgHide() { - $('#notifications').html('
'); - $('#content-wrapper').removeClass('alert-shown'); + HelperModule.hideFlashMsg(); } /**