|
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +require 'administrate/base_dashboard' |
| 4 | + |
| 5 | +class ClassStudentDashboard < Administrate::BaseDashboard |
| 6 | + # ATTRIBUTE_TYPES |
| 7 | + # a hash that describes the type of each of the model's fields. |
| 8 | + # |
| 9 | + # Each different type represents an Administrate::Field object, |
| 10 | + # which determines how the attribute is displayed |
| 11 | + # on pages throughout the dashboard. |
| 12 | + ATTRIBUTE_TYPES = { |
| 13 | + school_class: Field::HasOne, |
| 14 | + student_id: Field::String, |
| 15 | + created_at: Field::DateTime, |
| 16 | + updated_at: Field::DateTime |
| 17 | + }.freeze |
| 18 | + |
| 19 | + # COLLECTION_ATTRIBUTES |
| 20 | + # an array of attributes that will be displayed on the model's index page. |
| 21 | + # |
| 22 | + # By default, it's limited to four items to reduce clutter on index pages. |
| 23 | + # Feel free to add, remove, or rearrange items. |
| 24 | + COLLECTION_ATTRIBUTES = %i[ |
| 25 | + student_id |
| 26 | + created_at |
| 27 | + updated_at |
| 28 | + ].freeze |
| 29 | + |
| 30 | + # SHOW_PAGE_ATTRIBUTES |
| 31 | + # an array of attributes that will be displayed on the model's show page. |
| 32 | + SHOW_PAGE_ATTRIBUTES = %i[ |
| 33 | + student_id_changed |
| 34 | + created_at |
| 35 | + updated_at |
| 36 | + ].freeze |
| 37 | + |
| 38 | + # FORM_ATTRIBUTES |
| 39 | + # an array of attributes that will be displayed |
| 40 | + # on the model's form (`new` and `edit`) pages. |
| 41 | + FORM_ATTRIBUTES = %i[].freeze |
| 42 | + |
| 43 | + # COLLECTION_FILTERS |
| 44 | + # a hash that defines filters that can be used while searching via the search |
| 45 | + # field of the dashboard. |
| 46 | + # |
| 47 | + # For example to add an option to search for open resources by typing "open:" |
| 48 | + # in the search field: |
| 49 | + # |
| 50 | + # COLLECTION_FILTERS = { |
| 51 | + # open: ->(resources) { resources.where(open: true) } |
| 52 | + # }.freeze |
| 53 | + COLLECTION_FILTERS = {}.freeze |
| 54 | + |
| 55 | + # Overwrite this method to customize how school classes are displayed |
| 56 | + # across all pages of the admin dashboard. |
| 57 | + # |
| 58 | + # def display_resource(school_class) |
| 59 | + # "SchoolClass ##{school_class.id}" |
| 60 | + # end |
| 61 | +end |
0 commit comments