- add decorator for procedure and procedures
- add link to procedure on admin procedures list
This commit is contained in:
parent
515713b3fa
commit
49217a1b39
10 changed files with 38 additions and 41 deletions
|
@ -2,16 +2,18 @@ class Admin::ProceduresController < AdminController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@procedures = current_administrateur.procedures.where(archived: false)
|
@procedures = current_administrateur.procedures.where(archived: false)
|
||||||
.paginate(:page => params[:page])
|
.paginate(:page => params[:page]).decorate
|
||||||
|
@page = 'active'
|
||||||
end
|
end
|
||||||
|
|
||||||
def archived
|
def archived
|
||||||
@procedures_archived = current_administrateur.procedures.where(archived: true)
|
@procedures = current_administrateur.procedures.where(archived: true)
|
||||||
.paginate(:page => params[:page])
|
.paginate(:page => params[:page]).decorate
|
||||||
|
@page = 'archived'
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@procedure = current_administrateur.procedures.find(params[:id])
|
@procedure = current_administrateur.procedures.find(params[:id]).decorate
|
||||||
@types_de_champ = @procedure.types_de_champ.order(:order_place)
|
@types_de_champ = @procedure.types_de_champ.order(:order_place)
|
||||||
@types_de_piece_justificative = @procedure.types_de_piece_justificative.order(:libelle)
|
@types_de_piece_justificative = @procedure.types_de_piece_justificative.order(:libelle)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class DemoController < ApplicationController
|
class DemoController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@procedures = Procedure.where(archived: false).order('libelle ASC')
|
@procedures = Procedure.where(archived: false).order('libelle ASC').decorate
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
7
app/decorators/procedure_decorator.rb
Normal file
7
app/decorators/procedure_decorator.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
class ProcedureDecorator < Draper::Decorator
|
||||||
|
delegate_all
|
||||||
|
|
||||||
|
def lien
|
||||||
|
h.new_users_dossiers_url(procedure_id: id)
|
||||||
|
end
|
||||||
|
end
|
4
app/decorators/procedures_decorator.rb
Normal file
4
app/decorators/procedures_decorator.rb
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
class ProceduresDecorator < Draper::CollectionDecorator
|
||||||
|
delegate :current_page, :per_page, :offset, :total_entries, :total_pages
|
||||||
|
|
||||||
|
end
|
14
app/views/admin/procedures/_list.html.haml
Normal file
14
app/views/admin/procedures/_list.html.haml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
%table.table
|
||||||
|
%thead
|
||||||
|
%th#id ID
|
||||||
|
%th#libelle Libellé
|
||||||
|
%th#lien Lien
|
||||||
|
- @procedures.each do |procedure|
|
||||||
|
%tr
|
||||||
|
%td.col-md-1.col-lg-1= procedure.id
|
||||||
|
%td.col-md-6.col-lg-6
|
||||||
|
= link_to(procedure.libelle, "/admin/procedures/#{procedure.id}")
|
||||||
|
%td= link_to procedure.lien, procedure.lien
|
||||||
|
|
||||||
|
.pagination
|
||||||
|
= will_paginate @procedures, renderer: BootstrapPagination::Rails
|
|
@ -1,11 +1,11 @@
|
||||||
#onglets
|
#onglets
|
||||||
%ul.nav.nav-tabs
|
%ul.nav.nav-tabs
|
||||||
%li{class: "#{'active' unless @procedures.nil? }"}
|
%li{class: "#{'active' if @page == 'active' }"}
|
||||||
%a{:href => "#{url_for :admin_procedures}"}
|
%a{:href => "#{url_for :admin_procedures}"}
|
||||||
%h5.text-success
|
%h5.text-success
|
||||||
= "Actives"
|
= "Actives"
|
||||||
|
|
||||||
%li{class: "#{'active' unless @procedures_archived.nil? }"}
|
%li{class: "#{'active' if @page == 'archived' }"}
|
||||||
%a{:href => "#{url_for :admin_procedures_archived}"}
|
%a{:href => "#{url_for :admin_procedures_archived}"}
|
||||||
%h5{style: 'color: black'}
|
%h5{style: 'color: black'}
|
||||||
="Archivées"
|
="Archivées"
|
||||||
|
|
|
@ -4,19 +4,4 @@
|
||||||
|
|
||||||
= render partial: 'onglets'
|
= render partial: 'onglets'
|
||||||
|
|
||||||
%table.table
|
= render partial: 'list'
|
||||||
%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
|
|
|
@ -4,19 +4,4 @@
|
||||||
|
|
||||||
= render partial: 'onglets'
|
= render partial: 'onglets'
|
||||||
|
|
||||||
%table.table
|
= render partial: 'list'
|
||||||
%thead
|
|
||||||
%th#id ID
|
|
||||||
%th#libelle Libellé
|
|
||||||
%th#organisation Organisation
|
|
||||||
%th#direction Direction
|
|
||||||
- @procedures.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, renderer: BootstrapPagination::Rails
|
|
|
@ -13,7 +13,7 @@
|
||||||
%td
|
%td
|
||||||
= procedure.id
|
= procedure.id
|
||||||
%td.col-md-4.col-lg-4
|
%td.col-md-4.col-lg-4
|
||||||
= link_to procedure.libelle, "/users/dossiers/new?procedure_id=#{procedure.id}"
|
= link_to procedure.libelle, procedure.lien
|
||||||
%td
|
%td
|
||||||
= procedure.description
|
= procedure.description
|
||||||
%td.col-md-3.col-lg-3
|
%td.col-md-3.col-lg-3
|
||||||
|
|
Loading…
Add table
Reference in a new issue