Module: Locomotive::ThemeAssetsHelper
- Defined in:
- app/helpers/locomotive/theme_assets_helper.rb
Instance Method Summary collapse
- #allow_plain_text_editing?(asset) ⇒ Boolean
- #display_plain_text?(asset) ⇒ Boolean
- #image_dimensions_and_size(asset) ⇒ Object
- #plain_text_type(asset) ⇒ Object
- #theme_assets_to_json(list) ⇒ Object
Instance Method Details
#allow_plain_text_editing?(asset) ⇒ Boolean
12 13 14 |
# File 'app/helpers/locomotive/theme_assets_helper.rb', line 12 def allow_plain_text_editing?(asset) asset.new_record? || asset.stylesheet_or_javascript? end |
#display_plain_text?(asset) ⇒ Boolean
16 17 18 19 20 21 22 |
# File 'app/helpers/locomotive/theme_assets_helper.rb', line 16 def display_plain_text?(asset) if asset.new_record? asset.performing_plain_text? else asset.stylesheet_or_javascript? end end |
#image_dimensions_and_size(asset) ⇒ Object
4 5 6 |
# File 'app/helpers/locomotive/theme_assets_helper.rb', line 4 def image_dimensions_and_size(asset) content_tag(:small, "#{asset.width}px x #{asset.height}px | #{number_to_human_size(asset.size)}") end |
#plain_text_type(asset) ⇒ Object
8 9 10 |
# File 'app/helpers/locomotive/theme_assets_helper.rb', line 8 def plain_text_type(asset) asset.size && asset.size > 40000 ? 'nude' : (asset.content_type || 'stylesheet') end |
#theme_assets_to_json(list) ⇒ Object
24 25 26 27 |
# File 'app/helpers/locomotive/theme_assets_helper.rb', line 24 def theme_assets_to_json(list) return nil.to_json if list.nil? list.map { |asset| asset.as_json(:ability => current_ability) }.to_json end |