Sha256: 33b3699d3df5d92020b094542d11220b1287bcd9b6be3e212045ec6aafdca2b3

Contents?: true

Size: 587 Bytes

Versions: 4

Compression:

Stored size: 587 Bytes

Contents

module PufferHelper

  def render_head field
    field.label
  end

  def render_field field, record
    if field.options[:render]
      case field.options[:render]
      when Symbol then
        res = send(field.options[:render], record)
      when Proc then
        res = field.options[:render].bind(self).call(record)
      else ''
      end
    else
      res = record.call_chain(field.field)
    end
    unless field.native?
      url = edit_polymorphic_path [resource.prefix, record.call_chain(field.path)] rescue nil
      res = link_to res, url if url
    end
    res
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
puffer-0.0.11 app/helpers/puffer_helper.rb
puffer-0.0.10 app/helpers/puffer_helper.rb
puffer-0.0.9 app/helpers/puffer_helper.rb
puffer-0.0.8 app/helpers/puffer_helper.rb