Skip to content

Instantly share code, notes, and snippets.

@JoshTGreenwood
Forked from roberto/_flash_messages.html.erb
Last active January 1, 2016 08:29

Revisions

  1. JoshTGreenwood revised this gist Dec 24, 2013. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions application_helper.rb
    Original file line number Diff line number Diff line change
    @@ -3,16 +3,16 @@ module ApplicationHelper
    def bootstrap_class_for flash_type
    case flash_type
    when :success
    "alert-success"
    "alert-success" # Green
    when :error
    "alert-error"
    "alert-danger" # Red
    when :alert
    "alert-block"
    "alert-warning" # Yellow
    when :notice
    "alert-info"
    "alert-info" # Blue
    else
    flash_type.to_s
    end
    end

    end
  2. @roberto roberto revised this gist Aug 13, 2012. No changes.
  3. @roberto roberto revised this gist Aug 13, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion application.html.erb
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    <%= render :partial => "shared/flash_messages", :locals => {:flash => flash} %>
    <%= render partial: "shared/flash_messages", flash: flash %>
  4. @roberto roberto created this gist Aug 13, 2012.
    6 changes: 6 additions & 0 deletions _flash_messages.html.erb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    <% flash.each do |type, message| %>
    <div class="alert <%= bootstrap_class_for(type) %> fade in">
    <button class="close" data-dismiss="alert">×</button>
    <%= message %>
    </div>
    <% end %>
    1 change: 1 addition & 0 deletions application.html.erb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    <%= render :partial => "shared/flash_messages", :locals => {:flash => flash} %>
    18 changes: 18 additions & 0 deletions application_helper.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    module ApplicationHelper

    def bootstrap_class_for flash_type
    case flash_type
    when :success
    "alert-success"
    when :error
    "alert-error"
    when :alert
    "alert-block"
    when :notice
    "alert-info"
    else
    flash_type.to_s
    end
    end

    end