Profile: move to new design

This commit is contained in:
simon lehericey 2018-08-23 18:53:35 +02:00
parent f115658d55
commit bd04972f65
8 changed files with 30 additions and 24 deletions

View file

@ -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

View 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

View file

@ -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 }

View file

@ -21,6 +21,6 @@
= t('dynamics.admin.menu.instructeurs')
%li.divider{ role: :separator }
%li
= link_to(admin_profile_path, id: :profile) do
= link_to(profil_path, id: :profile) do
%i.fa.fa-user
&nbsp;Profil

View 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 }

View file

@ -181,8 +181,6 @@ Rails.application.routes.draw do
get 'procedures/draft' => 'procedures#draft'
get 'procedures/path_list' => 'procedures#path_list'
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'
post 'change_dossier_state' => 'change_dossier_state#check'
@ -370,6 +368,9 @@ Rails.application.routes.draw do
patch 'add_to_procedure'
end
end
get 'profil' => 'profil#show'
post 'renew-api-token' => 'profil#renew_api_token'
end
apipie

View file

@ -11,6 +11,6 @@ describe Admin::ProfileController, type: :controller do
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

View file

@ -43,7 +43,7 @@ feature 'Administrator connection' do
page.find_by_id('profile').click
end
scenario 'it redirects to profile page' do
expect(page).to have_css('#profile_page')
expect(page).to have_css('#profil-page')
end
context 'when clicking on procedure' do
before do