Sha256: 7446aa13a5dab7556956c3e21f0eaf4fbb20702874d54826bf2741365b95bd90
Contents?: true
Size: 828 Bytes
Versions: 1
Compression:
Stored size: 828 Bytes
Contents
require 'action_view/helpers' module RenuoCmsRails module CmsHelper def cms(path, default_value = nil, &block) url_path = "#{path}-#{I18n.locale}" default_translation = capture_default_value(path, default_value, &block) content_tag(:div, default_translation, data: cms_attributes(url_path)) end private # :reek:FeatureEnvy def cms_attributes(url_path) config = RenuoCmsRails.configuration cms_attributes = { content_path: url_path, api_host: config.api_host, api_key: config.api_key } cms_attributes[:private_api_key] = config.private_api_key if cms_admin? cms_attributes end def capture_default_value(path, default_value) return default_value if default_value return capture { yield } if block_given? I18n.t(path) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
renuo-cms-rails-0.0.1 | lib/renuo_cms_rails/cms_helper.rb |