fixes flash message [fixes SCI-2142]

This commit is contained in:
zmagod 2018-04-25 07:32:49 +02:00
parent 1e4a975304
commit c026044322
4 changed files with 41 additions and 33 deletions

View file

@ -204,6 +204,12 @@ var HelperModule = (function(){
}
}
helpers.dismissAlert = function() {
$('#alert-flash').on('click', function() {
$('#alert-flash').alert('close');
})
}
helpers.flashAlertMsg = function(message, type) {
var alertType;
var glyphSign;
@ -221,23 +227,22 @@ var HelperModule = (function(){
alertType = ' alert-warning ';
glyphSign = ' glyphicon-exclamation-sign ';
}
var htmlSnippet = '<div class="alert alert' + alertType +
var htmlSnippet = '<div id="alert-flash" class="alert alert' + alertType +
'alert-dismissable alert-floating">' +
'<div class="container">' +
'<button type="button" class="close" ' +
'data-dismiss="alert" aria-label="Close">' +
'<span aria-hidden="true">×</span></button>' +
'<span class="glyphicon' + glyphSign + '"></span>&nbsp;' +
'<span>' + message + '</span>' +
'</div>' +
'</div>';
$('#notifications').html(htmlSnippet);
helpers.hideFlashMsg();
helpers.dismissAlert();
}
$( document ).ready(function() {
helpers.treeLinkTruncation();
helpers.hideFlashMsg();
helpers.dismissAlert();
});
return helpers;

View file

@ -36,35 +36,10 @@
<%= render "shared/file_preview_modal.html.erb" %>
<%= render "shared/navigation" %>
<div id="notifications">
<% if flash[:success] %>
<div id="alert-flash" class="alert alert-success alert-dismissable alert-floating">
<div class="container">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<span class="glyphicon glyphicon-ok-sign"></span>
<span><%= sanitize_input(flash[:success]) %></span>
</div>
</div>
<% end %>
<% if notice %>
<div id="alert-flash" class="alert alert-info alert-dismissable alert-floating">
<div class="container">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<span class="glyphicon glyphicon-info-sign"></span>
<span><%= notice %></span>
</div>
</div>
<% end %>
<% if alert and !alert.empty? or flash[:error]%>
<div id="alert-flash" class="alert alert-danger alert-dismissable alert-floating">
<div class="container">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<span class="glyphicon glyphicon-exclamation-sign"></span>
<span><%= alert || sanitize_input(flash[:error]) %></span>
</div>
</div>
<% end %>
</div>
<% 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? %>
<div id="content-wrapper">

View file

@ -1,5 +1,7 @@
<% content_for :content do %>
<div class="container-fluid" id="wrapper">
<%= render partial: 'shared/flash_alerts',
locals: { flash: flash, notice: notice, alert: alert } %>
<div id="sidebar-wrapper" class="<%= yield :sidebar_wrapper_class %>">
<%= yield :sidebar %>
</div>

View file

@ -0,0 +1,26 @@
<div id="notifications">
<% if flash[:success] %>
<div id="alert-flash" class="alert alert-success alert-dismissable alert-floating">
<div class="container">
<span class="glyphicon glyphicon-ok-sign"></span>
<span><%= sanitize_input(flash[:success]) %></span>
</div>
</div>
<% end %>
<% if notice %>
<div id="alert-flash" class="alert alert-info alert-dismissable alert-floating">
<div class="container">
<span class="glyphicon glyphicon-info-sign"></span>
<span><%= notice %></span>
</div>
</div>
<% end %>
<% if alert and !alert.empty? or flash[:error]%>
<div id="alert-flash" class="alert alert-danger alert-dismissable alert-floating">
<div class="container">
<span class="glyphicon glyphicon-exclamation-sign"></span>
<span><%= alert || sanitize_input(flash[:error]) %></span>
</div>
</div>
<% end %>
</div>