-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tech(refactor): procedure::error_summary and dossier::ErrorsFullMessa…
…gesComponent use same behaviour to compact/expand errors
- Loading branch information
Showing
16 changed files
with
115 additions
and
78 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
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
17 changes: 3 additions & 14 deletions
17
...mponents/dossiers/errors_full_messages_component/errors_full_messages_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,4 @@ | ||
.fr-alert.fr-alert--error.fr-mb-3w{ role: "alertdialog" } | ||
- dedup_and_partitioned_errors do |head, tail| | ||
%p#sumup-errors= t('.sumup_html', count: head.size + tail.size, url: head.first.anchor) | ||
%ul.fr-mb-0#head-errors | ||
- head.each do |error_descriptor| | ||
%li | ||
= link_to error_descriptor.label, error_descriptor.anchor, class: 'error-anchor' | ||
= error_descriptor.error_message | ||
- if tail.size > 0 | ||
%button{ type: "button", "aria-controls": 'tail-errors', "aria-expanded": "false", class: "fr-btn fr-btn--sm fr-btn--tertiary-no-outline" }= t('.see_more') | ||
%ul#tail-errors.fr-collapse.fr-mt-0 | ||
- tail.each do |error_descriptor| | ||
%li | ||
= link_to error_descriptor.label, error_descriptor.anchor, class: 'error-anchor' | ||
= "(#{error_descriptor.error_message})" | ||
- if dedup_and_partitioned_errors.size > 0 | ||
%p#sumup-errors= t('.sumup_html', count: dedup_and_partitioned_errors.size, url: dedup_and_partitioned_errors.first.anchor) | ||
= render ExpandableErrorList.new(errors: dedup_and_partitioned_errors) |
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,9 @@ | ||
class ExpandableErrorList < ApplicationComponent | ||
def initialize(errors:) | ||
@errors = errors | ||
end | ||
|
||
def splitted_errors | ||
yield(Array(@errors[0..2]), Array(@errors[3..])) | ||
end | ||
end |
3 changes: 3 additions & 0 deletions
3
app/components/expandable_error_list/expandable_error_list.html.en.yml
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,3 @@ | ||
--- | ||
en: | ||
see_more: Show all errors |
3 changes: 3 additions & 0 deletions
3
app/components/expandable_error_list/expandable_error_list.html.fr.yml
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,3 @@ | ||
--- | ||
fr: | ||
see_more: Afficher toutes les erreurs |
14 changes: 14 additions & 0 deletions
14
app/components/expandable_error_list/expandable_error_list.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
- splitted_errors do |head, tail| | ||
%ul#head-errors.fr-mb-0 | ||
- head.each do |error_descriptor| | ||
%li | ||
= link_to error_descriptor.label, error_descriptor.anchor, class: 'error-anchor' | ||
= error_descriptor.error_message | ||
|
||
- if tail.size > 0 | ||
%button.fr-mt-0.fr-btn.fr-btn--sm.fr-btn--tertiary-no-outline{ type: "button", "aria-controls": 'tail-errors', "aria-expanded": "false", class: "" }= t('see_more') | ||
%ul#tail-errors.fr-collapse.fr-mt-0 | ||
- tail.each do |error_descriptor| | ||
%li | ||
= link_to error_descriptor.label, error_descriptor.anchor, class: 'error-anchor' | ||
= error_descriptor.error_message |
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
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