Sha256: ac7f11129a22b56d1035810473c43646820df06acd5ef8bd2206adeb7567cea1

Contents?: true

Size: 954 Bytes

Versions: 4

Compression:

Stored size: 954 Bytes

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)
      return if info.blank?
      %(<p class="infos"><strong>#{name} : </strong>#{info}</p>).html_safe
    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

4 entries across 4 versions & 1 rubygems

Version Path
dorsale-1.1.4 app/helpers/dorsale/context_helper.rb
dorsale-1.1.3 app/helpers/dorsale/context_helper.rb
dorsale-1.1.2 app/helpers/dorsale/context_helper.rb
dorsale-1.1.1 app/helpers/dorsale/context_helper.rb