commit
bf89cf6490
24 changed files with 94 additions and 61 deletions
1
Gemfile
1
Gemfile
|
@ -23,7 +23,6 @@ gem 'delayed_cron_job' # Cron jobs
|
||||||
gem 'delayed_job_active_record'
|
gem 'delayed_job_active_record'
|
||||||
gem 'delayed_job_web', '>= 1.4.4'
|
gem 'delayed_job_web', '>= 1.4.4'
|
||||||
gem 'devise' # Gestion des comptes utilisateurs
|
gem 'devise' # Gestion des comptes utilisateurs
|
||||||
gem 'devise-async'
|
|
||||||
gem 'devise-i18n'
|
gem 'devise-i18n'
|
||||||
gem 'devise-two-factor'
|
gem 'devise-two-factor'
|
||||||
gem 'discard'
|
gem 'discard'
|
||||||
|
|
|
@ -200,9 +200,6 @@ GEM
|
||||||
railties (>= 4.1.0)
|
railties (>= 4.1.0)
|
||||||
responders
|
responders
|
||||||
warden (~> 1.2.3)
|
warden (~> 1.2.3)
|
||||||
devise-async (1.0.0)
|
|
||||||
activejob (>= 5.0)
|
|
||||||
devise (>= 4.0)
|
|
||||||
devise-i18n (1.9.2)
|
devise-i18n (1.9.2)
|
||||||
devise (>= 4.7.1)
|
devise (>= 4.7.1)
|
||||||
devise-two-factor (4.0.2)
|
devise-two-factor (4.0.2)
|
||||||
|
@ -820,7 +817,6 @@ DEPENDENCIES
|
||||||
delayed_job_active_record
|
delayed_job_active_record
|
||||||
delayed_job_web (>= 1.4.4)
|
delayed_job_web (>= 1.4.4)
|
||||||
devise
|
devise
|
||||||
devise-async
|
|
||||||
devise-i18n
|
devise-i18n
|
||||||
devise-two-factor
|
devise-two-factor
|
||||||
discard
|
discard
|
||||||
|
|
|
@ -44,7 +44,7 @@ module Administrateurs
|
||||||
end
|
end
|
||||||
|
|
||||||
def apercu
|
def apercu
|
||||||
@dossier = procedure_without_control.draft_revision.new_dossier
|
@dossier = procedure_without_control.draft_revision.dossier_for_preview(current_user)
|
||||||
@tab = apercu_tab
|
@tab = apercu_tab
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -45,11 +45,9 @@ class Champs::SiretController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_etablisement
|
def find_etablisement
|
||||||
if params[:champ_id].present?
|
|
||||||
@champ = policy_scope(Champ).find(params[:champ_id])
|
@champ = policy_scope(Champ).find(params[:champ_id])
|
||||||
@etablissement = @champ&.etablissement
|
@etablissement = @champ.etablissement
|
||||||
end
|
@procedure_id = @champ.dossier.procedure.id
|
||||||
@procedure_id = @champ&.dossier&.procedure&.id || 'aperçu'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_etablissement_with_siret
|
def find_etablissement_with_siret
|
||||||
|
@ -57,7 +55,7 @@ class Champs::SiretController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def clear_siret_and_etablissement
|
def clear_siret_and_etablissement
|
||||||
@champ&.update!(value: '')
|
@champ.update!(value: '')
|
||||||
@etablissement&.destroy
|
@etablissement&.destroy
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -84,8 +84,8 @@ module Users
|
||||||
|
|
||||||
def generate_empty_pdf(revision)
|
def generate_empty_pdf(revision)
|
||||||
@dossier = revision.new_dossier
|
@dossier = revision.new_dossier
|
||||||
s = render_to_string(template: 'dossiers/dossier_vide', formats: [:pdf])
|
data = render_to_string(template: 'dossiers/dossier_vide', formats: [:pdf])
|
||||||
send_data(s, :filename => "#{revision.procedure.libelle}.pdf")
|
send_data(data, filename: "#{revision.procedure.libelle}.pdf")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -62,7 +62,7 @@ module ApplicationHelper
|
||||||
|
|
||||||
def render_champ(champ)
|
def render_champ(champ)
|
||||||
champ_selector = "##{champ.input_group_id}"
|
champ_selector = "##{champ.input_group_id}"
|
||||||
form_html = render 'shared/dossiers/edit', dossier: champ.dossier, apercu: false
|
form_html = render 'shared/dossiers/edit', dossier: champ.dossier
|
||||||
champ_html = Nokogiri::HTML.fragment(form_html).at_css(champ_selector).to_s
|
champ_html = Nokogiri::HTML.fragment(form_html).at_css(champ_selector).to_s
|
||||||
# rubocop:disable Rails/OutputSafety
|
# rubocop:disable Rails/OutputSafety
|
||||||
raw("document.querySelector('#{champ_selector}').outerHTML = \"#{escape_javascript(champ_html)}\";")
|
raw("document.querySelector('#{champ_selector}').outerHTML = \"#{escape_javascript(champ_html)}\";")
|
||||||
|
|
|
@ -23,7 +23,7 @@ export type DeleteFeatures = (params: {
|
||||||
|
|
||||||
export function useFeatureCollection(
|
export function useFeatureCollection(
|
||||||
initialFeatureCollection: FeatureCollection,
|
initialFeatureCollection: FeatureCollection,
|
||||||
{ url, enabled = true }: { url: string; enabled: boolean }
|
{ url }: { url: string }
|
||||||
) {
|
) {
|
||||||
const [error, onError] = useError();
|
const [error, onError] = useError();
|
||||||
const [featureCollection, setFeatureCollection] = useState(
|
const [featureCollection, setFeatureCollection] = useState(
|
||||||
|
@ -96,9 +96,6 @@ export function useFeatureCollection(
|
||||||
source = SOURCE_SELECTION_UTILISATEUR,
|
source = SOURCE_SELECTION_UTILISATEUR,
|
||||||
external = false
|
external = false
|
||||||
}) => {
|
}) => {
|
||||||
if (!enabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
const newFeatures: Feature[] = [];
|
const newFeatures: Feature[] = [];
|
||||||
for (const feature of features) {
|
for (const feature of features) {
|
||||||
|
@ -117,7 +114,7 @@ export function useFeatureCollection(
|
||||||
onError('Le polygone dessiné n’est pas valide.');
|
onError('Le polygone dessiné n’est pas valide.');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[enabled, url, updateFeatureCollection, addFeatures, onError]
|
[url, updateFeatureCollection, addFeatures, onError]
|
||||||
);
|
);
|
||||||
|
|
||||||
const updateFeatures = useCallback<UpdateFatures>(
|
const updateFeatures = useCallback<UpdateFatures>(
|
||||||
|
@ -126,9 +123,6 @@ export function useFeatureCollection(
|
||||||
source = SOURCE_SELECTION_UTILISATEUR,
|
source = SOURCE_SELECTION_UTILISATEUR,
|
||||||
external = false
|
external = false
|
||||||
}) => {
|
}) => {
|
||||||
if (!enabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
const newFeatures: Feature[] = [];
|
const newFeatures: Feature[] = [];
|
||||||
for (const feature of features) {
|
for (const feature of features) {
|
||||||
|
@ -154,14 +148,11 @@ export function useFeatureCollection(
|
||||||
onError('Le polygone dessiné n’est pas valide.');
|
onError('Le polygone dessiné n’est pas valide.');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[enabled, url, updateFeatureCollection, addFeatures, onError]
|
[url, updateFeatureCollection, addFeatures, onError]
|
||||||
);
|
);
|
||||||
|
|
||||||
const deleteFeatures = useCallback<DeleteFeatures>(
|
const deleteFeatures = useCallback<DeleteFeatures>(
|
||||||
async ({ features, external = false }) => {
|
async ({ features, external = false }) => {
|
||||||
if (!enabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
const deletedFeatures = [];
|
const deletedFeatures = [];
|
||||||
for (const feature of features) {
|
for (const feature of features) {
|
||||||
|
@ -183,7 +174,7 @@ export function useFeatureCollection(
|
||||||
onError('Le polygone n’a pas pu être supprimé.');
|
onError('Le polygone n’a pas pu être supprimé.');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[enabled, url, updateFeatureCollection, removeFeatures, onError]
|
[url, updateFeatureCollection, removeFeatures, onError]
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -16,19 +16,17 @@ import { FlashMessage } from '../shared/FlashMessage';
|
||||||
export default function MapEditor({
|
export default function MapEditor({
|
||||||
featureCollection: initialFeatureCollection,
|
featureCollection: initialFeatureCollection,
|
||||||
url,
|
url,
|
||||||
options,
|
options
|
||||||
preview
|
|
||||||
}: {
|
}: {
|
||||||
featureCollection: FeatureCollection;
|
featureCollection: FeatureCollection;
|
||||||
url: string;
|
url: string;
|
||||||
preview: boolean;
|
|
||||||
options: { layers: string[] };
|
options: { layers: string[] };
|
||||||
}) {
|
}) {
|
||||||
const [cadastreEnabled, setCadastreEnabled] = useState(false);
|
const [cadastreEnabled, setCadastreEnabled] = useState(false);
|
||||||
|
|
||||||
const { featureCollection, error, ...actions } = useFeatureCollection(
|
const { featureCollection, error, ...actions } = useFeatureCollection(
|
||||||
initialFeatureCollection,
|
initialFeatureCollection,
|
||||||
{ url, enabled: !preview }
|
{ url }
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -54,14 +52,14 @@ export default function MapEditor({
|
||||||
<DrawLayer
|
<DrawLayer
|
||||||
featureCollection={featureCollection}
|
featureCollection={featureCollection}
|
||||||
{...actions}
|
{...actions}
|
||||||
enabled={!preview && !cadastreEnabled}
|
enabled={!cadastreEnabled}
|
||||||
/>
|
/>
|
||||||
{options.layers.includes('cadastres') ? (
|
{options.layers.includes('cadastres') ? (
|
||||||
<>
|
<>
|
||||||
<CadastreLayer
|
<CadastreLayer
|
||||||
featureCollection={featureCollection}
|
featureCollection={featureCollection}
|
||||||
{...actions}
|
{...actions}
|
||||||
enabled={!preview && cadastreEnabled}
|
enabled={cadastreEnabled}
|
||||||
/>
|
/>
|
||||||
<div className="cadastres-selection-control mapboxgl-ctrl-group">
|
<div className="cadastres-selection-control mapboxgl-ctrl-group">
|
||||||
<button
|
<button
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Controller } from '@hotwired/stimulus';
|
import { Controller } from '@hotwired/stimulus';
|
||||||
import React, { lazy, Suspense, FunctionComponent, StrictMode } from 'react';
|
import React, { lazy, Suspense, FunctionComponent } from 'react';
|
||||||
import { render, unmountComponentAtNode } from 'react-dom';
|
import { render, unmountComponentAtNode } from 'react-dom';
|
||||||
import invariant from 'tiny-invariant';
|
import invariant from 'tiny-invariant';
|
||||||
|
|
||||||
|
@ -44,12 +44,7 @@ export class ReactController extends Controller {
|
||||||
Component,
|
Component,
|
||||||
`Cannot find a React component with class "${componentName}"`
|
`Cannot find a React component with class "${componentName}"`
|
||||||
);
|
);
|
||||||
render(
|
render(<Component {...props} />, node);
|
||||||
<StrictMode>
|
|
||||||
<Component {...props} />
|
|
||||||
</StrictMode>,
|
|
||||||
node
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private getComponent(componentName: string): FunctionComponent<Props> | null {
|
private getComponent(componentName: string): FunctionComponent<Props> | null {
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
# last_commentaire_updated_at :datetime
|
# last_commentaire_updated_at :datetime
|
||||||
# motivation :text
|
# motivation :text
|
||||||
# private_search_terms :text
|
# private_search_terms :text
|
||||||
|
# for_procedure_preview :boolean
|
||||||
# processed_at :datetime
|
# processed_at :datetime
|
||||||
# search_terms :text
|
# search_terms :text
|
||||||
# state :string
|
# state :string
|
||||||
|
@ -205,13 +206,14 @@ class Dossier < ApplicationRecord
|
||||||
scope :not_archived, -> { where(archived: false) }
|
scope :not_archived, -> { where(archived: false) }
|
||||||
scope :hidden_by_user, -> { where.not(hidden_by_user_at: nil) }
|
scope :hidden_by_user, -> { where.not(hidden_by_user_at: nil) }
|
||||||
scope :hidden_by_administration, -> { where.not(hidden_by_administration_at: nil) }
|
scope :hidden_by_administration, -> { where.not(hidden_by_administration_at: nil) }
|
||||||
scope :visible_by_user, -> { where(hidden_by_user_at: nil) }
|
scope :visible_by_user, -> { where(for_procedure_preview: false).or(where(for_procedure_preview: nil)).where(hidden_by_user_at: nil) }
|
||||||
scope :visible_by_administration, -> {
|
scope :visible_by_administration, -> {
|
||||||
state_not_brouillon
|
state_not_brouillon
|
||||||
.where(hidden_by_administration_at: nil)
|
.where(hidden_by_administration_at: nil)
|
||||||
.merge(visible_by_user.or(state_not_en_construction))
|
.merge(visible_by_user.or(state_not_en_construction))
|
||||||
}
|
}
|
||||||
scope :visible_by_user_or_administration, -> { visible_by_user.or(visible_by_administration) }
|
scope :visible_by_user_or_administration, -> { visible_by_user.or(visible_by_administration) }
|
||||||
|
scope :for_procedure_preview, -> { where(for_procedure_preview: true) }
|
||||||
|
|
||||||
scope :order_by_updated_at, -> (order = :desc) { order(updated_at: order) }
|
scope :order_by_updated_at, -> (order = :desc) { order(updated_at: order) }
|
||||||
scope :order_by_created_at, -> (order = :asc) { order(depose_at: order, created_at: order, id: order) }
|
scope :order_by_created_at, -> (order = :asc) { order(depose_at: order, created_at: order, id: order) }
|
||||||
|
@ -542,7 +544,7 @@ class Dossier < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def can_transition_to_en_construction?
|
def can_transition_to_en_construction?
|
||||||
brouillon? && procedure.dossier_can_transition_to_en_construction?
|
brouillon? && procedure.dossier_can_transition_to_en_construction? && !for_procedure_preview?
|
||||||
end
|
end
|
||||||
|
|
||||||
def can_repasser_en_instruction?
|
def can_repasser_en_instruction?
|
||||||
|
@ -1244,7 +1246,7 @@ class Dossier < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_draft_notification_email
|
def send_draft_notification_email
|
||||||
if brouillon? && !procedure.declarative?
|
if brouillon? && !procedure.declarative? && !for_procedure_preview?
|
||||||
DossierMailer.notify_new_draft(self).deliver_later
|
DossierMailer.notify_new_draft(self).deliver_later
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -132,6 +132,19 @@ class ProcedureRevision < ApplicationRecord
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def dossier_for_preview(user)
|
||||||
|
dossier = Dossier
|
||||||
|
.create_with(groupe_instructeur: procedure.defaut_groupe_instructeur_for_new_dossier)
|
||||||
|
.find_or_initialize_by(revision: self, user: user, for_procedure_preview: true, state: Dossier.states.fetch(:brouillon))
|
||||||
|
|
||||||
|
if dossier.new_record?
|
||||||
|
dossier.build_default_individual
|
||||||
|
dossier.save!
|
||||||
|
end
|
||||||
|
|
||||||
|
dossier
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def compare_attestation_template(from_at, to_at)
|
def compare_attestation_template(from_at, to_at)
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
class SuperAdmin < ApplicationRecord
|
class SuperAdmin < ApplicationRecord
|
||||||
include PasswordComplexityConcern
|
include PasswordComplexityConcern
|
||||||
|
|
||||||
devise :rememberable, :trackable, :validatable, :lockable, :async, :recoverable,
|
devise :rememberable, :trackable, :validatable, :lockable, :recoverable,
|
||||||
:two_factor_authenticatable, :otp_secret_encryption_key => Rails.application.secrets.otp_secret_key
|
:two_factor_authenticatable, :otp_secret_encryption_key => Rails.application.secrets.otp_secret_key
|
||||||
|
|
||||||
def enable_otp!
|
def enable_otp!
|
||||||
|
@ -58,4 +58,8 @@ class SuperAdmin < ApplicationRecord
|
||||||
|
|
||||||
user
|
user
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def send_devise_notification(notification, *args)
|
||||||
|
devise_mailer.send(notification, self, *args).deliver_later
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,7 +38,7 @@ class User < ApplicationRecord
|
||||||
|
|
||||||
# Include default devise modules. Others available are:
|
# Include default devise modules. Others available are:
|
||||||
# :confirmable, :lockable, :timeoutable and :omniauthable
|
# :confirmable, :lockable, :timeoutable and :omniauthable
|
||||||
devise :database_authenticatable, :registerable, :async,
|
devise :database_authenticatable, :registerable,
|
||||||
:recoverable, :rememberable, :trackable, :validatable, :confirmable, :lockable
|
:recoverable, :rememberable, :trackable, :validatable, :confirmable, :lockable
|
||||||
|
|
||||||
self.ignored_columns = [:administrateur_id, :instructeur_id, :expert_id]
|
self.ignored_columns = [:administrateur_id, :instructeur_id, :expert_id]
|
||||||
|
@ -249,6 +249,10 @@ class User < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def send_devise_notification(notification, *args)
|
||||||
|
devise_mailer.send(notification, self, *args).deliver_later
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def does_not_merge_on_self
|
def does_not_merge_on_self
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
active: @tab == 'annotations-privees')
|
active: @tab == 'annotations-privees')
|
||||||
|
|
||||||
- if @tab == 'dossier'
|
- if @tab == 'dossier'
|
||||||
= render partial: "shared/dossiers/edit", locals: { dossier: @dossier, apercu: true }
|
= render partial: "shared/dossiers/edit", locals: { dossier: @dossier }
|
||||||
- else
|
- else
|
||||||
.container
|
.container
|
||||||
= form_for @dossier, url: '', method: :get, html: { class: 'form' } do |f|
|
= form_for @dossier, url: '', method: :get, html: { class: 'form' } do |f|
|
||||||
|
|
|
@ -185,7 +185,7 @@ prawn_document(page_size: "A4") do |pdf|
|
||||||
pdf.move_down(40)
|
pdf.move_down(40)
|
||||||
|
|
||||||
render_in_2_columns(pdf, 'Démarche', @dossier.procedure.libelle)
|
render_in_2_columns(pdf, 'Démarche', @dossier.procedure.libelle)
|
||||||
render_in_2_columns(pdf, 'Organisme', @dossier.procedure.organisation_name)
|
render_in_2_columns(pdf, 'Organisme', @dossier.procedure.organisation_name || "En attente de saisi")
|
||||||
pdf.text "\n"
|
pdf.text "\n"
|
||||||
|
|
||||||
add_title(pdf, "Identité du demandeur")
|
add_title(pdf, "Identité du demandeur")
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
.dossier-edit.container
|
.dossier-edit.container
|
||||||
= render partial: "shared/dossiers/submit_is_over", locals: { dossier: dossier }
|
= render partial: "shared/dossiers/submit_is_over", locals: { dossier: dossier }
|
||||||
|
|
||||||
- if apercu
|
- if dossier.for_procedure_preview?
|
||||||
- form_options = { url: '', method: :get }
|
- form_options = { url: '', method: :get }
|
||||||
- elsif dossier.brouillon?
|
- elsif dossier.brouillon?
|
||||||
- form_options = { url: brouillon_dossier_url(dossier), method: :patch }
|
- form_options = { url: brouillon_dossier_url(dossier), method: :patch }
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
= t('views.shared.dossiers.edit.autosave')
|
= t('views.shared.dossiers.edit.autosave')
|
||||||
- else
|
- else
|
||||||
Pour enregistrer votre dossier et le reprendre plus tard, cliquez sur le bouton « Enregistrer le brouillon » en bas à gauche du formulaire.
|
Pour enregistrer votre dossier et le reprendre plus tard, cliquez sur le bouton « Enregistrer le brouillon » en bas à gauche du formulaire.
|
||||||
- if !apercu && dossier.france_connect_information.present?
|
- if dossier.france_connect_information.present?
|
||||||
= render partial: "shared/dossiers/france_connect_informations", locals: { user_information: dossier.france_connect_information }
|
= render partial: "shared/dossiers/france_connect_informations", locals: { user_information: dossier.france_connect_information }
|
||||||
- if notice_url(dossier.procedure).present?
|
- if notice_url(dossier.procedure).present?
|
||||||
= link_to notice_url(dossier.procedure), target: '_blank', rel: 'noopener', class: 'button notice', title: "Pour vous aider à remplir votre dossier, vous pouvez consulter le guide de cette démarche." do
|
= link_to notice_url(dossier.procedure), target: '_blank', rel: 'noopener', class: 'button notice', title: "Pour vous aider à remplir votre dossier, vous pouvez consulter le guide de cette démarche." do
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
= render partial: "shared/dossiers/editable_champs/editable_champ",
|
= render partial: "shared/dossiers/editable_champs/editable_champ",
|
||||||
locals: { champ: champ, form: champ_form }
|
locals: { champ: champ, form: champ_form }
|
||||||
|
|
||||||
- if !apercu
|
- if !dossier.for_procedure_preview?
|
||||||
.dossier-edit-sticky-footer
|
.dossier-edit-sticky-footer
|
||||||
.send-dossier-actions-bar
|
.send-dossier-actions-bar
|
||||||
- if dossier.brouillon?
|
- if dossier.brouillon?
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
- preview = !champ.persisted?
|
= react_component("MapEditor", { featureCollection: champ.to_feature_collection, url: champs_carte_features_path(champ), options: champ.render_options }, class: "carte-#{champ.id}")
|
||||||
- url = champs_carte_features_path(preview ? 'preview' : champ)
|
|
||||||
= react_component("MapEditor", { featureCollection: champ.to_feature_collection, url: url, preview: preview, options: champ.render_options }, class: "carte-#{champ.id}")
|
|
||||||
|
|
||||||
.geo-areas
|
.geo-areas
|
||||||
= render partial: 'shared/champs/carte/geo_areas', locals: { champ: champ, editing: true }
|
= render partial: 'shared/champs/carte/geo_areas', locals: { champ: champ, editing: true }
|
||||||
|
|
|
@ -7,6 +7,6 @@
|
||||||
.dossier-container
|
.dossier-container
|
||||||
.dossier-header.sub-header
|
.dossier-header.sub-header
|
||||||
.container
|
.container
|
||||||
= render partial: "shared/dossiers/header", locals: { dossier: @dossier, apercu: false }
|
= render partial: "shared/dossiers/header", locals: { dossier: @dossier }
|
||||||
|
|
||||||
= render partial: "shared/dossiers/edit", locals: { dossier: @dossier, apercu: false }
|
= render partial: "shared/dossiers/edit", locals: { dossier: @dossier }
|
||||||
|
|
|
@ -7,4 +7,4 @@
|
||||||
= render partial: 'users/dossiers/show/header', locals: { dossier: @dossier }
|
= render partial: 'users/dossiers/show/header', locals: { dossier: @dossier }
|
||||||
|
|
||||||
.container
|
.container
|
||||||
= render partial: "shared/dossiers/edit", locals: { dossier: @dossier, apercu: false }
|
= render partial: "shared/dossiers/edit", locals: { dossier: @dossier }
|
||||||
|
|
6
db/migrate/20220315124100_add_preview_to_dossiers.rb
Normal file
6
db/migrate/20220315124100_add_preview_to_dossiers.rb
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
class AddPreviewToDossiers < ActiveRecord::Migration[6.1]
|
||||||
|
def change
|
||||||
|
add_column :dossiers, :for_procedure_preview, :boolean
|
||||||
|
change_column_default :dossiers, :for_procedure_preview, false
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 2022_04_25_140107) do
|
ActiveRecord::Schema.define(version: 2022_04_26_140107) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
@ -314,6 +314,7 @@ ActiveRecord::Schema.define(version: 2022_04_25_140107) do
|
||||||
t.datetime "en_construction_close_to_expiration_notice_sent_at"
|
t.datetime "en_construction_close_to_expiration_notice_sent_at"
|
||||||
t.interval "en_construction_conservation_extension", default: "PT0S"
|
t.interval "en_construction_conservation_extension", default: "PT0S"
|
||||||
t.datetime "en_instruction_at"
|
t.datetime "en_instruction_at"
|
||||||
|
t.boolean "for_procedure_preview", default: false
|
||||||
t.bigint "groupe_instructeur_id"
|
t.bigint "groupe_instructeur_id"
|
||||||
t.datetime "groupe_instructeur_updated_at"
|
t.datetime "groupe_instructeur_updated_at"
|
||||||
t.datetime "hidden_at"
|
t.datetime "hidden_at"
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
namespace :after_party do
|
||||||
|
desc 'Deployment task: set_default_for_procedure_preview_on_dossiers'
|
||||||
|
task set_default_for_procedure_preview_on_dossiers: :environment do
|
||||||
|
puts "Running deploy task 'set_default_for_procedure_preview_on_dossiers'"
|
||||||
|
|
||||||
|
Dossier
|
||||||
|
.where(for_procedure_preview: nil)
|
||||||
|
.in_batches(of: 5_000)
|
||||||
|
.update_all(for_procedure_preview: false)
|
||||||
|
|
||||||
|
# Update task as completed. If you remove the line below, the task will
|
||||||
|
# run with every deploy (or every time you call after_party:run).
|
||||||
|
AfterParty::TaskRecord
|
||||||
|
.create version: AfterParty::TaskRecorder.new(__FILE__).timestamp
|
||||||
|
end
|
||||||
|
end
|
|
@ -23,7 +23,11 @@ describe Administrateurs::ProceduresController, type: :controller do
|
||||||
get :apercu, params: { id: procedure.id }
|
get :apercu, params: { id: procedure.id }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(response).to have_http_status(:ok) }
|
it do
|
||||||
|
expect(response).to have_http_status(:ok)
|
||||||
|
expect(procedure.dossiers.visible_by_user).to be_empty
|
||||||
|
expect(procedure.dossiers.for_procedure_preview).not_to be_empty
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:procedure_params) {
|
let(:procedure_params) {
|
||||||
|
|
|
@ -181,15 +181,23 @@ describe Users::CommencerController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#dossier_vide_test_pdf' do
|
describe '#dossier_vide_test_pdf' do
|
||||||
before { get :dossier_vide_pdf_test, params: { path: procedure.path } }
|
render_views
|
||||||
|
before { get :dossier_vide_pdf_test, params: { path: procedure.path }, format: :pdf }
|
||||||
|
|
||||||
context 'not published procedure' do
|
context 'not published procedure with service' do
|
||||||
let(:procedure) { create(:procedure, :with_service, :with_path) }
|
let(:procedure) { create(:procedure, :with_service, :with_path) }
|
||||||
|
|
||||||
it 'works' do
|
it 'works' do
|
||||||
expect(response).to have_http_status(:success)
|
expect(response).to have_http_status(:success)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
context 'not published procedure without service' do
|
||||||
|
let(:procedure) { create(:procedure, :with_path, service: nil, organisation: nil) }
|
||||||
|
|
||||||
|
it 'works' do
|
||||||
|
expect(response).to have_http_status(:success)
|
||||||
|
end
|
||||||
|
end
|
||||||
context 'published procedure' do
|
context 'published procedure' do
|
||||||
let(:procedure) { create(:procedure, :published, :with_service, :with_path) }
|
let(:procedure) { create(:procedure, :published, :with_service, :with_path) }
|
||||||
it 'redirect to procedure not found' do
|
it 'redirect to procedure not found' do
|
||||||
|
|
Loading…
Reference in a new issue