Module: Scrivito::ControllerHelper

Included in:
ScrivitoHelper
Defined in:
lib/scrivito/controller_helper.rb

Overview

This helper contains methods, which are available in both your views and your controllers.

Instance Method Summary collapse

Instance Method Details

#scrivito_in_editable_view?Boolean

Note:

scrivito_in_editable_view? is also a helper method.

Returns whether the GUI is in the editable view.



55
56
57
# File 'lib/scrivito/controller_helper.rb', line 55

def scrivito_in_editable_view?
  EditingContextMiddleware.from_request(request).editable_display_mode?
end

#scrivito_path(target, options = {}) ⇒ String

Note:

scrivito_path is also a helper method.

Returns the (URL-)path of a CMS object.



22
23
24
# File 'lib/scrivito/controller_helper.rb', line 22

def scrivito_path(target, options = {})
  CmsRouting.new(request, self, scrivito_engine).path_or_url(target, "path", options)
end

#scrivito_url(target, options = {}) ⇒ String

Note:

scrivito_url is also a helper method.

Returns the absolute URL of a CMS object.



40
41
42
# File 'lib/scrivito/controller_helper.rb', line 40

def scrivito_url(target, options = {})
  CmsRouting.new(request, self, scrivito_engine).path_or_url(target, "url", options)
end

#scrivito_userScrivito::User

Note:

scrivito_user is also a helper method.

Returns the current user.



70
71
72
# File 'lib/scrivito/controller_helper.rb', line 70

def scrivito_user
  Scrivito::EditingContextMiddleware.from_request(request).editor
end