Skip to content

Commit

Permalink
Admin Panel: close button for alerts
Browse files Browse the repository at this point in the history
Besides the auto disappearance of alerts, store owners can also close
them manually.
  • Loading branch information
damianlegawiec authored and Mafi88 committed Mar 14, 2016
1 parent b8cb2e5 commit aace151
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion backend/app/helpers/spree/admin/base_helper.rb
Expand Up @@ -3,11 +3,14 @@ module Admin
module BaseHelper
def flash_alert flash
if flash.present?
close_button = button_tag(class: 'close', 'data-dismiss' => 'alert', 'aria-label' => Spree.t(:close)) do
content_tag('span', '×'.html_safe, 'aria-hidden' => true)
end
message = flash[:error] || flash[:notice] || flash[:success]
flash_class = "danger" if flash[:error]
flash_class = "info" if flash[:notice]
flash_class = "success" if flash[:success]
flash_div = content_tag(:div, message, class: "alert alert-#{flash_class} alert-auto-disappear")
flash_div = content_tag(:div, (close_button + message), class: "alert alert-#{flash_class} alert-auto-disappear")
content_tag(:div, flash_div, class: 'col-md-12')
end
end
Expand Down

0 comments on commit aace151

Please sign in to comment.