Add users and gestionnaires to manager
This commit is contained in:
parent
3f99f41372
commit
e2a126e37a
9 changed files with 175 additions and 4 deletions
4
app/controllers/manager/dossiers_controller.rb
Normal file
4
app/controllers/manager/dossiers_controller.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
module Manager
|
||||
class DossiersController < Manager::ApplicationController
|
||||
end
|
||||
end
|
4
app/controllers/manager/gestionnaires_controller.rb
Normal file
4
app/controllers/manager/gestionnaires_controller.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
module Manager
|
||||
class GestionnairesController < Manager::ApplicationController
|
||||
end
|
||||
end
|
4
app/controllers/manager/users_controller.rb
Normal file
4
app/controllers/manager/users_controller.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
module Manager
|
||||
class UsersController < Manager::ApplicationController
|
||||
end
|
||||
end
|
54
app/dashboards/dossier_dashboard.rb
Normal file
54
app/dashboards/dossier_dashboard.rb
Normal file
|
@ -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
|
50
app/dashboards/gestionnaire_dashboard.rb
Normal file
50
app/dashboards/gestionnaire_dashboard.rb
Normal file
|
@ -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
|
|
@ -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
|
||||
|
|
50
app/dashboards/user_dashboard.rb
Normal file
50
app/dashboards/user_dashboard.rb
Normal file
|
@ -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
|
|
@ -12,7 +12,8 @@ as defined by the routes in the `admin/` namespace
|
|||
|
||||
<hr />
|
||||
|
||||
<% 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],
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in a new issue