Sha256: 32a2f138efee0cc5b8ad169911d0a7fc3688f08228c81de8a64b1ca4c5c18871

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

module SemanticRailsUi
  module UiHelper
    # <h1 class="ui header">
    #   <i class="ICON_NAME icon"></i>
    #   <div class="content">TITLE</div>
    # </h1>
    def ui_icon_header(title, icon_name)
      content_tag :h1, class: "ui header" do
        ui_icon(icon_name) + content_tag(:div, title, class: "content")
      end
    end

    def ui_flash_messages(options = {})
      merged_options = { id: "messages", class: "messages" }.merge(options)
      content_tag :div, merged_options do
        messages = ""
        flash.each do |name, msg|
          messages += content_tag :div, class: "ui #{name} message" do
            ui_icon("close") + content_tag(:div, class: "ui header") do
              icon_name = name == 'error' || name == 'warning' ? :warning : :info
              ui_icon("#{icon_name} circle") + content_tag(:div, msg, class: "content")
            end
          end
        end
        messages.html_safe
      end
    end

    def ui_icon(icon_name)
      content_tag(:i, '', class: "#{icon_name} icon")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
semantic-rails-ui-0.0.6 app/helpers/semantic_rails_ui/ui_helper.rb