From eee41cbf39ad418cf173db5596aeb1f00b8d0e81 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Thu, 14 Jun 2018 16:41:10 +0200 Subject: [PATCH] Manager: can reinvite a gestionnaire --- .../manager/gestionnaires_controller.rb | 6 +++ app/views/manager/gestionnaires/show.html.erb | 54 +++++++++++++++++++ config/routes.rb | 5 +- 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 app/views/manager/gestionnaires/show.html.erb diff --git a/app/controllers/manager/gestionnaires_controller.rb b/app/controllers/manager/gestionnaires_controller.rb index 859bf2749..408e788de 100644 --- a/app/controllers/manager/gestionnaires_controller.rb +++ b/app/controllers/manager/gestionnaires_controller.rb @@ -1,4 +1,10 @@ module Manager class GestionnairesController < Manager::ApplicationController + def reinvite + gestionnaire = Gestionnaire.find(params[:id]) + gestionnaire.invite! + flash[:notice] = "Gestionnaire réinvité." + redirect_to manager_gestionnaire_path(gestionnaire) + end end end diff --git a/app/views/manager/gestionnaires/show.html.erb b/app/views/manager/gestionnaires/show.html.erb new file mode 100644 index 000000000..9a2c8324f --- /dev/null +++ b/app/views/manager/gestionnaires/show.html.erb @@ -0,0 +1,54 @@ +<%# +# Show + +This view is the template for the show page. +It renders the attributes of a resource, +as well as a link to its edit page. + +## Local variables: + +- `page`: + An instance of [Administrate::Page::Show][1]. + Contains methods for accessing the resource to be displayed on the page, + as well as helpers for describing how each attribute of the resource + should be displayed. + +[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Show +%> + +<% content_for(:title) { t("administrate.actions.show_resource", name: page.page_title) } %> +<% gestionnaire = page.resource %> + + + +
+
+ <% page.attributes.each do |attribute| %> +
+ <%= t( + "helpers.label.#{resource_name}.#{attribute.name}", + default: attribute.name.titleize, + ) %> +
+ +
<%= render_field attribute %>
+ <% end %> +
+
diff --git a/config/routes.rb b/config/routes.rb index a6816f131..27fe8ede9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -12,7 +12,10 @@ Rails.application.routes.draw do end resources :users, only: [:index, :show] - resources :gestionnaires, only: [:index, :show] + resources :gestionnaires, only: [:index, :show] do + post 'reinvite', on: :member + end + resources :dossiers, only: [:show] resources :demandes, only: [:index]