Sha256: 22011bc139bdf8ed888908c027c4339bfb1784566acacb31fad793954b24f58c

Contents?: true

Size: 959 Bytes

Versions: 2

Compression:

Stored size: 959 Bytes

Contents

module BootstrapHelpers

  module FlashMessageProccessor

    private
    
      def equal_bootstrap_class(flash_type)
        case flash_type.to_s.downcase
        when 'alert'
          'error'
        when 'notice'
          'success'
        when 'info'
          'info'
        else 'warning'
        end
      end

      def flash_message_template(message,type)
        content_tag :div, :class=>"alert-message #{equal_bootstrap_class(type)} fade in", 'data-alert'=>'alert' do
          content_tag(:a, '×', :href=>'#', :class=>'close') + content_tag(:p) {message}
        end
      end

      def flash_block_template(collection, type)
        content_tag :div, :class=>"alert-message #{equal_bootstrap_class(type)} block-message fade in", 
          'data-alert'=>'alert' do
            concat content_tag(:a, '×', :href=>'#', :class=>'close')
            collection.each {|message| concat content_tag(:p, message)}
        end
      end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bootstrap_helpers-0.0.8 lib/bootstrap_helpers/flash_message_proccessor.rb
bootstrap_helpers-0.0.7 lib/bootstrap_helpers/flash_message_proccessor.rb