Add tabs for administrateur procedures list
This commit is contained in:
parent
fe8504fd5e
commit
7c3f322d6e
6 changed files with 50 additions and 2 deletions
|
@ -5,6 +5,11 @@ class Admin::ProceduresController < AdminController
|
|||
@procedures = @procedures.paginate(:page => params[:page], :per_page => 12)
|
||||
end
|
||||
|
||||
def archived
|
||||
@procedures_archived = current_administrateur.procedures.where(archived: true)
|
||||
@procedures_archived = @procedures_archived.paginate(:page => params[:page], :per_page => 12)
|
||||
end
|
||||
|
||||
def show
|
||||
@procedure = current_administrateur.procedures.find(params[:id])
|
||||
@types_de_champ = @procedure.types_de_champ.order(:order_place)
|
||||
|
|
12
app/views/admin/procedures/_onglets.html.haml
Normal file
12
app/views/admin/procedures/_onglets.html.haml
Normal file
|
@ -0,0 +1,12 @@
|
|||
#onglets
|
||||
%ul.nav.nav-tabs
|
||||
%li{class: "#{'active' unless @procedures.nil? }"}
|
||||
%a{:href => "#{url_for :admin_procedures}"}
|
||||
%h5.text-success
|
||||
= "Actives"
|
||||
|
||||
%li{class: "#{'active' unless @procedures_archived.nil? }"}
|
||||
%a{:href => "#{url_for :admin_procedures_archived}"}
|
||||
%h5{style: 'color: black'}
|
||||
="Archivées"
|
||||
%br
|
22
app/views/admin/procedures/archived.html.haml
Normal file
22
app/views/admin/procedures/archived.html.haml
Normal file
|
@ -0,0 +1,22 @@
|
|||
= link_to("Nouvelle procédure", "/admin/procedures/new", class: 'btn btn-success', style: 'float:right; margin-top:2%;')
|
||||
%h1 Gestion des procédures
|
||||
%br
|
||||
|
||||
= render partial: 'onglets'
|
||||
|
||||
%table.table
|
||||
%thead
|
||||
%th#id ID
|
||||
%th#libelle Libellé
|
||||
%th#organisation Organisation
|
||||
%th#direction Direction
|
||||
- @procedures_archived.each do |procedure|
|
||||
%tr
|
||||
%td= procedure.id
|
||||
%td
|
||||
= link_to(procedure.libelle, "/admin/procedures/#{procedure.id}")
|
||||
%td= procedure.organisation
|
||||
%td= procedure.direction
|
||||
|
||||
.pagination
|
||||
= will_paginate @procedures_archived, renderer: BootstrapPagination::Rails
|
|
@ -1,7 +1,9 @@
|
|||
= link_to("Nouvelle procédure", "/admin/procedures/new", class: 'btn btn-success', style: 'float:right; margin-top:2%;')
|
||||
%h1 Gestion des procédures
|
||||
%br
|
||||
%br
|
||||
|
||||
= render partial: 'onglets'
|
||||
|
||||
%table.table
|
||||
%thead
|
||||
%th#id ID
|
||||
|
|
|
@ -48,6 +48,7 @@ Rails.application.routes.draw do
|
|||
|
||||
namespace :admin do
|
||||
get 'sign_in' => '/administrateurs/sessions#new'
|
||||
get 'procedures/archived' => 'procedures#archived'
|
||||
|
||||
resources :procedures do
|
||||
resource :types_de_champ, only: [:show, :update] do
|
||||
|
|
|
@ -29,7 +29,13 @@ describe Admin::ProceduresController, type: :controller do
|
|||
end
|
||||
|
||||
describe 'GET #index' do
|
||||
subject { get :show }
|
||||
subject { get :index }
|
||||
|
||||
it { expect(response.status).to eq(200) }
|
||||
end
|
||||
|
||||
describe 'GET #archived' do
|
||||
subject { get :archived }
|
||||
|
||||
it { expect(response.status).to eq(200) }
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue