Module: Thesis::ControllerHelpers

Included in:
ThesisController
Defined in:
lib/thesis/controllers/controller_helpers.rb

Instance Method Summary collapse

Instance Method Details

#current_pageObject



3
4
5
6
7
# File 'lib/thesis/controllers/controller_helpers.rb', line 3

def current_page
  slug = request.fullpath.sub(/(\/)+$/,'')
  @current_page ||= Page.where(slug: slug).first
  @current_page
end

#root_pagesObject



9
10
11
# File 'lib/thesis/controllers/controller_helpers.rb', line 9

def root_pages
  @root_pages ||= Page.where(parent_id: nil).order("sort_order ASC")
end

#thesis_editorObject



13
14
15
# File 'lib/thesis/controllers/controller_helpers.rb', line 13

def thesis_editor
  "<div id='thesis-editor'></div>".html_safe if page_is_editable?(current_page)
end