Module: Gluttonberg::Content::BlockLocalization
- Defined in:
- lib/gluttonberg/content/block_localization.rb
Overview
The mixin used when generating a localization for content classes. It adds the base properties — e.g. id — and associations. It also comes with some convenience methods for accessing the associated section in a page.
These just defer to the parent class.
Class Method Summary collapse
Instance Method Summary collapse
- #association_name ⇒ Object
- #content_type ⇒ Object
- #section_label ⇒ Object
- #section_name ⇒ Object
- #section_position ⇒ Object
Class Method Details
.included(klass) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/gluttonberg/content/block_localization.rb', line 9 def self.included(klass) klass.class_eval do class << self; attr_accessor :content_type, :association_name end belongs_to :page_localization end end |
Instance Method Details
#association_name ⇒ Object
17 18 19 |
# File 'lib/gluttonberg/content/block_localization.rb', line 17 def association_name self.class.association_name end |
#content_type ⇒ Object
21 22 23 |
# File 'lib/gluttonberg/content/block_localization.rb', line 21 def content_type self.class.content_type end |
#section_label ⇒ Object
33 34 35 |
# File 'lib/gluttonberg/content/block_localization.rb', line 33 def section_label parent.section[:label] unless parent.blank? end |
#section_name ⇒ Object
25 26 27 |
# File 'lib/gluttonberg/content/block_localization.rb', line 25 def section_name parent.section[:name] end |
#section_position ⇒ Object
29 30 31 |
# File 'lib/gluttonberg/content/block_localization.rb', line 29 def section_position parent.section[:position] end |