Module: Thesis::ControllerHelpers
- Included in:
- ThesisController
- Defined in:
- lib/thesis/controllers/controller_helpers.rb
Instance Method Summary collapse
Instance Method Details
#current_page ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/thesis/controllers/controller_helpers.rb', line 3 def current_page @current_page ||= begin p = Page.where(slug: current_slug).first_or_create p.editable = page_is_editable?(p) p end end |
#current_slug ⇒ Object
11 12 13 |
# File 'lib/thesis/controllers/controller_helpers.rb', line 11 def current_slug request.fullpath.sub(/(\/)+$/,'').presence || "/" end |
#root_pages ⇒ Object
15 16 17 |
# File 'lib/thesis/controllers/controller_helpers.rb', line 15 def root_pages @root_pages ||= Page.where(parent_id: nil).order("sort_order ASC") end |
#thesis_editor ⇒ Object
19 20 21 |
# File 'lib/thesis/controllers/controller_helpers.rb', line 19 def thesis_editor current_page.editable ? "<div id='thesis-editor'></div>".html_safe : "" end |