Profile: move to new design
This commit is contained in:
parent
f115658d55
commit
bd04972f65
8 changed files with 30 additions and 24 deletions
|
@ -1,11 +0,0 @@
|
||||||
class Admin::ProfileController < AdminController
|
|
||||||
def show
|
|
||||||
@administrateur = current_administrateur
|
|
||||||
end
|
|
||||||
|
|
||||||
def renew_api_token
|
|
||||||
flash[:notice] = "Votre token d'API a été regénéré."
|
|
||||||
current_administrateur.renew_api_token
|
|
||||||
redirect_to admin_profile_path
|
|
||||||
end
|
|
||||||
end
|
|
13
app/controllers/new_administrateur/profil_controller.rb
Normal file
13
app/controllers/new_administrateur/profil_controller.rb
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
module NewAdministrateur
|
||||||
|
class ProfilController < AdministrateurController
|
||||||
|
def show
|
||||||
|
@administrateur = current_administrateur
|
||||||
|
end
|
||||||
|
|
||||||
|
def renew_api_token
|
||||||
|
flash[:notice] = "Votre token d'API a été regénéré."
|
||||||
|
current_administrateur.renew_api_token
|
||||||
|
redirect_to profil_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,8 +0,0 @@
|
||||||
#profile_page
|
|
||||||
%h2 Profil
|
|
||||||
%hr
|
|
||||||
%p
|
|
||||||
API TOKEN :
|
|
||||||
= @administrateur.api_token
|
|
||||||
%p
|
|
||||||
= link_to "Regénérer mon token", admin_renew_api_token_path, method: :post, class: "btn btn-default", data: { confirm: "Confirmez-vous la regénération de votre token ? Les applications qui l'utilisent actuellement seront bloquées.", disable: true }
|
|
|
@ -21,6 +21,6 @@
|
||||||
= t('dynamics.admin.menu.instructeurs')
|
= t('dynamics.admin.menu.instructeurs')
|
||||||
%li.divider{ role: :separator }
|
%li.divider{ role: :separator }
|
||||||
%li
|
%li
|
||||||
= link_to(admin_profile_path, id: :profile) do
|
= link_to(profil_path, id: :profile) do
|
||||||
%i.fa.fa-user
|
%i.fa.fa-user
|
||||||
Profil
|
Profil
|
||||||
|
|
11
app/views/new_administrateur/profil/show.html.haml
Normal file
11
app/views/new_administrateur/profil/show.html.haml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#profil-page.container
|
||||||
|
%h1 Profil
|
||||||
|
|
||||||
|
%p API TOKEN : #{@administrateur.api_token}
|
||||||
|
|
||||||
|
= link_to "Regénérer mon token",
|
||||||
|
renew_api_token_path,
|
||||||
|
method: :post,
|
||||||
|
class: "button primary",
|
||||||
|
data: { confirm: "Confirmez-vous la regénération de votre token ? Les applications qui l'utilisent actuellement seront bloquées.",
|
||||||
|
disable: true }
|
|
@ -181,8 +181,6 @@ Rails.application.routes.draw do
|
||||||
get 'procedures/draft' => 'procedures#draft'
|
get 'procedures/draft' => 'procedures#draft'
|
||||||
get 'procedures/path_list' => 'procedures#path_list'
|
get 'procedures/path_list' => 'procedures#path_list'
|
||||||
get 'procedures/available' => 'procedures#check_availability'
|
get 'procedures/available' => 'procedures#check_availability'
|
||||||
get 'profile' => 'profile#show', as: :profile
|
|
||||||
post 'renew_api_token' => 'profile#renew_api_token', as: :renew_api_token
|
|
||||||
|
|
||||||
get 'change_dossier_state' => 'change_dossier_state#index'
|
get 'change_dossier_state' => 'change_dossier_state#index'
|
||||||
post 'change_dossier_state' => 'change_dossier_state#check'
|
post 'change_dossier_state' => 'change_dossier_state#check'
|
||||||
|
@ -370,6 +368,9 @@ Rails.application.routes.draw do
|
||||||
patch 'add_to_procedure'
|
patch 'add_to_procedure'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
get 'profil' => 'profil#show'
|
||||||
|
post 'renew-api-token' => 'profil#renew_api_token'
|
||||||
end
|
end
|
||||||
|
|
||||||
apipie
|
apipie
|
||||||
|
|
|
@ -11,6 +11,6 @@ describe Admin::ProfileController, type: :controller do
|
||||||
|
|
||||||
it { expect{ subject }.to change { administrateur.reload.api_token } }
|
it { expect{ subject }.to change { administrateur.reload.api_token } }
|
||||||
|
|
||||||
it { subject; expect(response.status).to redirect_to(admin_profile_path) }
|
it { subject; expect(response.status).to redirect_to(profil_path) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -43,7 +43,7 @@ feature 'Administrator connection' do
|
||||||
page.find_by_id('profile').click
|
page.find_by_id('profile').click
|
||||||
end
|
end
|
||||||
scenario 'it redirects to profile page' do
|
scenario 'it redirects to profile page' do
|
||||||
expect(page).to have_css('#profile_page')
|
expect(page).to have_css('#profil-page')
|
||||||
end
|
end
|
||||||
context 'when clicking on procedure' do
|
context 'when clicking on procedure' do
|
||||||
before do
|
before do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue