Sha256: f0caa47b75acb96dbc1e395e029ea36626b8ec013cb851380c30cbc91c30af07

Contents?: true

Size: 1.03 KB

Versions: 68

Compression:

Stored size: 1.03 KB

Contents

module Dorsale
  module ContextHelper
    def context_icon(id)
      id = id.to_s.gsub("_", "-")
      content_tag(:span, class: "icon fa fa-#{id}"){}
    end

    def context_title(title)
      content_tag(:h2){ title }
    end

    def context_info(name, info, br = false)
      return if info.blank?

      content_tag(:p, class: "infos"){
        label = content_tag(:strong) { "#{name} :" }
        sep   = br ? tag(:br) : " "
        label + sep + info
      }
    end

    def actions_for(obj, opts={})
      url        = opts[:url]
      edit_url   = opts[:edit_url]
      delete_url = opts[:delete_url]

      url        = polymorphic_path(obj) if url.nil?
      edit_url   = url + "/edit"         if edit_url.nil?
      delete_url = url                   if delete_url.nil?

      render partial: "dorsale/actions", locals: {
        :obj        => obj,
        :url        => url,
        :edit_url   => edit_url,
        :delete_url => delete_url,
      }
    end

    def render_contextual
      render "dorsale/contextual"
    end
  end
end

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
dorsale-3.0.3 app/helpers/dorsale/context_helper.rb
dorsale-3.0.2 app/helpers/dorsale/context_helper.rb
dorsale-3.0.1 app/helpers/dorsale/context_helper.rb
dorsale-3.0.0 app/helpers/dorsale/context_helper.rb
dorsale-2.7.3 app/helpers/dorsale/context_helper.rb
dorsale-2.7.2 app/helpers/dorsale/context_helper.rb
dorsale-2.7.1 app/helpers/dorsale/context_helper.rb
dorsale-2.7.0 app/helpers/dorsale/context_helper.rb
dorsale-2.6.8 app/helpers/dorsale/context_helper.rb
dorsale-2.6.7 app/helpers/dorsale/context_helper.rb
dorsale-2.6.6 app/helpers/dorsale/context_helper.rb
dorsale-2.6.5 app/helpers/dorsale/context_helper.rb
dorsale-2.6.4 app/helpers/dorsale/context_helper.rb
dorsale-2.6.3 app/helpers/dorsale/context_helper.rb
dorsale-2.6.2 app/helpers/dorsale/context_helper.rb
dorsale-2.6.1 app/helpers/dorsale/context_helper.rb
dorsale-2.6.0 app/helpers/dorsale/context_helper.rb
dorsale-2.5.0 app/helpers/dorsale/context_helper.rb
dorsale-2.4.3 app/helpers/dorsale/context_helper.rb
dorsale-2.4.2 app/helpers/dorsale/context_helper.rb