Merge branch 'dev'
This commit is contained in:
commit
7bbd5d7c79
13 changed files with 26 additions and 292 deletions
|
@ -36,7 +36,6 @@ class Admin::ProceduresController < AdminController
|
|||
end
|
||||
|
||||
def show
|
||||
@facade = AdminProceduresShowFacades.new @procedure.decorate
|
||||
end
|
||||
|
||||
def edit
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
class AdminProceduresShowFacades
|
||||
def initialize(procedure)
|
||||
@procedure = procedure
|
||||
end
|
||||
|
||||
def procedure
|
||||
@procedure
|
||||
end
|
||||
|
||||
def dossiers
|
||||
@procedure.dossiers.state_not_brouillon
|
||||
end
|
||||
|
||||
def dossiers_for_pie_highchart
|
||||
dossiers.state_not_brouillon.not_archived.group(:state).count
|
||||
.reduce({}) do |acc, (key, val)|
|
||||
translated_key = DossierDecorator.case_state_fr(key)
|
||||
acc[translated_key].nil? ? acc[translated_key] = val : acc[translated_key] += val
|
||||
acc
|
||||
end
|
||||
end
|
||||
|
||||
def dossiers_archived_by_state_total
|
||||
dossiers.select('state, count(*) as total').archived.where.not(state: :termine).group(:state).order(:state).decorate
|
||||
end
|
||||
|
||||
def dossiers_archived_total
|
||||
dossiers.archived.where.not(state: :termine).size
|
||||
end
|
||||
|
||||
def dossiers_total
|
||||
dossiers.size
|
||||
end
|
||||
|
||||
def dossiers_termine_total
|
||||
dossiers.where(state: :termine).size
|
||||
end
|
||||
end
|
|
@ -1,17 +1,15 @@
|
|||
- procedure = @facade.procedure
|
||||
|
||||
= render partial: 'admin/closed_mail_template_attestation_inconsistency_alert'
|
||||
.row.white-back
|
||||
#procedure_show
|
||||
= render partial: '/admin/procedures/modal_publish'
|
||||
= render partial: '/admin/procedures/modal_transfer'
|
||||
|
||||
- if procedure.brouillon?
|
||||
- if procedure.gestionnaires.empty? || procedure.service.nil?
|
||||
- if @procedure.brouillon?
|
||||
- if @procedure.gestionnaires.empty? || @procedure.service.nil?
|
||||
- missing_elements = []
|
||||
- if procedure.gestionnaires.empty?
|
||||
- if @procedure.gestionnaires.empty?
|
||||
- missing_elements << 'des accompagnateurs'
|
||||
- if procedure.service.nil?
|
||||
- if @procedure.service.nil?
|
||||
- missing_elements << 'un service'
|
||||
- message = "Affectez #{missing_elements.join(' et ')} à votre procédure."
|
||||
%a.action_button.btn.btn-success#disabled-publish-procedure{ data: { toggle: :tooltip, placement: :bottom }, style: 'float: right; margin-top: 10px;', disabled: true, title: message }
|
||||
|
@ -26,13 +24,13 @@
|
|||
%i.fa.fa-exchange
|
||||
Envoyer une copie
|
||||
|
||||
- if procedure.archivee?
|
||||
- if @procedure.archivee?
|
||||
%a.btn.btn-default#reopen-procedure{ data: { target: '#publish-modal', toggle: :modal }, type: 'button', style: 'float: right; margin-top: 10px; margin-right: 10px;' }
|
||||
%i.fa.fa-rocket
|
||||
Réactiver
|
||||
|
||||
- elsif procedure.publiee?
|
||||
= form_tag admin_procedure_archive_path(procedure_id: procedure.id), method: :put, style: 'float: right; margin-top: 10px;' do
|
||||
- elsif @procedure.publiee?
|
||||
= form_tag admin_procedure_archive_path(procedure_id: @procedure.id), method: :put, style: 'float: right; margin-top: 10px;' do
|
||||
%button#archive-procedure.btn.btn-small.btn-default.text-info{ type: :button }
|
||||
%i.fa.fa-eraser
|
||||
Archiver
|
||||
|
@ -44,7 +42,7 @@
|
|||
%i.fa.fa-remove
|
||||
Annuler
|
||||
|
||||
- if procedure.locked?
|
||||
- if @procedure.locked?
|
||||
#procedure_locked
|
||||
.alert.alert-info
|
||||
Cette procédure a été publiée, certains éléments ne peuvent plus être modifiés.
|
||||
|
@ -52,11 +50,11 @@
|
|||
%div
|
||||
%h3 Lien procédure
|
||||
%div{ style: 'margin-left: 3%;' }
|
||||
- if procedure.archivee?
|
||||
- if @procedure.archivee?
|
||||
%b
|
||||
Cette procédure est archivée et n’est donc pas accessible par le public.
|
||||
- elsif procedure.brouillon_avec_lien? || procedure.publiee?
|
||||
= link_to procedure_lien(procedure), sanitize_url(procedure_lien(procedure)), target: :blank
|
||||
- elsif @procedure.brouillon_avec_lien? || @procedure.publiee?
|
||||
= link_to procedure_lien(@procedure), sanitize_url(procedure_lien(@procedure)), target: :blank
|
||||
- else
|
||||
%b
|
||||
Cette procédure n’a pas encore de lien, et n’est donc pas accessible par le public.
|
||||
|
@ -67,38 +65,38 @@
|
|||
.row{ style: 'margin-right: 3%; margin-left: 3%;' }
|
||||
.description.col-xs-6.col-md-3.procedure-description
|
||||
%h4.text-info
|
||||
= procedure.libelle
|
||||
= @procedure.libelle
|
||||
|
||||
= h string_to_html(procedure.description)
|
||||
= h string_to_html(@procedure.description)
|
||||
|
||||
.champs.col-xs-6.col-md-3
|
||||
%h4.text-info
|
||||
Champs
|
||||
.badge.progress-bar-info
|
||||
= procedure.types_de_champ.size
|
||||
= @procedure.types_de_champ.size
|
||||
%ul
|
||||
- procedure.types_de_champ.order(:order_place).each do |champ|
|
||||
- @procedure.types_de_champ.order(:order_place).each do |champ|
|
||||
%li= champ.libelle
|
||||
|
||||
.champs_private.col-xs-6.col-md-3
|
||||
%h4.text-info
|
||||
Annotations privées
|
||||
.badge.progress-bar-info
|
||||
= procedure.types_de_champ_private.size
|
||||
= @procedure.types_de_champ_private.size
|
||||
%ul
|
||||
- procedure.types_de_champ_private.order(:order_place).each do |champ|
|
||||
- @procedure.types_de_champ_private.order(:order_place).each do |champ|
|
||||
%li= champ.libelle
|
||||
|
||||
.pieces-justificatives.col-xs-6.col-md-3
|
||||
%h4.text-info
|
||||
Pièces jointes
|
||||
.badge.progress-bar-info
|
||||
= procedure.types_de_piece_justificative.size
|
||||
- procedure.types_de_piece_justificative.each do |piece_justificative|
|
||||
= @procedure.types_de_piece_justificative.size
|
||||
- @procedure.types_de_piece_justificative.each do |piece_justificative|
|
||||
= piece_justificative.libelle
|
||||
%br
|
||||
|
||||
- durees_de_conservation = politiques_conservation_de_donnees(procedure)
|
||||
- durees_de_conservation = politiques_conservation_de_donnees(@procedure)
|
||||
- if durees_de_conservation.present?
|
||||
.row{ style: 'margin-right: 3%; margin-left: 3%;' }
|
||||
.col-xs-6.col-md-3
|
||||
|
@ -106,53 +104,19 @@
|
|||
- durees_de_conservation.each do |text|
|
||||
%p= text
|
||||
|
||||
%br
|
||||
%h3
|
||||
= t('dynamics.admin.procedure.stats.title')
|
||||
|
||||
.row
|
||||
.col-xs-6{ style: 'margin-left: 3%;' }
|
||||
%h4 Total
|
||||
%div
|
||||
= @facade.dossiers_total
|
||||
|
||||
%h4.text-success Terminé
|
||||
%div
|
||||
= @facade.dossiers_termine_total
|
||||
|
||||
%h4 Archivé
|
||||
|
||||
- if @facade.dossiers_archived_total != 0
|
||||
%ul
|
||||
- @facade.dossiers_archived_by_state_total.each do |dossier|
|
||||
%li
|
||||
= dossier.display_state
|
||||
\:
|
||||
= dossier.total
|
||||
- else
|
||||
%p
|
||||
0
|
||||
|
||||
.col-xs-5
|
||||
%h4 Non archivés
|
||||
- if @facade.dossiers_for_pie_highchart.blank?
|
||||
Aucune statistique pour le moment
|
||||
- else
|
||||
= pie_chart @facade.dossiers_for_pie_highchart
|
||||
|
||||
- if procedure.publiee_ou_archivee?
|
||||
- if @procedure.publiee_ou_archivee?
|
||||
%h3 Supprimer la procédure
|
||||
.alert.alert-danger
|
||||
%p
|
||||
Attention : la suppression d’une procédure est définitive.
|
||||
- dossiers_count = procedure.dossiers.count
|
||||
- dossiers_count = @procedure.dossiers.count
|
||||
- if dossiers_count > 0
|
||||
%p
|
||||
= pluralize(dossiers_count, "dossier est rattaché", "dossiers sont rattachés")
|
||||
à cette procédure, la suppression de cette procédure entrainera également leur suppression.
|
||||
%p.text-right
|
||||
= link_to "J'ai compris, je supprime la procédure",
|
||||
hide_admin_procedure_path(procedure),
|
||||
hide_admin_procedure_path(@procedure),
|
||||
method: :post,
|
||||
class: "btn btn-danger",
|
||||
data: { confirm: "Voulez-vous supprimer la procédure ?", disable: true }
|
||||
|
|
|
@ -2,10 +2,6 @@ production:
|
|||
adapter: redis
|
||||
url: redis://localhost:6379
|
||||
|
||||
staging:
|
||||
adapter: redis
|
||||
url: redis://localhost:6379
|
||||
|
||||
development:
|
||||
adapter: redis
|
||||
url: redis://localhost:6379
|
||||
|
|
|
@ -24,7 +24,3 @@ production: &production
|
|||
host: <%= ENV["DB_HOST"] %>
|
||||
username: <%= ENV["DB_USERNAME"] %>
|
||||
password: <%= ENV["DB_PASSWORD"] %>
|
||||
|
||||
# Alias for production
|
||||
staging:
|
||||
<<: *production
|
||||
|
|
|
@ -37,7 +37,7 @@ end
|
|||
|
||||
print "Deploy to #{ENV['to']} environment branch #{branch}\n"
|
||||
|
||||
set :rails_env, ENV["to"]
|
||||
set :rails_env, 'production'
|
||||
|
||||
# For system-wide RVM install.
|
||||
# set :rvm_path, '/usr/local/rvm/bin/rvm'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
APP_NAME="tps_local"
|
||||
APP_HOST="http://localhost:3000/"
|
||||
APP_HOST="localhost:3000"
|
||||
|
||||
GITHUB_CLIENT_ID=""
|
||||
GITHUB_CLIENT_SECRET=""
|
||||
|
|
|
@ -1,110 +0,0 @@
|
|||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
||||
# Verifies that versions and hashed value of the package contents in the project's package.json
|
||||
config.webpacker.check_yarn_integrity = false
|
||||
|
||||
# Code is not reloaded between requests.
|
||||
config.cache_classes = true
|
||||
|
||||
# Eager load code on boot. This eager loads most of Rails and
|
||||
# your application in memory, allowing both threaded web servers
|
||||
# and those relying on copy on write to perform better.
|
||||
# Rake tasks automatically ignore this option for performance.
|
||||
config.eager_load = true
|
||||
|
||||
# Full error reports are disabled and caching is turned on.
|
||||
config.consider_all_requests_local = false
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
||||
# Add `rack-cache` to your Gemfile before enabling this.
|
||||
# For large-scale production use, consider using a caching reverse proxy like
|
||||
# NGINX, varnish or squid.
|
||||
# config.action_dispatch.rack_cache = true
|
||||
|
||||
# Disable serving static files from the `/public` folder by default since
|
||||
# Apache or NGINX already handles this.
|
||||
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
||||
|
||||
# Compress JavaScripts and CSS.
|
||||
config.assets.js_compressor = :uglifier
|
||||
# config.assets.css_compressor = :sass
|
||||
|
||||
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
||||
config.assets.compile = false
|
||||
|
||||
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
||||
# yet still be able to expire them through the digest params.
|
||||
config.assets.digest = true
|
||||
|
||||
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
||||
|
||||
# Specifies the header that your server uses for sending files.
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
||||
|
||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||
config.force_ssl = true
|
||||
|
||||
# Use the lowest log level to ensure availability of diagnostic information
|
||||
# when problems arise.
|
||||
config.log_level = :debug
|
||||
|
||||
# Prepend all log lines with the following tags.
|
||||
# config.log_tags = [ :subdomain, :uuid ]
|
||||
|
||||
# Use a different logger for distributed setups.
|
||||
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
||||
|
||||
# Use a different cache store in production.
|
||||
# config.cache_store = :memory_store
|
||||
|
||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||
# config.action_controller.asset_host = 'http://assets.example.com'
|
||||
|
||||
# Ignore bad email addresses and do not raise email delivery errors.
|
||||
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
||||
# config.action_mailer.raise_delivery_errors = false
|
||||
|
||||
if ENV['MAILTRAP_ENABLED'] == 'enabled'
|
||||
config.action_mailer.delivery_method = :smtp
|
||||
config.action_mailer.smtp_settings = {
|
||||
user_name: Rails.application.secrets.mailtrap[:username],
|
||||
password: Rails.application.secrets.mailtrap[:password],
|
||||
address: 'smtp.mailtrap.io',
|
||||
domain: 'smtp.mailtrap.io',
|
||||
port: '2525',
|
||||
authentication: :cram_md5
|
||||
}
|
||||
else
|
||||
config.action_mailer.delivery_method = :mailjet
|
||||
end
|
||||
|
||||
config.action_mailer.default_url_options = {
|
||||
protocol: :https,
|
||||
host: ENV['APP_HOST']
|
||||
}
|
||||
|
||||
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||
# the I18n.default_locale when a translation cannot be found).
|
||||
config.i18n.fallbacks = true
|
||||
|
||||
config.active_storage.service = :clever_cloud
|
||||
|
||||
# Send deprecation notices to registered listeners.
|
||||
config.active_support.deprecation = :notify
|
||||
|
||||
# Use default logging formatter so that PID and timestamp are not suppressed.
|
||||
config.log_formatter = ::Logger::Formatter.new
|
||||
|
||||
# Do not dump schema after migrations.
|
||||
config.active_record.dump_schema_after_migration = false
|
||||
|
||||
Rails.application.routes.default_url_options = {
|
||||
protocol: :https,
|
||||
host: ENV['APP_HOST']
|
||||
}
|
||||
|
||||
config.lograge.enabled = ENV['LOGRAGE_ENABLED'] == 'enabled'
|
||||
end
|
|
@ -24,8 +24,6 @@ fr:
|
|||
procedure:
|
||||
onglets:
|
||||
accompagnateurs: Accompagnateurs
|
||||
stats:
|
||||
title: Dossiers
|
||||
onglet_accompagnateurs:
|
||||
add:
|
||||
title: 'Ajouter un accompagnateur'
|
||||
|
|
|
@ -18,7 +18,7 @@ defaults: &defaults
|
|||
france_connect_particulier:
|
||||
identifier: <%= ENV['FC_PARTICULIER_ID'] %>
|
||||
secret: <%= ENV['FC_PARTICULIER_SECRET'] %>
|
||||
redirect_uri: https://{{ <%= ENV['APP_HOST'] %> }}/france_connect/particulier/callback
|
||||
redirect_uri: https://<%= ENV['APP_HOST'] %>/france_connect/particulier/callback
|
||||
authorization_endpoint: <%= ENV['FC_PARTICULIER_BASE_URL'] %>/api/v1/authorize
|
||||
token_endpoint: <%= ENV['FC_PARTICULIER_BASE_URL'] %>/api/v1/token
|
||||
userinfo_endpoint: <%= ENV['FC_PARTICULIER_BASE_URL'] %>/api/v1/userinfo
|
||||
|
@ -74,7 +74,3 @@ test:
|
|||
# instead read values from the environment.
|
||||
production: &production
|
||||
<<: *defaults
|
||||
|
||||
# Alias for production
|
||||
staging:
|
||||
<<: *production
|
||||
|
|
|
@ -58,15 +58,6 @@ test:
|
|||
# Compile test packs to a separate directory
|
||||
public_output_path: packs-test
|
||||
|
||||
staging:
|
||||
<<: *default
|
||||
|
||||
# Production depends on precompilation of packs prior to booting for performance.
|
||||
compile: false
|
||||
|
||||
# Cache manifest.json for performance
|
||||
cache_manifest: true
|
||||
|
||||
production:
|
||||
<<: *default
|
||||
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe AdminProceduresShowFacades do
|
||||
let!(:procedure) { create(:procedure) }
|
||||
|
||||
let!(:dossier_0) { create(:dossier, procedure: procedure, state: 'brouillon') }
|
||||
let!(:dossier_1) { create(:dossier, procedure: procedure, state: 'en_construction') }
|
||||
let!(:dossier_2) { create(:dossier, procedure: procedure, state: 'en_construction') }
|
||||
let!(:dossier_6) { create(:dossier, procedure: procedure, archived: true, state: 'en_construction') }
|
||||
|
||||
subject { AdminProceduresShowFacades.new procedure }
|
||||
|
||||
describe '#procedure' do
|
||||
subject { super().procedure }
|
||||
|
||||
it { is_expected.to eq(procedure) }
|
||||
end
|
||||
|
||||
describe '#dossiers' do
|
||||
subject { super().dossiers }
|
||||
|
||||
it { expect(subject.size).to eq(3) }
|
||||
end
|
||||
|
||||
describe '#dossiers_for_pie_highchart' do
|
||||
subject { super().dossiers_for_pie_highchart }
|
||||
|
||||
it { expect(subject).to eq({ 'En construction' => 2 }) }
|
||||
end
|
||||
|
||||
describe '#dossiers_archived_by_state_total' do
|
||||
subject { super().dossiers_archived_by_state_total }
|
||||
|
||||
it { expect(subject.size).to eq(1) }
|
||||
|
||||
it { expect(subject.first.state).to eq('en_construction') }
|
||||
it { expect(subject.first.total).to eq(1) }
|
||||
end
|
||||
|
||||
describe '#dossiers_archived_total' do
|
||||
subject { super().dossiers_archived_total }
|
||||
|
||||
it { is_expected.to eq(1) }
|
||||
end
|
||||
|
||||
describe '#dossiers_total' do
|
||||
subject { super().dossiers_total }
|
||||
|
||||
it { is_expected.to eq(3) }
|
||||
end
|
||||
|
||||
describe '#dossiers_termine_total' do
|
||||
subject { super().dossiers_termine_total }
|
||||
|
||||
it { is_expected.to eq(0) }
|
||||
end
|
||||
end
|
|
@ -5,7 +5,6 @@ describe 'admin/procedures/show.html.haml', type: :view do
|
|||
let(:procedure) { create(:procedure, :with_service, archived_at: archived_at) }
|
||||
|
||||
before do
|
||||
assign(:facade, AdminProceduresShowFacades.new(procedure.decorate))
|
||||
assign(:procedure, procedure)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue