Add flash styling of the login page.

This commit is contained in:
Matt Rogers 2015-12-15 19:39:37 -06:00
parent 37c61fa60a
commit a07567086c
3 changed files with 38 additions and 1 deletions

View file

@ -6,6 +6,7 @@ body {
@include make-xs-column(12);
@include make-sm-column(6);
@include make-sm-column-offset(3);
padding: 10px;
}
.login-wrapper {

View file

@ -0,0 +1,36 @@
module BootstrapFlashHelper
ALERT_MAPPING = {
:notice => :success,
:alert => :danger,
:error => :danger,
:info => :info,
:warning => :warning
} unless const_defined?(:ALERT_MAPPING)
def bootstrap_flash(options = {:close_button => true})
flash_messages = []
flash.each do |type, message|
# Skip empty messages, e.g. for devise messages set to nothing in a locale file.
next if message.blank?
type = type.to_sym
next unless ALERT_MAPPING.keys.include?(type)
tag_class = options.extract!(:class)[:class]
tag_options = {
class: "alert fade in alert-#{ALERT_MAPPING[type]} #{tag_class}"
}.merge(options)
close_button = ""
if options[:close_button]
close_button = content_tag(:button, raw("×"), type: "button", class: "close", "data-dismiss" => "alert")
end
Array(message).each do |msg|
text = content_tag(:div, close_button + msg, tag_options)
flash_messages << text if msg
end
end
flash_messages.join("\n").html_safe
end
end

View file

@ -1,7 +1,7 @@
<div class="container-fluid">
<div class="row">
<div class="login-flash">
<%= render_flash %>
<%= bootstrap_flash :close_button => false %>
</div>
</div>
<div class="login-wrapper">