[fix #675] upload notice in DS
This commit is contained in:
parent
d06b72fb80
commit
5667cfe747
7 changed files with 32 additions and 7 deletions
|
@ -250,7 +250,7 @@ class Admin::ProceduresController < AdminController
|
|||
private
|
||||
|
||||
def procedure_params
|
||||
editable_params = [:libelle, :description, :organisation, :direction, :lien_site_web, :lien_notice, :web_hook_url, :euro_flag, :logo, :auto_archive_on]
|
||||
editable_params = [:libelle, :description, :organisation, :direction, :lien_site_web, :notice, :web_hook_url, :euro_flag, :logo, :auto_archive_on]
|
||||
if @procedure.try(:locked?)
|
||||
params.require(:procedure).permit(*editable_params)
|
||||
else
|
||||
|
|
9
app/helpers/notice_url_helper.rb
Normal file
9
app/helpers/notice_url_helper.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
module NoticeUrlHelper
|
||||
def notice_url(procedure)
|
||||
if procedure.notice.attached?
|
||||
url_for(procedure.notice)
|
||||
elsif procedure.lien_notice.present?
|
||||
procedure.lien_notice
|
||||
end
|
||||
end
|
||||
end
|
|
@ -22,6 +22,8 @@ class Procedure < ApplicationRecord
|
|||
has_one :refused_mail, class_name: "Mails::RefusedMail", dependent: :destroy
|
||||
has_one :without_continuation_mail, class_name: "Mails::WithoutContinuationMail", dependent: :destroy
|
||||
|
||||
has_one_attached :notice
|
||||
|
||||
delegate :use_api_carto, to: :module_api_carto
|
||||
|
||||
accepts_nested_attributes_for :types_de_champ, :reject_if => proc { |attributes| attributes['libelle'].blank? }, :allow_destroy => true
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
.alert.alert-info
|
||||
Cette procédure est publiée, certains éléments de la description ne sont plus modifiables
|
||||
|
||||
- { libelle: 'Libellé*', description: 'Description*', organisation: 'Organisme*', direction: 'Direction', lien_site_web: 'Lien site internet', lien_notice: 'Lien notice', web_hook_url: 'Lien de rappel HTTP' }.each do |key, value|
|
||||
- { libelle: 'Libellé*', description: 'Description*', organisation: 'Organisme*', direction: 'Direction', lien_site_web: 'Lien site internet', web_hook_url: 'Lien de rappel HTTP' }.each do |key, value|
|
||||
- if key != :web_hook_url || current_administrateur&.feature_enabled?(:web_hook_allowed)
|
||||
.form-group
|
||||
%h4
|
||||
|
@ -16,6 +16,20 @@
|
|||
- else
|
||||
= f.text_field key, class: 'form-control', placeholder: value
|
||||
|
||||
.form-group
|
||||
%h4 Notice explicative de la procédure
|
||||
- notice = @procedure.notice
|
||||
- if !notice.attached?
|
||||
= f.file_field :notice,
|
||||
direct_upload: true
|
||||
- else
|
||||
%a{ href: url_for(notice), target: '_blank' }
|
||||
= notice.filename.to_s
|
||||
%br
|
||||
Modifier :
|
||||
= f.file_field :notice,
|
||||
direct_upload: true
|
||||
|
||||
.row
|
||||
.col-md-6
|
||||
%h4 Logo de la procédure
|
||||
|
|
|
@ -3,4 +3,4 @@
|
|||
= form_for @procedure, url: url_for({ controller: 'admin/procedures', action: :update, id: @procedure.id }), multipart: true do |f|
|
||||
= render partial: 'informations', locals: { f: f }
|
||||
.text-right
|
||||
= f.submit 'Enregistrer', class: 'btn btn-success'
|
||||
= f.button 'Enregistrer', class: 'btn btn-success'
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
%h1= @dossier.procedure.libelle
|
||||
|
||||
.container
|
||||
- if @dossier.procedure.lien_notice.present?
|
||||
- if notice_url(@dossier.procedure).present?
|
||||
%p
|
||||
Pour vous aider à remplir votre dossier, vous pouvez consulter
|
||||
= link_to 'le guide de cette démarche', @dossier.procedure.lien_notice, { target: '_blank' }
|
||||
= link_to 'le guide de cette démarche', notice_url(@dossier.procedure), { target: '_blank' }
|
||||
|
||||
%p.thanks Les champs avec une asterisque (*) sont obligatoires.
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
.container#description-page
|
||||
- if @dossier.procedure.lien_notice.present?
|
||||
- if notice_url(@dossier.procedure).present?
|
||||
#lien_notice_panel.row{ style: 'width: 280px; position: fixed; background-color: white; right: 5%; top: 80px; z-index: 200;' }
|
||||
.panel.panel-info{ style: 'margin-bottom: 0;' }
|
||||
.panel-body.center
|
||||
|
@ -8,7 +8,7 @@
|
|||
.fa.fa-info-circle.text-info{ style: 'font-size: 2em; margin-top: 20%;' }
|
||||
.col-xs-10{ style: 'padding-right: 0px;' }
|
||||
%b
|
||||
= link_to 'Accéder au guide', @dossier.procedure.lien_notice, { target: '_blank' }
|
||||
= link_to 'Accéder au guide', notice_url(@dossier.procedure), { target: '_blank' }
|
||||
pour remplir pour votre dossier
|
||||
|
||||
%h2.text-info
|
||||
|
|
Loading…
Reference in a new issue