Class: Locomotive::ThemeAsset
- Inherits:
-
Object
- Object
- Locomotive::ThemeAsset
- Includes:
- Concerns::Asset::Checksum, Concerns::Asset::Types, Concerns::Shared::SiteScope, Mongoid::Document
- Defined in:
- app/models/locomotive/theme_asset.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#local_path(short = false) ⇒ Object
fields ##.
-
#source ⇒ Object
validations ##.
- #stylesheet_or_javascript? ⇒ Boolean
-
#touch_site_attribute ⇒ Object
methods ##.
Class Method Details
.all_grouped_by_folder(site) ⇒ Object
53 54 55 56 |
# File 'app/models/locomotive/theme_asset.rb', line 53 def self.all_grouped_by_folder(site) assets = site.theme_assets.order_by(:slug.asc) assets.group_by { |a| a.folder.split('/').first.to_sym } end |
.checksums ⇒ Object
58 59 60 61 62 63 64 |
# File 'app/models/locomotive/theme_asset.rb', line 58 def self.checksums {}.tap do |hash| self.only(:local_path, :checksum).each do |asset| hash[asset.local_path] = asset.checksum end end end |
Instance Method Details
#local_path(short = false) ⇒ Object
fields ##
12 |
# File 'app/models/locomotive/theme_asset.rb', line 12 field :local_path |
#source ⇒ Object
validations ##
30 |
# File 'app/models/locomotive/theme_asset.rb', line 30 validates_presence_of :source, on: :create |
#stylesheet_or_javascript? ⇒ Boolean
41 42 43 |
# File 'app/models/locomotive/theme_asset.rb', line 41 def stylesheet_or_javascript? self.stylesheet? || self.javascript? end |
#touch_site_attribute ⇒ Object
methods ##
37 38 39 |
# File 'app/models/locomotive/theme_asset.rb', line 37 def touch_site_attribute :template_version end |