|
| 1 | +require "administrate/base_dashboard" |
| 2 | + |
| 3 | +class StudentDashboard < Administrate::BaseDashboard |
| 4 | + # ATTRIBUTE_TYPES |
| 5 | + # a hash that describes the type of each of the model's fields. |
| 6 | + # |
| 7 | + # Each different type represents an Administrate::Field object, |
| 8 | + # which determines how the attribute is displayed |
| 9 | + # on pages throughout the dashboard. |
| 10 | + ATTRIBUTE_TYPES = { |
| 11 | + id: Field::Number, |
| 12 | + personal_consent: Field::Boolean, |
| 13 | + full_name: Field::String, |
| 14 | + school_email: Field::String, |
| 15 | + alternate_email: Field::String, |
| 16 | + sex: Field::String.with_options(searchable: false), |
| 17 | + subject_preferences: Field::String.with_options(searchable: false), |
| 18 | + education_level: Field::String.with_options(searchable: false), |
| 19 | + parental_consent: Field::Boolean, |
| 20 | + match_count: Field::Number, |
| 21 | + created_at: Field::DateTime, |
| 22 | + updated_at: Field::DateTime, |
| 23 | + subject_1: Field::String, |
| 24 | + subject_2: Field::String, |
| 25 | + subject_3: Field::String, |
| 26 | + others_subject: Field::String, |
| 27 | + contact_number: Field::String, |
| 28 | + }.freeze |
| 29 | + |
| 30 | + # COLLECTION_ATTRIBUTES |
| 31 | + # an array of attributes that will be displayed on the model's index page. |
| 32 | + # |
| 33 | + # By default, it's limited to four items to reduce clutter on index pages. |
| 34 | + # Feel free to add, remove, or rearrange items. |
| 35 | + COLLECTION_ATTRIBUTES = %i[ |
| 36 | + id |
| 37 | + personal_consent |
| 38 | + full_name |
| 39 | + school_email |
| 40 | + ].freeze |
| 41 | + |
| 42 | + # SHOW_PAGE_ATTRIBUTES |
| 43 | + # an array of attributes that will be displayed on the model's show page. |
| 44 | + SHOW_PAGE_ATTRIBUTES = %i[ |
| 45 | + id |
| 46 | + personal_consent |
| 47 | + full_name |
| 48 | + school_email |
| 49 | + alternate_email |
| 50 | + sex |
| 51 | + subject_preferences |
| 52 | + education_level |
| 53 | + parental_consent |
| 54 | + match_count |
| 55 | + created_at |
| 56 | + updated_at |
| 57 | + subject_1 |
| 58 | + subject_2 |
| 59 | + subject_3 |
| 60 | + others_subject |
| 61 | + contact_number |
| 62 | + ].freeze |
| 63 | + |
| 64 | + # FORM_ATTRIBUTES |
| 65 | + # an array of attributes that will be displayed |
| 66 | + # on the model's form (`new` and `edit`) pages. |
| 67 | + FORM_ATTRIBUTES = %i[ |
| 68 | + personal_consent |
| 69 | + full_name |
| 70 | + school_email |
| 71 | + alternate_email |
| 72 | + sex |
| 73 | + subject_preferences |
| 74 | + education_level |
| 75 | + parental_consent |
| 76 | + match_count |
| 77 | + subject_1 |
| 78 | + subject_2 |
| 79 | + subject_3 |
| 80 | + others_subject |
| 81 | + contact_number |
| 82 | + ].freeze |
| 83 | + |
| 84 | + # COLLECTION_FILTERS |
| 85 | + # a hash that defines filters that can be used while searching via the search |
| 86 | + # field of the dashboard. |
| 87 | + # |
| 88 | + # For example to add an option to search for open resources by typing "open:" |
| 89 | + # in the search field: |
| 90 | + # |
| 91 | + # COLLECTION_FILTERS = { |
| 92 | + # open: ->(resources) { resources.where(open: true) } |
| 93 | + # }.freeze |
| 94 | + COLLECTION_FILTERS = {}.freeze |
| 95 | + |
| 96 | + # Overwrite this method to customize how students are displayed |
| 97 | + # across all pages of the admin dashboard. |
| 98 | + # |
| 99 | + # def display_resource(student) |
| 100 | + # "Student ##{student.id}" |
| 101 | + # end |
| 102 | +end |
0 commit comments