module Editmode::Helper
Public Instance Methods
e(identifier, *args)
click to toggle source
Render non-editable content
# File lib/editmode/helper.rb, line 4 def e(identifier, *args) field, options = parse_arguments(args) begin chunk = Editmode::ChunkValue.new(identifier, **options.merge({raw: true})) if chunk.chunk_type == 'collection_item' chunk.field(field) else chunk.content end rescue => er Rails.logger.info "#{er}: We can't render content for #{identifier}" return "" end end
parse_arguments(args)
click to toggle source
# File lib/editmode/helper.rb, line 25 def parse_arguments(args) field = nil options = {} if args[0].class.name == 'String' field = args[0] options = args[1] || {} elsif args[0].class.name == 'Hash' options = args[0] || {} end return field, options end
render_custom_field_raw(label, options={})
click to toggle source
# File lib/editmode/helper.rb, line 20 def render_custom_field_raw(label, options={}) e(@custom_field_chunk["identifier"], label, options.merge({response: @custom_field_chunk})) end
Also aliased as: f