Module: ConstructorPages::PagesHelper
- Includes:
- TreeviewHelper
- Defined in:
- app/helpers/constructor_pages/pages_helper.rb
Instance Method Summary collapse
- #for_select(roots) ⇒ Object
- #image_tag_with_at2x(name_at_1x, options = {}) ⇒ Object
- #templates ⇒ Object
Methods included from TreeviewHelper
Instance Method Details
#for_select(roots) ⇒ Object
5 6 7 8 9 10 11 |
# File 'app/helpers/constructor_pages/pages_helper.rb', line 5 def for_select(roots) result = [] roots.each do |r| r.self_and_descendants.each {|i| result.push(["#{'--'*i.level} #{i.name}", i.id, {'data-full_url' => i.full_url}])} end result end |
#image_tag_with_at2x(name_at_1x, options = {}) ⇒ Object
17 18 19 20 |
# File 'app/helpers/constructor_pages/pages_helper.rb', line 17 def image_tag_with_at2x(name_at_1x, ={}) name_at_2x = name_at_1x.gsub(%r{\.\w+$}, '@2x\0') image_tag(name_at_1x, .merge("data-at2x" => asset_path(name_at_2x))) end |
#templates ⇒ Object
13 14 15 |
# File 'app/helpers/constructor_pages/pages_helper.rb', line 13 def templates Template.all.map{|t| ["#{'--'*t.level} #{t.name}", t.id]} end |