Moving our fix for the broken Spree function into our own JS

This commit is contained in:
Will Marshall
2013-11-29 14:24:56 +11:00
parent 0cfc0efe32
commit 0ac9bfd898
2 changed files with 16 additions and 17 deletions

View File

@@ -12,3 +12,19 @@ $(document).ready(function() {
stepMinute: 15
});
});
// Overriding a broken function in Spree. Bug report at
// https://github.com/spree/spree/issues/4032
show_flash_error = function(message) {
error_div = $('.flash.error');
if (error_div.length > 0) {
error_div.html(message);
error_div.show();
} else {
if ($("#content .toolbar").length > 0) {
$("#content .toolbar").before('<div class="flash error">' + message + '</div>');
} else {
$("#progress").before('<div class="flash error">' + message + '</div>');
}
}
}

View File

@@ -1,17 +0,0 @@
notice_div = $('.flash.notice');
<% notice = flash.discard(:notice)
if notice %>
if (notice_div.length > 0) {
notice_div.html("<%= notice %>");
notice_div.show();
} else {
if ($("#content .toolbar").length > 0) {
$("#content .toolbar").before('<div class="flash notice"><%= notice %></div>');
} else {
$("#progress").before('<div class="flash notice"><%= notice %></div>');
}
} <%
end %>
<%= render :partial => '/spree/admin/shared/update_order_state' if @order %>