diff --git a/app/assets/javascripts/application.js.erb b/app/assets/javascripts/application.js.erb index b587a372c..387ee58d0 100644 --- a/app/assets/javascripts/application.js.erb +++ b/app/assets/javascripts/application.js.erb @@ -199,10 +199,16 @@ var HelperModule = (function(){ flash.fadeTo(500, 0).slideUp(500, function () { $(this).remove(); }); - }, 5000); + }, 3000); } } + helpers.dismissAlert = function() { + $('#alert-flash').on('click', function() { + $('#alert-flash').alert('close'); + }) + } + helpers.flashAlertMsg = function(message, type) { var alertType; var glyphSign; @@ -220,11 +226,11 @@ var HelperModule = (function(){ alertType = ' alert-warning '; glyphSign = ' glyphicon-exclamation-sign '; } - var htmlSnippet = '
' + - '
' + - '' + ' ' + '' + message + '' + @@ -232,11 +238,13 @@ var HelperModule = (function(){ '
'; $('#notifications').html(htmlSnippet); helpers.hideFlashMsg(); + helpers.dismissAlert(); } $( document ).ready(function() { helpers.treeLinkTruncation(); helpers.hideFlashMsg(); + helpers.dismissAlert(); }); return helpers; diff --git a/app/assets/stylesheets/themes/scinote.scss b/app/assets/stylesheets/themes/scinote.scss index 4fd130b5a..f34e12402 100644 --- a/app/assets/stylesheets/themes/scinote.scss +++ b/app/assets/stylesheets/themes/scinote.scss @@ -1727,6 +1727,28 @@ th.custom-field .modal-tooltiptext { max-height: 200px; } +#alert-flash { + + button { + margin-right: 400px; + } + + .glyphicon { + margin-left: 100px; + } + + @media(max-width:768px) { + + button { + display: none; + } + + .glyphicon { + margin-left: 10px; + } + } +} + .linkedin-signin-button { margin: 15px 0; } diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index ebad3d034..507624b79 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -36,35 +36,10 @@ <%= render "shared/file_preview_modal.html.erb" %> <%= render "shared/navigation" %> -
- <% if flash[:success] %> -
-
- - - <%= sanitize_input(flash[:success]) %> -
-
- <% end %> - <% if notice %> -
-
- - - <%= notice %> -
-
- <% end %> - <% if alert and !alert.empty? or flash[:error]%> -
-
- - - <%= alert || sanitize_input(flash[:error]) %> -
-
- <% end %> -
+ <% unless user_signed_in? %> + <%= render partial: 'shared/flash_alerts', + locals: { flash: flash, notice: notice, alert: alert } %> + <% end %> <%= render "shared/left_menu_bar" if user_signed_in? %>
diff --git a/app/views/layouts/fluid.html.erb b/app/views/layouts/fluid.html.erb index fc2c73d27..f94eaaf05 100644 --- a/app/views/layouts/fluid.html.erb +++ b/app/views/layouts/fluid.html.erb @@ -1,5 +1,7 @@ <% content_for :content do %>
+ <%= render partial: 'shared/flash_alerts', + locals: { flash: flash, notice: notice, alert: alert } %> diff --git a/app/views/shared/_flash_alerts.html.erb b/app/views/shared/_flash_alerts.html.erb new file mode 100644 index 000000000..ec84827e6 --- /dev/null +++ b/app/views/shared/_flash_alerts.html.erb @@ -0,0 +1,29 @@ +
+ <% if flash[:success] %> +
+
+ + + <%= sanitize_input(flash[:success]) %> +
+
+ <% end %> + <% if notice %> +
+
+ + + <%= notice %> +
+
+ <% end %> + <% if alert and !alert.empty? or flash[:error]%> +
+
+ + + <%= alert || sanitize_input(flash[:error]) %> +
+
+ <% end %> +