Class: RailsConnector::DefaultCmsController

Inherits:
ApplicationController
  • Object
show all
Includes:
CmsAccessible
Defined in:
app/controllers/rails_connector/default_cms_controller.rb

Overview

This controller provides some default includes (CmsAccessible), before filters (load_object, among others), and actions to simplify CMS object handling. It should never be used directly, but only as a super class to CmsController.

Direct Known Subclasses

CmsController

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CmsAccessible

#deliver_file, #force_html_format, #render_obj_error

Class Method Details

.use_for_obj_dispatch?Boolean

This method indicates if this controller should be used automatically when an Obj is requested via the Rails Connector's standard routes. It returns true by default.

Overwrite it to return false if you do want your controller to be excluded from Obj dispatching.

You may also implement a method with the name use_for_obj_dispatch? in controllers not descending from RailsConnector::DefaultCmsController to include them in Obj dispatching.

Returns:

  • (Boolean)

See Also:

  • Obj#controller_name

38
39
40
# File 'app/controllers/rails_connector/default_cms_controller.rb', line 38

def self.use_for_obj_dispatch?
  true
end

Instance Method Details

#indexObject

Default Action. Delivers files directly if their mime type is not text/html


17
18
19
# File 'app/controllers/rails_connector/default_cms_controller.rb', line 17

def index
  deliver_file if @obj.mime_type != "text/html"
end

#toggle_editmarkersObject

Toggles edit markers. The current status is stored in the session.


23
24
25
26
# File 'app/controllers/rails_connector/default_cms_controller.rb', line 23

def toggle_editmarkers
  session[:hide_editmarkers] = !session[:hide_editmarkers]
  redirect_to cms_id_url(@obj)
end