Sha256: 93fd06e97c8216406e6a05c9fde1a6366d3f119c9a1d7c91750b2baffca34309

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

class AbAdmin<%= model.name %> < AbAdmin::AbstractResource

<% if model.respond_to?(:acts_as_nested_set_options) -%>
  settings index_view: 'tree'
<% else -%>
  table do
<% index_attrs.without('id', 'updated_at').each do |attr| -%>
    field :<%= attr -%><%= ', sortable: false' if translated_columns.include?(attr) %>
<% end -%>
  end

  search do
<% index_attrs.each do |attr| -%>
    field :<%= attr %>
<% end -%>
  end
<% end -%>

  form do
    group :base do
<% index_attrs.without('id', 'created_at', 'updated_at', 'lat', 'lon', 'zoom', 'lft', 'rgt', 'depth').without(*translated_columns).each do |attr| -%>
      field :<%= attr %>
<% end -%>
    end
<% unless translated_columns.empty? -%>
    locale_tabs do
<% translated_columns.each do |attr| -%>
      field :<%= attr -%><%= ', as: :editor' if attr =~ /description|content|body/ %>
<% end -%>
    end
<% end -%>
<% asset_assocs = model.reflect_on_all_associations.find_all { |a| a.options[:as] == :assetable } -%>
<% asset_assocs.each do |a| -%>
    field :<%= a.name %>, as: :uploader
<% end -%>
<% if (%w(lat lon zoom) - index_attrs).empty? -%>
    field :map, as: :map
<% end -%>
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ab_admin-0.6.1 lib/generators/ab_admin/model/templates/resource.erb
ab_admin-0.6.0 lib/generators/ab_admin/model/templates/resource.erb
ab_admin-0.5.0 lib/generators/ab_admin/model/templates/resource.erb
ab_admin-0.4.0 lib/generators/ab_admin/model/templates/resource.erb