Sha256: 4c1d96d3f1676f4f591d361d52d5949b83261e1ff78878d8dc3e92c2e5d1b5b5

Contents?: true

Size: 896 Bytes

Versions: 1

Compression:

Stored size: 896 Bytes

Contents

module Iconly
  module ApplicationHelper
    def title(content)
      content_for :title do
        content
      end
    end

    def render_flash
      content_tag :div, class: 'container flash-container' do
        flash.each do |name, msg|
          div = content_tag :div, class: alert_class_name(name) do
            btn = content_tag :button, type: 'button', class: 'close', 'data-dismiss' => 'alert' do
              content_tag :span, '×'.html_safe
            end
            concat btn
            concat sanitize(msg)
          end
          concat div
        end
      end
    end

    private

    def alert_class_name(flash_name)
      class_name = case flash_name
                   when 'notice' then 'success'
                   when 'error' then 'danger'
                   else flash_name
                   end
      "alert alert-#{class_name} mb-4"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
iconly-1.0.0 app/helpers/iconly/application_helper.rb