Module: Scrivito::ControllerHelper
- Included in:
- ScrivitoHelper
- Defined in:
- app/cms/scrivito/controller_helper.rb
Overview
This helper contains methods, which are available in both your views and your controllers.
Instance Method Summary collapse
-
#scrivito_in_editable_view? ⇒ Boolean
Returns whether the UI is in the
editable
view. -
#scrivito_path(target, options = {}) ⇒ String
Returns the (URL-)path of a CMS object.
-
#scrivito_url(target, options = {}) ⇒ String
Returns the absolute URL of a CMS object.
-
#scrivito_user ⇒ Scrivito::User
Returns the current user.
Instance Method Details
#scrivito_in_editable_view? ⇒ Boolean
Note:
scrivito_in_editable_view?
is also a helper method.
Returns whether the UI is in the editable
view.
55 56 57 |
# File 'app/cms/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 'app/cms/scrivito/controller_helper.rb', line 22 def scrivito_path(target, = {}) CmsRouting.new(request, self, scrivito_engine).path_or_url(target, "path", ) 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 'app/cms/scrivito/controller_helper.rb', line 40 def scrivito_url(target, = {}) CmsRouting.new(request, self, scrivito_engine).path_or_url(target, "url", ) end |
#scrivito_user ⇒ Scrivito::User
Note:
scrivito_user
is also a helper method.
Returns the current user.
70 71 72 |
# File 'app/cms/scrivito/controller_helper.rb', line 70 def scrivito_user Scrivito::EditingContextMiddleware.from_request(request).editor end |