Merge pull request #1771 from tchak/procedure-link

Show procedure link in manager view
This commit is contained in:
Paul Chavard 2018-04-03 15:40:47 +02:00 committed by GitHub
commit 0bf389b849
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 0 deletions

View file

@ -10,6 +10,7 @@ class ProcedureDashboard < Administrate::BaseDashboard
ATTRIBUTE_TYPES = { ATTRIBUTE_TYPES = {
types_de_piece_justificative: TypesDePieceJustificativeCollectionField, types_de_piece_justificative: TypesDePieceJustificativeCollectionField,
types_de_champ: TypesDeChampCollectionField, types_de_champ: TypesDeChampCollectionField,
path: ProcedureLinkField,
dossiers: Field::HasMany, dossiers: Field::HasMany,
procedure_path: Field::HasOne, procedure_path: Field::HasOne,
administrateur: Field::BelongsTo, administrateur: Field::BelongsTo,
@ -47,6 +48,7 @@ class ProcedureDashboard < Administrate::BaseDashboard
# an array of attributes that will be displayed on the model's show page. # an array of attributes that will be displayed on the model's show page.
SHOW_PAGE_ATTRIBUTES = [ SHOW_PAGE_ATTRIBUTES = [
:id, :id,
:path,
:administrateur, :administrateur,
:libelle, :libelle,
:description, :description,

View file

@ -0,0 +1,7 @@
require "administrate/field/base"
class ProcedureLinkField < Administrate::Field::Base
def name
"Lien procédure"
end
end

View file

@ -0,0 +1,4 @@
- if field.data.present?
= link_to "/commencer/#{field.data}", commencer_url(procedure_path: field.data), target: '_blank'
- else
Plus en ligne