-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10217 from demarches-simplifiees/9827-export-rename
ETQ instructeur, je peux renommer le contenu de mon export zip
- Loading branch information
Showing
64 changed files
with
1,781 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
@import "constants"; | ||
|
||
.export-template-preview { | ||
// From https://codepen.io/myramoki/pen/xZJjrr | ||
.tree { | ||
margin-left: 0; | ||
} | ||
|
||
.tree, | ||
.tree ul { | ||
padding: 0; | ||
list-style: none; | ||
position: relative; | ||
} | ||
|
||
.tree ul { | ||
margin: 0 0 0 0.5em; // (indentation/2) | ||
} | ||
|
||
.tree:before, | ||
.tree ul:before { | ||
content: ""; | ||
display: block; | ||
width: 0; | ||
position: absolute; | ||
top: 0; | ||
bottom: 0; | ||
left: 4px; | ||
border-left: 1px dashed; | ||
} | ||
|
||
ul.tree:before { | ||
border-left: none; | ||
} | ||
|
||
.tree li { | ||
margin: 0; | ||
padding: 0 1.5em; // indentation + .5em | ||
line-height: 2em; // default list item's `line-height` | ||
position: relative; | ||
} | ||
|
||
.tree > li { | ||
padding-left: 0; // Don't indent first level | ||
} | ||
|
||
.tree li:before { | ||
content: ""; | ||
display: block; | ||
width: 10px; // same with indentation | ||
height: 0; | ||
border-top: 1px dashed; | ||
margin-top: -1px; // border top width | ||
position: absolute; | ||
top: 1em; // (line-height/2) | ||
left: 4px; | ||
} | ||
|
||
ul.tree > li:before { | ||
border-top: none; | ||
} | ||
|
||
.tree li:last-child:before { | ||
background: var( | ||
--background-alt-blue-france | ||
); // same with body background | ||
height: auto; | ||
top: 1em; // (line-height/2) | ||
bottom: 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@import "constants"; | ||
|
||
.tiptap-editor { | ||
// Tags | ||
.fr-menu__list { | ||
max-height: 500px; | ||
} | ||
|
||
.fr-tag:not(.fr-menu .fr-tag) { | ||
// style span rendered by tiptap like a button/link tag | ||
color: var(--text-action-high-blue-france); | ||
background-color: var(--background-action-low-blue-france); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 10 additions & 9 deletions
19
app/components/tags_button_list_component/tags_button_list_component.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
app/controllers/instructeurs/export_templates_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
module Instructeurs | ||
class ExportTemplatesController < InstructeurController | ||
before_action :set_procedure | ||
before_action :set_groupe_instructeur, only: [:create, :update] | ||
before_action :set_export_template, only: [:edit, :update, :destroy] | ||
before_action :set_groupe_instructeurs | ||
before_action :set_all_pj | ||
|
||
def new | ||
@export_template = ExportTemplate.new(kind: 'zip', groupe_instructeur: @groupe_instructeurs.first) | ||
@export_template.set_default_values | ||
end | ||
|
||
def create | ||
@export_template = @groupe_instructeur.export_templates.build(export_template_params) | ||
@export_template.assign_pj_names(pj_params) | ||
if @export_template.save | ||
redirect_to exports_instructeur_procedure_path(procedure: @procedure), notice: "Le modèle d'export #{@export_template.name} a bien été créé" | ||
else | ||
flash[:alert] = @export_template.errors.full_messages | ||
render :new | ||
end | ||
end | ||
|
||
def edit | ||
end | ||
|
||
def update | ||
@export_template.assign_attributes(export_template_params) | ||
@export_template.groupe_instructeur = @groupe_instructeur | ||
@export_template.assign_pj_names(pj_params) | ||
if @export_template.save | ||
redirect_to exports_instructeur_procedure_path(procedure: @procedure), notice: "Le modèle d'export #{@export_template.name} a bien été modifié" | ||
else | ||
flash[:alert] = @export_template.errors.full_messages | ||
render :edit | ||
end | ||
end | ||
|
||
def destroy | ||
if @export_template.destroy | ||
redirect_to exports_instructeur_procedure_path(procedure: @procedure), notice: "Le modèle d'export #{@export_template.name} a bien été supprimé" | ||
else | ||
redirect_to exports_instructeur_procedure_path(procedure: @procedure), alert: "Le modèle d'export #{@export_template.name} n'a pu être supprimé" | ||
end | ||
end | ||
|
||
def preview | ||
set_groupe_instructeur | ||
@export_template = @groupe_instructeur.export_templates.build(export_template_params) | ||
@export_template.assign_pj_names(pj_params) | ||
|
||
@sample_dossier = @procedure.dossier_for_preview(current_instructeur) | ||
|
||
render turbo_stream: turbo_stream.replace('preview', partial: 'preview', locals: { export_template: @export_template, procedure: @procedure, dossier: @sample_dossier }) | ||
end | ||
|
||
private | ||
|
||
def export_template_params | ||
params.require(:export_template).permit(*export_params) | ||
end | ||
|
||
def set_procedure | ||
@procedure = current_instructeur.procedures.find params[:procedure_id] | ||
Sentry.configure_scope do |scope| | ||
scope.set_tags(procedure: @procedure.id) | ||
end | ||
end | ||
|
||
def set_export_template | ||
@export_template = current_instructeur.export_templates.find(params[:id]) | ||
end | ||
|
||
def set_groupe_instructeur | ||
@groupe_instructeur = @procedure.groupe_instructeurs.find(params.require(:export_template)[:groupe_instructeur_id]) | ||
end | ||
|
||
def set_groupe_instructeurs | ||
@groupe_instructeurs = current_instructeur.groupe_instructeurs.where(procedure: @procedure) | ||
end | ||
|
||
def set_all_pj | ||
@all_pj ||= @procedure.exportables_pieces_jointes | ||
end | ||
|
||
def export_params | ||
[:name, :kind, :tiptap_default_dossier_directory, :tiptap_pdf_name] | ||
end | ||
|
||
def pj_params | ||
@procedure = current_instructeur.procedures.find params[:procedure_id] | ||
pj_params = [] | ||
@all_pj.each do |pj| | ||
pj_params << "tiptap_pj_#{pj.stable_id}".to_sym | ||
end | ||
params.require(:export_template).permit(*pj_params) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.