Module: Gluttonberg::Content
- Defined in:
- lib/gluttonberg/content.rb,
lib/gluttonberg/content/block.rb,
lib/gluttonberg/content/workflow.rb,
lib/gluttonberg/content/clean_html.rb,
lib/gluttonberg/content/versioning.rb,
lib/gluttonberg/content/publishable.rb,
lib/gluttonberg/content/localization.rb,
lib/gluttonberg/content/slug_management.rb,
lib/gluttonberg/content/block_localization.rb
Overview
The content module contains a whole bunch classes and mixins related to the pages, localizations, content models and helpers for rendering content inside of views.
Defined Under Namespace
Modules: Block, BlockLocalization, CleanHtml, Localization, Publishable, SlugManagement, Versioning, Workflow
Constant Summary
- @@content_associations =
nil- @@non_localized_associations =
nil- @@localizations =
{}
- @@localization_associations =
nil- @@localization_classes =
nil
Class Method Summary (collapse)
-
+ (Object) content_associations
Return the collection of content association names.
-
+ (Object) localization_associations
Returns an array of the localization association names.
-
+ (Object) localizations
Returns a hash of content classes that are localized, keyed to the association name.
-
+ (Object) non_localized_associations
For each content class that is registered, a corresponding association is declared against the Page model.
-
+ (Object) register_localization(assoc_name, klass)
If a content class has the is_localized declaration, this method is used to register it so we can keep track of all localized content.
-
+ (Object) setup
This is called after the application loads so that we can define any extra associations or do house-keeping once everything is required and running.
Class Method Details
+ (Object) content_associations
Return the collection of content association names.
44 45 46 |
# File 'lib/gluttonberg/content.rb', line 44 def self.content_associations @@content_associations end |
+ (Object) localization_associations
Returns an array of the localization association names.
61 62 63 |
# File 'lib/gluttonberg/content.rb', line 61 def self.localization_associations @@localization_associations end |
+ (Object) localizations
Returns a hash of content classes that are localized, keyed to the association name.
56 57 58 |
# File 'lib/gluttonberg/content.rb', line 56 def self.localizations @@localizations end |
+ (Object) non_localized_associations
For each content class that is registered, a corresponding association is declared against the Page model. We need to keep track of these, which is what this method does. It just returns an array of the association names.
36 37 38 39 40 41 |
# File 'lib/gluttonberg/content.rb', line 36 def self.non_localized_associations @@non_localized_associations ||= begin non_localized = Block.classes.select {|c| !c.localized? } non_localized.collect {|c| c.association_name } end end |
+ (Object) register_localization(assoc_name, klass)
If a content class has the is_localized declaration, this method is used to register it so we can keep track of all localized content.
50 51 52 |
# File 'lib/gluttonberg/content.rb', line 50 def self.register_localization(assoc_name, klass) @@localizations[assoc_name] = klass end |
+ (Object) setup
This is called after the application loads so that we can define any extra associations or do house-keeping once everything is required and running
25 26 27 28 29 30 |
# File 'lib/gluttonberg/content.rb', line 25 def self.setup # Store the names of the associations in their own array for convenience @@localization_associations = @@localizations.keys @@localization_classes = @@localizations.values @@content_associations = Block.classes.collect { |k| k.association_name } end |