change banner for admin

This commit is contained in:
Tanguy PATTE 2015-12-14 17:27:14 +01:00
parent 9040d9407d
commit cf99b30349
5 changed files with 87 additions and 5 deletions

View file

@ -179,4 +179,9 @@ div.pagination {
#confirm { #confirm {
display: none; display: none;
}
.fa {
width: 15px;
text-align: center;
} }

View file

@ -0,0 +1,21 @@
%div{ style: "decorate:none; display: flex;box-shadow:none; float:right; display: flex" }
%div{ style: "vertical-align: middle; margin-right: 10px; margin-top: auto; margin-bottom: auto;" }
mps-test@apientreprise.fr
.dropdown#admin_menu
%button.btn.btn-default.dropdown-toggle#dropdownMenuAdmin{ type: :button, 'data-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false}
%i.fa.fa-cog
%span.caret
%ul.dropdown-menu.dropdown-menu-right
%li
= link_to(admin_procedures_path, id: :menu_item_procedure) do
%i.fa.fa-list{ style: "background-size: 10px;"}
 Procédures
%li
= link_to(admin_profile_path, id: :profile) do
%i.fa.fa-user
 Profile
%li.divider{ role: :separator}
%li
= link_to('/administrateurs/sign_out',id: :admin_sign_out, method: :delete) do
%i.fa.fa-power-off
 Se déconnecter

View file

@ -1,7 +1,7 @@
#form_login #form_login
= image_tag('logo-tps.png') = image_tag('logo-tps.png')
%br %br
%h2#login_user Administration %h2#login_admin Administration
%br %br
%br %br

View file

@ -22,10 +22,7 @@
= current_gestionnaire.email = current_gestionnaire.email
= link_to "Déconnexion", '/gestionnaires/sign_out', method: :delete, :class => 'btn btn-md' = link_to "Déconnexion", '/gestionnaires/sign_out', method: :delete, :class => 'btn btn-md'
-elsif administrateur_signed_in? -elsif administrateur_signed_in?
%div = render partial: 'administrateurs/login_banner'
= current_administrateur.email
= link_to "Déconnexion", '/administrateurs/sign_out', method: :delete, :class => 'btn btn-md'
- elsif user_signed_in? - elsif user_signed_in?
%div.user %div.user
-if current_user.loged_in_with_france_connect -if current_user.loged_in_with_france_connect

View file

@ -0,0 +1,59 @@
require 'spec_helper'
feature 'Administrator connection' do
let(:admin) { create(:administrateur) }
before do
visit new_administrateur_session_path
end
scenario 'administrator is on admin loggin page' do
expect(page).to have_css('#login_admin')
end
context "admin fills form and log in" do
before do
page.find_by_id('administrateur_email').set admin.email
page.find_by_id('administrateur_password').set admin.password
page.click_on 'Se connecter'
end
scenario 'a menu button is available' do
expect(page).to have_css('#admin_menu')
end
context 'when he click on the menu' do
before do
page.find_by_id('admin_menu').click
end
scenario 'it displays the menu' do
expect(page).to have_css('a#profile')
expect(page).to have_css('a#admin_sign_out')
end
context 'when clicking on sign_out' do
before do
page.find_by_id('admin_sign_out').click
end
scenario 'admin is redireted to home page' do
expect(page).to have_css('#login_user')
end
end
context 'when clicking on profile' do
before do
page.find_by_id('profile').click
end
scenario 'it redirects to profile page' do
expect(page).to have_css('#profile_page')
end
context 'when clicking on procedure' do
before do
page.find_by_id('admin_menu').click
page.find_by_id('menu_item_procedure').click
end
scenario 'it redirects to procedure page' do
expect(page).to have_content('Gestion des procédures')
end
end
end
end
end
end