Module: Dorsale::ContextHelper
- Included in:
- AllHelpers
- Defined in:
- app/helpers/dorsale/context_helper.rb
Instance Method Summary collapse
- #actions_for(obj, opts = {}) ⇒ Object
- #context_icon(id) ⇒ Object
- #context_info(name, info, br = false) ⇒ Object
- #context_title(title) ⇒ Object
- #render_contextual ⇒ Object
Instance Method Details
#actions_for(obj, opts = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/helpers/dorsale/context_helper.rb', line 22 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 |
#context_icon(id) ⇒ Object
3 4 5 6 |
# File 'app/helpers/dorsale/context_helper.rb', line 3 def context_icon(id) id = id.to_s.gsub("_", "-") content_tag(:span, class: "icon fa fa-#{id}"){} end |
#context_info(name, info, br = false) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'app/helpers/dorsale/context_helper.rb', line 12 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 |
#context_title(title) ⇒ Object
8 9 10 |
# File 'app/helpers/dorsale/context_helper.rb', line 8 def context_title(title) content_tag(:h2){ title } end |
#render_contextual ⇒ Object
39 40 41 |
# File 'app/helpers/dorsale/context_helper.rb', line 39 def render_contextual render "dorsale/contextual" end |