Remove old controller and templates
This commit is contained in:
parent
a5aeaf988a
commit
d5c036362b
10 changed files with 4 additions and 97 deletions
|
@ -1,15 +0,0 @@
|
||||||
class AdministrationsController < ApplicationController
|
|
||||||
include SmartListing::Helper::ControllerExtensions
|
|
||||||
helper SmartListing::Helper
|
|
||||||
|
|
||||||
before_action :authenticate_administration!
|
|
||||||
|
|
||||||
def index
|
|
||||||
@admin = Administrateur.new
|
|
||||||
|
|
||||||
@admins = smart_listing_create :admins,
|
|
||||||
Administrateur.all.order(:email),
|
|
||||||
partial: "administrations/list",
|
|
||||||
array: true
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -9,7 +9,7 @@ class RootController < ApplicationController
|
||||||
elsif user_signed_in?
|
elsif user_signed_in?
|
||||||
return redirect_to users_dossiers_path
|
return redirect_to users_dossiers_path
|
||||||
elsif administration_signed_in?
|
elsif administration_signed_in?
|
||||||
return redirect_to administrations_path
|
return redirect_to manager_root_path
|
||||||
end
|
end
|
||||||
|
|
||||||
render 'landing'
|
render 'landing'
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
.card
|
|
||||||
- if smart_listing.present?
|
|
||||||
%table.table
|
|
||||||
%thead
|
|
||||||
%th.col-xs-4= smart_listing.sortable 'Email', :email
|
|
||||||
%th.col-xs-4= smart_listing.sortable 'Date de dernière connexion', :last_sign_in_at
|
|
||||||
%th.col-xs-2 État
|
|
||||||
%th.col-xs-2 Procédure active
|
|
||||||
%th.col-xs-2 Dossier en cours
|
|
||||||
|
|
||||||
- @admins.each do |admin|
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
= admin.email
|
|
||||||
%td
|
|
||||||
- if admin.last_sign_in_at.present?
|
|
||||||
= time_ago_in_words(l(admin.last_sign_in_at, format: "%d/%m/%Y %H:%M UTC +02:00"))
|
|
||||||
(
|
|
||||||
= admin.last_sign_in_at.localtime.strftime('%d/%m/%Y')
|
|
||||||
)
|
|
||||||
%td
|
|
||||||
- if admin.invitation_expired?
|
|
||||||
= link_to admin.registration_state, administration_path(admin), remote: true, method: :patch
|
|
||||||
- else
|
|
||||||
= admin.registration_state
|
|
||||||
%td
|
|
||||||
= admin.procedures.publiees.count
|
|
||||||
%td
|
|
||||||
- total_dossier = 0
|
|
||||||
- admin.procedures.each do |procedure| total_dossier += procedure.dossiers.state_not_brouillon.count end
|
|
||||||
= total_dossier
|
|
||||||
= smart_listing.paginate
|
|
||||||
= smart_listing.pagination_per_page_links
|
|
||||||
|
|
||||||
- else
|
|
||||||
%h4.center
|
|
||||||
Aucun administrateur créé
|
|
|
@ -1,15 +0,0 @@
|
||||||
.container
|
|
||||||
.mt-1
|
|
||||||
= form_for @admin, url: { controller: 'administrations', action: :create } do |f|
|
|
||||||
.form-group.form-inline.text-center
|
|
||||||
= f.text_field :email, placeholder: :email, class: 'form-control'
|
|
||||||
|
|
||||||
= f.submit 'Créer un administrateur', class: 'btn btn-success', id: 'submit_new_administrateur'
|
|
||||||
|
|
||||||
= smart_listing_render :admins
|
|
||||||
|
|
||||||
%br
|
|
||||||
%br
|
|
||||||
|
|
||||||
.text-center
|
|
||||||
= link_to 'Deconnexion', administrations_sign_out_path, method: :delete
|
|
|
@ -1 +0,0 @@
|
||||||
<%= smart_listing_update :admins %>
|
|
|
@ -45,7 +45,7 @@
|
||||||
= current_email
|
= current_email
|
||||||
- if administration_signed_in?
|
- if administration_signed_in?
|
||||||
%li
|
%li
|
||||||
= link_to administrations_path, class: "menu-item menu-link" do
|
= link_to manager_root_path, class: "menu-item menu-link" do
|
||||||
= image_tag "icons/super-admin.svg"
|
= image_tag "icons/super-admin.svg"
|
||||||
Passer en super-admin
|
Passer en super-admin
|
||||||
- if SwitchDeviseProfileService.new(warden).multiple_devise_profile_connect?
|
- if SwitchDeviseProfileService.new(warden).multiple_devise_profile_connect?
|
||||||
|
|
|
@ -58,10 +58,6 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
get 'administrations/sign_in' => 'administrations/sessions#new'
|
get 'administrations/sign_in' => 'administrations/sessions#new'
|
||||||
delete 'administrations/sign_out' => 'administrations/sessions#destroy'
|
delete 'administrations/sign_out' => 'administrations/sessions#destroy'
|
||||||
authenticate :administration do
|
|
||||||
resources :administrations, only: [:index, :create, :update] do
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
resources :stats, only: [:index]
|
resources :stats, only: [:index]
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ describe Administrations::OmniauthCallbacksController, type: :controller do
|
||||||
let(:administration) { create(:administration, email: email) }
|
let(:administration) { create(:administration, email: email) }
|
||||||
before { administration }
|
before { administration }
|
||||||
|
|
||||||
it { is_expected.to redirect_to(administrations_path) }
|
it { is_expected.to redirect_to(manager_administrateurs_path) }
|
||||||
it do
|
it do
|
||||||
expect(controller).to receive(:sign_in).with(administration)
|
expect(controller).to receive(:sign_in).with(administration)
|
||||||
subject
|
subject
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe AdministrationsController, type: :controller do
|
|
||||||
let(:administration) { create :administration }
|
|
||||||
|
|
||||||
describe 'GET #index' do
|
|
||||||
subject { get :index }
|
|
||||||
|
|
||||||
context 'when administration user is not connect' do
|
|
||||||
it { expect(subject.status).to eq 302 }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when administration user is connect' do
|
|
||||||
before do
|
|
||||||
sign_in administration
|
|
||||||
end
|
|
||||||
|
|
||||||
it { expect(subject.status).to eq 200 }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -37,7 +37,7 @@ describe RootController, type: :controller do
|
||||||
sign_in create(:administration)
|
sign_in create(:administration)
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(subject).to redirect_to(administrations_path) }
|
it { expect(subject).to redirect_to(manager_root_path) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when nobody is connected' do
|
context 'when nobody is connected' do
|
||||||
|
|
Loading…
Add table
Reference in a new issue