diff --git a/app/controllers/manager/dossiers_controller.rb b/app/controllers/manager/dossiers_controller.rb new file mode 100644 index 000000000..d42d335ce --- /dev/null +++ b/app/controllers/manager/dossiers_controller.rb @@ -0,0 +1,4 @@ +module Manager + class DossiersController < Manager::ApplicationController + end +end diff --git a/app/controllers/manager/gestionnaires_controller.rb b/app/controllers/manager/gestionnaires_controller.rb new file mode 100644 index 000000000..859bf2749 --- /dev/null +++ b/app/controllers/manager/gestionnaires_controller.rb @@ -0,0 +1,4 @@ +module Manager + class GestionnairesController < Manager::ApplicationController + end +end diff --git a/app/controllers/manager/users_controller.rb b/app/controllers/manager/users_controller.rb new file mode 100644 index 000000000..4cde73804 --- /dev/null +++ b/app/controllers/manager/users_controller.rb @@ -0,0 +1,4 @@ +module Manager + class UsersController < Manager::ApplicationController + end +end diff --git a/app/dashboards/dossier_dashboard.rb b/app/dashboards/dossier_dashboard.rb new file mode 100644 index 000000000..734b4fe25 --- /dev/null +++ b/app/dashboards/dossier_dashboard.rb @@ -0,0 +1,54 @@ +require "administrate/base_dashboard" + +class DossierDashboard < Administrate::BaseDashboard + # 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 + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + id: Field::Number, + procedure: Field::HasOne, + state: Field::String, + text_summary: Field::String, + created_at: Field::DateTime, + updated_at: Field::DateTime, + types_de_champ: TypesDeChampCollectionField, + }.freeze + + # 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 add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :id, + :procedure, + :created_at, + :state + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :text_summary, + :state, + :procedure, + :types_de_champ, + :created_at, + :updated_at, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [].freeze + + # Overwrite this method to customize how users are displayed + # across all pages of the admin dashboard. + # + # def display_resource(user) + # "User ##{user.id}" + # end +end diff --git a/app/dashboards/gestionnaire_dashboard.rb b/app/dashboards/gestionnaire_dashboard.rb new file mode 100644 index 000000000..db1d6727b --- /dev/null +++ b/app/dashboards/gestionnaire_dashboard.rb @@ -0,0 +1,50 @@ +require "administrate/base_dashboard" + +class GestionnaireDashboard < Administrate::BaseDashboard + # 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 + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + id: Field::Number, + email: Field::String, + created_at: Field::DateTime, + updated_at: Field::DateTime, + current_sign_in_at: Field::DateTime, + dossiers: Field::HasMany, + }.freeze + + # 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 add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :email, + :created_at, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :dossiers, + :id, + :email, + :current_sign_in_at, + :created_at, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [].freeze + + # Overwrite this method to customize how users are displayed + # across all pages of the admin dashboard. + # + def display_resource(gestionnaire) + gestionnaire.email + end +end diff --git a/app/dashboards/procedure_dashboard.rb b/app/dashboards/procedure_dashboard.rb index dc7c3681d..af16cfc04 100644 --- a/app/dashboards/procedure_dashboard.rb +++ b/app/dashboards/procedure_dashboard.rb @@ -74,7 +74,7 @@ class ProcedureDashboard < Administrate::BaseDashboard # Overwrite this method to customize how procedures are displayed # across all pages of the admin dashboard. # - # def display_resource(procedure) - # "Procedure ##{procedure.id}" - # end + def display_resource(procedure) + "#{procedure.libelle} ##{procedure.id}" + end end diff --git a/app/dashboards/user_dashboard.rb b/app/dashboards/user_dashboard.rb new file mode 100644 index 000000000..19fcb2e54 --- /dev/null +++ b/app/dashboards/user_dashboard.rb @@ -0,0 +1,50 @@ +require "administrate/base_dashboard" + +class UserDashboard < Administrate::BaseDashboard + # 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 + # on pages throughout the dashboard. + ATTRIBUTE_TYPES = { + id: Field::Number, + email: Field::String, + created_at: Field::DateTime, + updated_at: Field::DateTime, + current_sign_in_at: Field::DateTime, + dossiers: Field::HasMany, + }.freeze + + # 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 add, remove, or rearrange items. + COLLECTION_ATTRIBUTES = [ + :email, + :created_at, + ].freeze + + # SHOW_PAGE_ATTRIBUTES + # an array of attributes that will be displayed on the model's show page. + SHOW_PAGE_ATTRIBUTES = [ + :dossiers, + :id, + :email, + :current_sign_in_at, + :created_at, + ].freeze + + # FORM_ATTRIBUTES + # an array of attributes that will be displayed + # on the model's form (`new` and `edit`) pages. + FORM_ATTRIBUTES = [].freeze + + # Overwrite this method to customize how users are displayed + # across all pages of the admin dashboard. + # + def display_resource(user) + user.email + end +end diff --git a/app/views/manager/application/_navigation.html.erb b/app/views/manager/application/_navigation.html.erb index 20b3b7aa9..60c28e051 100644 --- a/app/views/manager/application/_navigation.html.erb +++ b/app/views/manager/application/_navigation.html.erb @@ -12,7 +12,8 @@ as defined by the routes in the `admin/` namespace
- <% Administrate::Namespace.new(namespace).resources.each do |resource| %> + <% Administrate::Namespace.new(namespace).resources.reject { |resource| resource.resource == 'dossiers'}.each do |resource| %> + <%= link_to( display_resource_name(resource), [namespace, resource.path], diff --git a/config/routes.rb b/config/routes.rb index 106e1002d..be7433006 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -11,6 +11,10 @@ Rails.application.routes.draw do put 'enable_feature', on: :member end + resources :users, only: [:index, :show] + resources :gestionnaires, only: [:index, :show] + resources :dossiers, only: [:show] + resources :demandes, only: [:index] post 'demandes/create_administrateur' post 'demandes/refuse_administrateur'