Sha256: 526e259d29604daaa7f3bb129943893a2bf063bdf3988540ce8bc4855c688d90

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

- name_without_id_or_type = name.sub(/_(id|type)$/, '')

- if resource.class.reflect_on_association(name_without_id_or_type).try(:options).try('[]', :polymorphic) == true
  -# name =~ /_id$/ is required to prevent user template from being renedred 2x times:
  -# first time for _id field, second time for _type field
  - if name =~ /_id$/ && has_template?( "_#{view_prefix}.#{name_without_id_or_type}" )
    = render "#{view_prefix}.#{name_without_id_or_type}", :resource => resource, :name => name, :view_prefix => view_prefix

- elsif has_template? "_#{view_prefix}.#{name}"
  = render "#{view_prefix}.#{name}", :resource => resource, :name => name, :view_prefix => view_prefix
- elsif resource.send(name).blank? == false
  - render_field_type, use_i18n = render_field_type(resource, name)
  - if use_i18n and has_template?( "_show.field_type_#{render_field_type}_i18n" )
    = render "show.field_type_#{render_field_type}_i18n", :resource => resource, :name => name

  - elsif has_template?( "_show.field_type_#{render_field_type}" )
    = render "show.field_type_#{render_field_type}", :resource => resource, :name => name

  - else
    = render "show.field_type_text", :resource => resource, :name => name

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
releaf-0.1.2 app/views/releaf/base/_show.field.html.haml