Sha256: a3b291b47c82c36c3dc047339f40f38f3343bc39f8e4860d10bcc9007ee0bccb
Contents?: true
Size: 1016 Bytes
Versions: 5
Compression:
Stored size: 1016 Bytes
Contents
module Activa module PagesHelper # Generate select tag options with pages tree (excludes passed page) def select_options_for(page) nested_set_options(Activa::Page, page) do |i| raw "#{' ' * i.level} #{i.title}" end end # Generate url for page form def form_url(page) page.new_record? ? pages_path : activa.page_path(page) end # Set page title. Use this method in your views def title(page_title) @page_title = page_title end # This prints page title. Call this helper # inside title tag of your layout def page_title(default_title = '') @page_title || default_title end # Print heading (h1 by default) and set page title # at the same time. Use this method in your views def heading_with_title(heading, tag=:h1) title(heading) heading(heading, tag) end def heading(heading, tag=:h1, options = {}) tag = :h1 if tag.nil? content_tag(tag, heading, options) end end end
Version data entries
5 entries across 5 versions & 1 rubygems