Class: Spree::Content
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Spree::Content
- Defined in:
- app/models/spree/content.rb
Constant Summary collapse
- @@per_page =
10
Instance Attribute Summary collapse
-
#delete_attachment ⇒ Object
Returns the value of attribute delete_attachment.
Instance Method Summary collapse
- #attachment_sizes ⇒ Object
- #context=(value) ⇒ Object
- #default_attachment_sizes ⇒ Object
- #has_full_link? ⇒ Boolean
- #has_image? ⇒ Boolean
- #hide_title? ⇒ Boolean
- #rendered_body ⇒ Object
Instance Attribute Details
#delete_attachment ⇒ Object
Returns the value of attribute delete_attachment.
3 4 5 |
# File 'app/models/spree/content.rb', line 3 def @delete_attachment end |
Instance Method Details
#attachment_sizes ⇒ Object
52 53 54 55 56 57 58 59 60 |
# File 'app/models/spree/content.rb', line 52 def case self.context when 'slideshow' sizes = .merge(:slide => '955x476#') else sizes = end sizes end |
#context=(value) ⇒ Object
62 63 64 |
# File 'app/models/spree/content.rb', line 62 def context=(value) write_attribute :context, value.to_s.parameterize end |
#default_attachment_sizes ⇒ Object
48 49 50 |
# File 'app/models/spree/content.rb', line 48 def { :mini => '48x48>', :medium => '427x287>' } end |
#has_full_link? ⇒ Boolean
32 33 34 |
# File 'app/models/spree/content.rb', line 32 def has_full_link? has_link? && has_link_text? end |
#has_image? ⇒ Boolean
36 37 38 |
# File 'app/models/spree/content.rb', line 36 def has_image? has_value(:attachment_file_name) && .match(/gif|jpg|png/i) end |
#hide_title? ⇒ Boolean
40 41 42 |
# File 'app/models/spree/content.rb', line 40 def hide_title? self.hide_title == true end |
#rendered_body ⇒ Object
44 45 46 |
# File 'app/models/spree/content.rb', line 44 def rendered_body RDiscount.new(body.to_s).to_html.html_safe end |