Sha256: a6e636d46b4967c4aaa8e9dfa3080a4dc754f7d9d34f87b77aae2e1873c9d832

Contents?: true

Size: 1.26 KB

Versions: 7

Compression:

Stored size: 1.26 KB

Contents

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

<% if model.respond_to?(:acts_as_nested_set_options) -%>
  settings :index_view => 'tree', :search => false, :batch => false, :well => false
<% 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 -%><%= ', :sortable => false' if translated_columns.include?(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

7 entries across 7 versions & 1 rubygems

Version Path
ab_admin-0.2.3 lib/generators/ab_admin/model/templates/resource.erb
ab_admin-0.2.2 lib/generators/ab_admin/model/templates/resource.erb
ab_admin-0.2.1 lib/generators/ab_admin/model/templates/resource.erb
ab_admin-0.2.0 lib/generators/ab_admin/model/templates/resource.erb
ab_admin-0.1.2 lib/generators/ab_admin/model/templates/resource.erb
ab_admin-0.1.1 lib/generators/ab_admin/model/templates/resource.erb
ab_admin-0.1.0 lib/generators/ab_admin/model/templates/resource.erb