mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-10 22:53:06 +08:00
Merge pull request #1119 from ZmagoD/zd_SCI_2142_v2
fixes flash message [fixes SCI-2142]
This commit is contained in:
commit
27b1251fdf
5 changed files with 70 additions and 34 deletions
|
@ -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 = '<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">' +
|
||||
'<div>' +
|
||||
'<button type="button" class="close" ' +
|
||||
'data-dismiss="alert" aria-label="Close">' +
|
||||
'<span aria-hidden="true">×</span></button>' +
|
||||
'<span class="glyphicon' + glyphSign + '"></span> ' +
|
||||
'<span>' + message + '</span>' +
|
||||
|
@ -232,11 +238,13 @@ var HelperModule = (function(){
|
|||
'</div>';
|
||||
$('#notifications').html(htmlSnippet);
|
||||
helpers.hideFlashMsg();
|
||||
helpers.dismissAlert();
|
||||
}
|
||||
|
||||
$( document ).ready(function() {
|
||||
helpers.treeLinkTruncation();
|
||||
helpers.hideFlashMsg();
|
||||
helpers.dismissAlert();
|
||||
});
|
||||
|
||||
return helpers;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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>
|
||||
|
|
29
app/views/shared/_flash_alerts.html.erb
Normal file
29
app/views/shared/_flash_alerts.html.erb
Normal file
|
@ -0,0 +1,29 @@
|
|||
<div id="notifications">
|
||||
<% if flash[:success] %>
|
||||
<div id="alert-flash" class="alert alert-success alert-dismissable alert-floating">
|
||||
<div>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
Loading…
Reference in a new issue