lib/generators/administrate/dashboard/templates/dashboard.rb.erb in administrate-0.0.12 vs lib/generators/administrate/dashboard/templates/dashboard.rb.erb in administrate-0.1.0
- old
+ new
@@ -1,14 +1,8 @@
require "administrate/base_dashboard"
class <%= class_name %>Dashboard < Administrate::BaseDashboard
- READ_ONLY_ATTRIBUTES = [
- :id,
- :created_at,
- :updated_at,
- ]
-
# ATTRIBUTE_TYPES
# a hash that describes the type of each of the model's fields.
#
# Each different type represents an Administrate::Field object,
# which determines how the attribute is displayed
@@ -17,21 +11,33 @@
<% attributes.each do |attr| -%>
<%= attr %>: <%= field_type(attr) %>,
<% end -%>
}
- # TABLE_ATTRIBUTES
+ # COLLECTION_ATTRIBUTES
# an array of attributes that will be displayed on the model's index page.
#
# By default, it's limited to four items to reduce clutter on index pages.
- # Feel free to remove the limit or customize the returned array.
- TABLE_ATTRIBUTES = ATTRIBUTE_TYPES.keys.first(<%= TABLE_ATTRIBUTE_LIMIT %>)
+ # Feel free to add, remove, or rearrange items.
+ COLLECTION_ATTRIBUTES = [
+<%=
+ attributes.first(COLLECTION_ATTRIBUTE_LIMIT).map do |attr|
+ " :#{attr},"
+ end.join("\n")
+%>
+ ]
# SHOW_PAGE_ATTRIBUTES
# an array of attributes that will be displayed on the model's show page.
SHOW_PAGE_ATTRIBUTES = ATTRIBUTE_TYPES.keys
# FORM_ATTRIBUTES
# an array of attributes that will be displayed
# on the model's form (`new` and `edit`) pages.
- FORM_ATTRIBUTES = ATTRIBUTE_TYPES.keys - READ_ONLY_ATTRIBUTES
+ FORM_ATTRIBUTES = [
+<%=
+ form_attributes.map do |attr|
+ " :#{attr},"
+ end.join("\n")
+%>
+ ]
end