Module: Publinator::ActsAsPublishable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/publinator.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #asset_files(asset_type_text = nil) ⇒ Object
- #asset_types ⇒ Object
- #editable_fields ⇒ Object
- #hidden_fields ⇒ Object
- #is_publishable? ⇒ Boolean
- #menu_collection ⇒ Object
- #my_slug ⇒ Object
- #path ⇒ Object
- #related_items(scope) ⇒ Object
- #url ⇒ Object
- #verify_publication ⇒ Object
Instance Method Details
#asset_files(asset_type_text = nil) ⇒ Object
50 51 52 53 |
# File 'lib/publinator.rb', line 50 def asset_files(asset_type_text = nil) return asset_items if !asset_type_text asset_items.where(:asset_type => asset_type_text) end |
#asset_types ⇒ Object
46 47 48 |
# File 'lib/publinator.rb', line 46 def asset_types [] end |
#editable_fields ⇒ Object
67 68 69 |
# File 'lib/publinator.rb', line 67 def editable_fields attribute_names - (["id", "created_at", "updated_at"] + hidden_fields) end |
#hidden_fields ⇒ Object
63 64 65 |
# File 'lib/publinator.rb', line 63 def hidden_fields [] end |
#is_publishable? ⇒ Boolean
42 43 44 |
# File 'lib/publinator.rb', line 42 def is_publishable? true end |
#menu_collection ⇒ Object
84 85 86 |
# File 'lib/publinator.rb', line 84 def nil end |
#my_slug ⇒ Object
55 56 57 |
# File 'lib/publinator.rb', line 55 def my_slug slug end |
#path ⇒ Object
71 72 73 74 75 76 77 78 |
# File 'lib/publinator.rb', line 71 def path raise "publication not found" if !self.publication if self.publication.section "#{self.publication.section.path}/#{self.publication.slug}" else "/#{self.class.to_s.tableize}/#{self.publication.slug}" end end |
#related_items(scope) ⇒ Object
59 60 61 |
# File 'lib/publinator.rb', line 59 def (scope) [] end |
#url ⇒ Object
80 81 82 |
# File 'lib/publinator.rb', line 80 def url site.url(path) end |
#verify_publication ⇒ Object
88 89 90 91 92 93 94 95 |
# File 'lib/publinator.rb', line 88 def verify_publication if publication.nil? self.publication = Publinator::Publication.new(:publishable => self) end self.publication.site = site unless publication.site.present? self.publication.section = section unless !section self.publication.default = default end |