Module: Spina::Admin::PagesHelper
- Defined in:
- app/helpers/spina/admin/pages_helper.rb
Instance Method Summary collapse
- #asset_available?(path) ⇒ Boolean
- #build_parts(partable, parts) ⇒ Object
- #option_label(part, value) ⇒ Object
- #parts_partial_namespace(part_type) ⇒ Object
Instance Method Details
#asset_available?(path) ⇒ Boolean
3 4 5 6 7 8 9 |
# File 'app/helpers/spina/admin/pages_helper.rb', line 3 def asset_available?(path) if defined?(Propshaft) check_propshaft_asset(path) elsif defined?(Sprockets) check_sprockets_asset(path) end end |
#build_parts(partable, parts) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/helpers/spina/admin/pages_helper.rb', line 11 def build_parts(partable, parts) I18n.with_locale(@locale) do parts.map do |part| part_attributes = current_theme.parts.find { |p| p[:name].to_s == part.to_s } partable.part(part_attributes) end end end |
#option_label(part, value) ⇒ Object
24 25 26 |
# File 'app/helpers/spina/admin/pages_helper.rb', line 24 def option_label(part, value) t(["options", part.name, value].compact.join(".")) end |
#parts_partial_namespace(part_type) ⇒ Object
20 21 22 |
# File 'app/helpers/spina/admin/pages_helper.rb', line 20 def parts_partial_namespace(part_type) part_type.tableize.sub(/\Aspina\/parts\//, "") end |