Module: Cms::Acts::ContentBlock::MacroMethods
- Defined in:
- lib/cms/acts/content_block.rb
Defined Under Namespace
Modules: InstanceMethods
Instance Method Summary collapse
-
#acts_as_content_block(options = {}) ⇒ Object
Adds Content Block behavior to this class.
Instance Method Details
#acts_as_content_block(options = {}) ⇒ Object
Adds Content Block behavior to this class
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/cms/acts/content_block.rb', line 15 def acts_as_content_block(={}) defaults = { # Set default values here. allow_attachments: true, content_module: true, readonly: false, } = defaults.merge() if [:belongs_to_attachment].present? raise ArgumentError.new ":belongs_to_attachment option is no longer supported. Please use :has_attachments option" end extend Cms::DefaultAccessible if [:allow_attachments] is_readonly if [:readonly] is_archivable([:archiveable].is_a?(Hash) ? [:archiveable] : {}) unless [:archiveable] == false is_connectable([:connectable].is_a?(Hash) ? [:connectable] : {}) unless [:connectable] == false flush_cache_on_change([:flush_cache_on_change].is_a?(Hash) ? [:flush_cache_on_change] : {}) unless [:flush_cache_on_change] == false is_renderable({:instance_variable_name_for_view => "@content_block"}.merge([:renderable].is_a?(Hash) ? [:renderable] : {})) unless [:renderable] == false is_publishable([:publishable].is_a?(Hash) ? [:publishable] : {}) unless [:publishable] == false is_searchable([:searchable].is_a?(Hash) ? [:searchable] : {}) unless [:searchable] == false uses_soft_delete([:soft_delete].is_a?(Hash) ? [:soft_delete] : {}) unless [:soft_delete] == false is_taggable([:taggable].is_a?(Hash) ? [:taggable] : {}) if [:taggable] is_userstamped([:userstamped].is_a?(Hash) ? [:userstamped] : {}) unless [:userstamped] == false is_versioned([:versioned].is_a?(Hash) ? [:versioned] : {}) unless [:versioned] == false include InstanceMethods unless [:content_module] == false has_content_type end extend Cms::Behaviors::Naming end |