module ActiveScaffoldCamera::ViewHelpers

Constants

I18N_ATTRIBUTES

Public Instance Methods

active_scaffold_column_snapshot(record, column) click to toggle source
# File lib/active_scaffold_camera/view_helpers.rb, line 17
def active_scaffold_column_snapshot(record, column)
  value = record.send(column.name)
  tag :img, :src => value if value
end
active_scaffold_input_snapshot(column, html_options) click to toggle source
# File lib/active_scaffold_camera/view_helpers.rb, line 11
def active_scaffold_input_snapshot(column, html_options)
  content_tag :div, :class => "snapshot-input #{html_options[:class]}", :id => html_options[:id], :data => snapshot_attributes(column) do
    hidden_field :record, column.name, :name => html_options[:name]
  end
end
snapshot_attributes(column) click to toggle source
# File lib/active_scaffold_camera/view_helpers.rb, line 4
def snapshot_attributes(column)
  attributes = Hash[I18N_ATTRIBUTES.map{ |attr| [attr, column.options[attr] || attr] }]
  attributes[:source] = column.options[:source] if column.options[:source]
  I18N_ATTRIBUTES.each { |attr| attributes[attr] = as_(attributes[attr]) if attributes[attr].is_a? Symbol }
  attributes
end