Skip to content

Commit

Permalink
Merge branch 'feature/import-2023-06-06'
Browse files Browse the repository at this point in the history
  • Loading branch information
maatinito committed Aug 29, 2023
2 parents ff34231 + 10f7cba commit fece3b4
Show file tree
Hide file tree
Showing 138 changed files with 1,791 additions and 427 deletions.
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ gem 'rails-i18n' # Locales par défaut
gem 'rake-progressbar', require: false
gem 'redcarpet'
gem 'rexml' # add missing gem due to ruby3 (https://github.com/Shopify/bootsnap/issues/325)
gem 'rgeo-geojson'
gem 'rqrcode'
gem 'saml_idp'
gem 'sanitize-url'
Expand Down
4 changes: 0 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -592,9 +592,6 @@ GEM
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.2.5)
rgeo (2.2.0)
rgeo-geojson (2.1.1)
rgeo (>= 1.0.0)
rodf (1.1.1)
builder (>= 3.0)
dry-inflector (~> 0.1)
Expand Down Expand Up @@ -918,7 +915,6 @@ DEPENDENCIES
rake-progressbar
redcarpet
rexml
rgeo-geojson
rqrcode
rspec-rails
rspec_junit_formatter
Expand Down
4 changes: 4 additions & 0 deletions app/assets/stylesheets/02_utils.scss
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@
visibility: visible;
}

.no-wrap {
white-space: nowrap;
}

// sizing
.width-100 {
width: 100%;
Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
color: $dark-grey;
}


.mandatory {
color: $dark-red;
}
Expand Down
4 changes: 4 additions & 0 deletions app/assets/stylesheets/icons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,8 @@
&.move-handle {
background-image: image-url("icons/move-handle.svg");
}

&.mandatory {
width: 10px;
}
}
10 changes: 10 additions & 0 deletions app/assets/stylesheets/menu_component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@import "colors";

.menu-component-header {
color: $dark-grey;
font-size: 12px;

a {
text-decoration: underline;
}
}
24 changes: 0 additions & 24 deletions app/assets/stylesheets/procedure_context.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,6 @@ $procedure-context-breakpoint: $two-columns-breakpoint;
font-size: 12px;
}

.procedure-configuration--auto-archive {
cursor: pointer;

summary {
font-size: 20px;

// Hide the default triangle details marker
list-style: none;
// (using the non-standard way for Chrome.)
&::-webkit-details-marker {
display: none;
}
}

p {
padding-top: 8px;
font-size: 16px;
}
}

.procedure-auto-archive-title {
border-bottom: 1px dotted $blue-france-500;
}

.procedure-logos {
display: flex;
justify-content: space-around;
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/procedure_form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
.procedure-form__options-summary {
cursor: pointer;

.header-subsection {
h3 {
display: inline-block;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
en:
virus_not_analyzed: this file has not been scanned by our antivirus, download it with care
errors:
virus_infected: Virus detected, download is blocked.
corrupted_file: The file is corrupted, the download is blocked.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
fr:
virus_not_analyzed: ce fichier n’a pas été analysé par notre antivirus, téléchargez-le avec précaution
errors:
virus_infected: "Virus détecté, le téléchargement est bloqué."
corrupted_file: "Le fichier est corrompu, le téléchargement est bloqué."
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
%div{ id: dom_id(attachment, :show), class: class_names("attachment-error": error?, "fr-mb-2w": !should_display_link?) }
- if should_display_link?
= render Dsfr::DownloadComponent.new(attachment: attachment, new_tab: new_tab) do |c|
- if !attachment.virus_scanner.started?
- c.right do
= "(#{t(".virus_not_analyzed")})"
= render Dsfr::DownloadComponent.new(attachment: attachment, virus_not_analyzed: !attachment.virus_scanner.started?, new_tab: new_tab)
- else
.attachment-filename.fr-mb-1w.fr-mr-1w= attachment.filename.to_s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fr:
one: 1 dossier sera repassé en construction
other: "%{success_count}/%{count} dossiers ont été repassés en construction"
title:
finish: L'action de masse est terminée
finish: Laction de masse est terminée
in_progress: Une action de masse est en cours
link_text: Recharger la page
after_link_text: pour voir si l'opération est finie.
Expand Down
2 changes: 2 additions & 0 deletions app/components/dossiers/export_component.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class Dossiers::ExportComponent < ApplicationComponent
include ApplicationHelper

def initialize(procedure:, exports:, statut: nil, count: nil, class_btn: nil, export_url: nil)
@procedure = procedure
@exports = exports
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ en:
download:
one: Download a file
other: Download %{count} files
macros_doc:
title: "Macros documentation"
url: "https://doc.demarches-simplifiees.fr/pour-aller-plus-loin/exports-et-macros"
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ fr:
download:
one: Télécharger un dossier
other: Télécharger %{count} dossiers
macros_doc:
title: "documentation sur les macros"
url: "https://doc.demarches-simplifiees.fr/pour-aller-plus-loin/exports-et-macros"
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
= render Dropdown::MenuComponent.new(wrapper: :span, button_options: { class: ['fr-btn--sm', @class_btn.present? ? @class_btn : 'fr-btn--secondary']}, menu_options: { id: @count.nil? ? "download_menu" : "download_all_menu", class: ['dropdown-export'] }) do |menu|
- menu.with_menu_header_html do
%p.menu-component-header.fr-px-2w.fr-pt-2w.fr-mb-0
%span.fr-icon-info-line{ aria: { hidden: true } }
Des macros ? Lisez la
= link_to('doc', t('.macros_doc.url'),
title: t('.macros_doc.title'),
**external_link_attributes)

- menu.with_button_inner_html do
= @count.nil? ? t(".download_all") : t(".download", count: @count)
- exports.each do |item|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- if editing
= link_to '#', data: { action: 'geo-area#onClick' } do
= geo_area.label
= text_field_tag :description, geo_area.description, data: { action: 'focus->geo-area#onFocus input->geo-area#onInput', geo_area_target: 'description' }, placeholder: 'Description', class: 'no-margin'
= text_field_tag :description, geo_area.description, data: { action: 'focus->geo-area#onFocus input->geo-area#onInput', geo_area_target: 'description' }, placeholder: 'Description', class: 'no-margin', id: "geo_area_#{geo_area.id}_description"
- else
= link_to '#', data: { action: 'geo-area#onClick' } do
= geo_area.label
Expand Down
7 changes: 7 additions & 0 deletions app/components/dossiers/geo_area_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Dossiers::GeoAreaComponent < ApplicationComponent
attr_reader :geo_area, :editing

def initialize(geo_area:, editing:)
@geo_area, @editing = geo_area, editing
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.areas
%ul
- champ.selections_utilisateur.slice(0, 20).each do |geo_area|
= render partial: 'shared/champs/carte/geo_area', locals: { geo_area: geo_area, editing: editing }
= render Dossiers::GeoAreaComponent.new(geo_area:, editing:)
- if champ.selections_utilisateur.size > 20
%li
%span
Expand All @@ -14,4 +14,4 @@
.areas
%ul
- champ.cadastres.each do |geo_area|
= render partial: 'shared/champs/carte/geo_area', locals: { geo_area: geo_area, editing: editing }
= render Dossiers::GeoAreaComponent.new(geo_area:, editing:)
7 changes: 7 additions & 0 deletions app/components/dossiers/geo_areas_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Dossiers::GeoAreasComponent < ApplicationComponent
attr_reader :champ, :editing

def initialize(champ:, editing:)
@champ, @editing = champ, editing
end
end
2 changes: 1 addition & 1 deletion app/components/dossiers/message_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ def commentaire_date
end

def highlight?
commentaire.created_at.present? && @messagerie_seen_at&.<(commentaire.created_at)
commentaire.persisted? && @messagerie_seen_at&.<(commentaire.created_at)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ fr:
legend:
states: États
created_at: Date de création
depose_at: Date de dépot
depose_at: Date de dépôt
button:
apply_filters: Appliquer les filtres
reset_filters: Réinitialiser les filtres
Expand Down
1 change: 1 addition & 0 deletions app/components/dropdown/menu_component.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class Dropdown::MenuComponent < ApplicationComponent
renders_one :button_inner_html
renders_one :menu_header_html
# beware, items elements like button_to/link_to must include role: 'menuitem' for aria reason
renders_many :items, -> (options = {}, &block) do
tag.li(**options.merge(role: 'none'), &block)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
= button_inner_html
%div{ data: { menu_button_target: 'menu' }, id: menu_id, 'aria-labelledby': button_id, role: menu_role, 'tab-index': -1, class: menu_class_names }
= menu_header_html
-# the dropdown can be a menu with a list of item
- if items?
Expand Down
8 changes: 5 additions & 3 deletions app/components/dsfr/download_component.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
class Dsfr::DownloadComponent < ApplicationComponent
renders_one :right

attr_reader :attachment
attr_reader :html_class
attr_reader :name
attr_reader :ephemeral_link
attr_reader :virus_not_analyzed
attr_reader :new_tab

def initialize(attachment:, name: nil, url: nil, new_tab: false)
def initialize(attachment:, name: nil, url: nil, ephemeral_link: false, virus_not_analyzed: false, new_tab: false)
@attachment = attachment
@name = name || attachment.filename.to_s
@url = url
@ephemeral_link = ephemeral_link
@virus_not_analyzed = virus_not_analyzed
@new_tab = new_tab
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
en:
title: "Download file %{filename}"
ephemeral_link: This link is ephemeral and should not be shared.
virus_not_analyzed: this file has not been scanned by our antivirus, download it with care
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
fr:
title: "Télécharger le fichier %{filename}"
ephemeral_link: Ce lien est éphémère et ne devrait pas être partagé.
virus_not_analyzed: ce fichier n’a pas été analysé par notre antivirus, téléchargez-le avec précaution
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,11 @@
= name
%span.fr-download__detail
= helpers.download_details(attachment)
- if ephemeral_link
%span.fr-ml-2w.fr-text--xs.fr-text-mention--grey
%span.fr-icon-questionnaire-line{ "aria-hidden": "true" }
= t('.ephemeral_link')
= right
- if virus_not_analyzed
.fr-text--xs.fr-text-mention--grey
= t('.virus_not_analyzed')
3 changes: 0 additions & 3 deletions app/components/dsfr/input_component/input_component.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
= @form.label @attribute, label_opts do
- capture do
= label
- if @required
%span.mandatory  *
- if hint?
%span.fr-hint-text= hint

= @form.public_send(@input_type, @attribute, input_opts)

- if errors_on_attribute?
Expand Down
2 changes: 2 additions & 0 deletions app/components/editable_champ/asterisk_mandatory_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class EditableChamp::AsteriskMandatoryComponent < ApplicationComponent
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
en:
required: required
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fr:
required: obligatoire
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
%svg.icon.mandatory{ xmlns: "http://www.w3.org/2000/svg", role: "img", 'aria-label': t('.required'), width: 10, height: 10, viewBox: "0 0 1200 1200", "xml:space" => "preserve" }
%desc= t('.required')
%path{ d: "M489.838 29.354v443.603L68.032 335.894 0 545.285l421.829 137.086-260.743 358.876 178.219 129.398L600.048 811.84l260.673 358.806 178.146-129.398-260.766-358.783L1200 545.379l-68.032-209.403-421.899 137.07V29.443H489.84l-.002-.089z" }
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
autocompleteScreenReaderInstructions: t("combo_search_component.screen_reader_instructions"))

.geo-areas{ id: dom_id(@champ, :geo_areas) }
= render partial: 'shared/champs/carte/geo_areas', locals: { champ: @champ, editing: true }
= render Dossiers::GeoAreasComponent.new(champ: @champ, editing: true)
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ en:
changes_to_save: "modifications to submit"
modified_at: "modified on %{datetime}"
check_content_rebased: The type of this field or its description has been modified by the administration. Check its content.
optional_champ: (optional)
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ fr:
changes_to_save: "modification à déposer"
modified_at: "modifié le %{datetime}"
check_content_rebased: Le type de ce champ ou sa description ont été modifiés par l'administration. Vérifier son contenu.
optional_champ: (facultatif)
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#{@champ.libelle}
- if @champ.mandatory?
%span.mandatory *
= @champ.libelle
- if @champ.mandatory? && @champ.type_champ != "checkbox"
= render EditableChamp::AsteriskMandatoryComponent.new
- elsif [email protected]?
= "#{t('.optional_champ')}"

- if @champ.forked_with_changes?
%span.updated-at.highlighted
Expand All @@ -9,6 +11,7 @@
%span.updated-at{ class: highlight_if_unseen_class }
= t('.modified_at', datetime: try_format_datetime(@champ.updated_at))


- if @champ.rebased_at.present? && @champ.rebased_at > (@seen_at || @champ.updated_at) && current_user.owns_or_invite?(@champ.dossier)
%span.updated-at.highlighted
= t('.check_content_rebased')
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= @form.check_box :value,
{ required: @champ.required?, id: @champ.input_id, checked: @champ.true?, aria: { describedby: @champ.describedby_id } },
{ required: @champ.required?, id: @champ.input_id, checked: @champ.true?, aria: { describedby: @champ.describedby_id }, class: class_names('required' => @champ.required?)},
'true',
'false'
6 changes: 5 additions & 1 deletion app/components/editable_champ/editable_champ_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def html_options
end

def stimulus_controller
if !@champ.block? && @champ.fillable?
if autosave_enabled?
# This is an editable champ. Lets find what controllers it might need.
controllers = ['autosave']

Expand All @@ -45,4 +45,8 @@ def data_dependent_conditions
{}
end
end

def autosave_enabled?
!@champ.carte? && !@champ.block? && @champ.fillable?
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- else
%div{ 'data-turbo-focus-group': true }
- if @champ.selected_options.present?
.fr-mb-2w{ "data-turbo": "true" }
.fr-mb-2w
- @champ.selected_options.each do |option|
= render NestedForms::OwnedButtonComponent.new(formaction: champs_options_path(@champ.id, option:), http_method: :delete, opt: { class: 'fr-tag fr-tag--dismiss fr-mb-1w fr-mr-1w', id: @champ.checkbox_id(option) }) do
= option
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
- @champ.rows.each do |champs|
= render EditableChamp::RepetitionRowComponent.new(form: @form, champ: @champ, row: champs, seen_at: @seen_at)

.actions{ 'data-turbo': 'true' }
.actions
= render NestedForms::OwnedButtonComponent.new(formaction: champs_repetition_path(@champ.id), http_method: :create, opt: { class: "fr-btn fr-btn--secondary fr-btn--icon-left fr-icon-add-circle-line fr-mb-3w", title: t(".add_title", libelle: @champ.libelle), id: dom_id(@champ, :create_repetition)}) do
= t(".add", libelle: @champ.libelle)
Loading

0 comments on commit fece3b4

Please sign in to comment.