Skip to content

Instantly share code, notes, and snippets.

@visdesarrollo2
Forked from roberto/_flash_messages.html.erb
Last active August 29, 2015 14:14
Show Gist options
  • Select an option

  • Save visdesarrollo2/65286ca20626b469fbf3 to your computer and use it in GitHub Desktop.

Select an option

Save visdesarrollo2/65286ca20626b469fbf3 to your computer and use it in GitHub Desktop.

Revisions

  1. @roberto roberto revised this gist Aug 13, 2012. No changes.
  2. @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 %>
  3. @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