Module: Cmsable::CmsableHelper

Defined in:
app/helpers/cmsable/cmsable_helper.rb

Instance Method Summary collapse

Instance Method Details

#cmsable(name_or_model, options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/helpers/cmsable/cmsable_helper.rb', line 9

def cmsable name_or_model, options = {}

  model = get_model name_or_model

  options = {
    readonly:false
  }.merge options

  # Skip checking permission of set to readonly or
  # explicit authorisation is passed
  unless options.include?(:authorised) or options[:readonly]
    options[:authorised] = authorised?(model)
  end

  content_or_editable_content model, (options[:authorised] and !options[:readonly])

end

#cmsable_assetsObject



4
5
6
7
# File 'app/helpers/cmsable/cmsable_helper.rb', line 4

def cmsable_assets
  javascript_include_tag('cmsable/application') +
  stylesheet_link_tag('cmsable/application')
end