Commit 7d29b6c
Changed files (2)
app
helpers
views
application
app/helpers/application_helper.rb
@@ -13,4 +13,17 @@ module ApplicationHelper
'alert-primary'
end
end
+
+ def alert_message_for(type)
+ case type.to_sym
+ when :notice
+ 'Hot dog!'
+ when :warning
+ 'Holy guacamole!'
+ when :error
+ 'Danger Will Robinson!'
+ else
+ '🤷'
+ end
+ end
end
app/views/application/_flash.html.erb
@@ -1,7 +1,12 @@
<div class="container">
<% flash.each do |type, message| %>
<% Array(message).each do |value| %>
- <div class="alert <%= alert_class_for(type) %>" role=alert><%= value %></div>
+ <div class="alert <%= alert_class_for(type) %> alert-dismissible fade show" role="alert">
+ <strong><%= alert_message_for(type) %></strong> <%= value %>
+ <button type="button" class="close" data-dismiss="alert" aria-label="Close">
+ <span aria-hidden="true">×</span>
+ </button>
+ </div>
<% end %>
<% end %>
</div>