Module: ConstructorPages::PagesHelper

Defined in:
pages/app/helpers/constructor_pages/pages_helper.rb

Instance Method Summary collapse

Instance Method Details

#for_select(roots) ⇒ Object



3
4
5
6
7
8
9
# File 'pages/app/helpers/constructor_pages/pages_helper.rb', line 3

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



15
16
17
18
# File 'pages/app/helpers/constructor_pages/pages_helper.rb', line 15

def image_tag_with_at2x(name_at_1x, options={})
  name_at_2x = name_at_1x.gsub(%r{\.\w+$}, '@2x\0')
  image_tag(name_at_1x, options.merge("data-at2x" => asset_path(name_at_2x)))
end

#templatesObject



11
12
13
# File 'pages/app/helpers/constructor_pages/pages_helper.rb', line 11

def templates
  Template.all.map{|t| ["#{'--'*t.level} #{t.name}", t.id]}
end