amelioration(design): ETQ usager la cohabitation du design d'un form mi-DSFR, mi-DS n'est pas trop moche
amelioration(design): ETQ usager la cohabitation du design d'un form mi-DSFR, mi-DS n'est pas trop moche
This commit is contained in:
parent
e859665ea4
commit
c86c1efcb7
8 changed files with 19 additions and 25 deletions
|
@ -124,7 +124,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
&.editable-champ-checkbox {
|
&.editable-champ-checkbox {
|
||||||
p,
|
|
||||||
label {
|
label {
|
||||||
padding-left: 28px;
|
padding-left: 28px;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
|
@ -174,7 +173,7 @@
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
|
||||||
&:last-of-type {
|
&:last-of-type {
|
||||||
margin-bottom: $default-fields-spacer;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
|
@ -210,6 +209,7 @@
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.fr-label {
|
.fr-label {
|
||||||
// la description d'un champ peut contenir du markup (markdown->html),
|
// la description d'un champ peut contenir du markup (markdown->html),
|
||||||
// on herite donc la fontsize/mrgin/padding du fr-hint-text
|
// on herite donc la fontsize/mrgin/padding du fr-hint-text
|
||||||
|
@ -219,10 +219,12 @@
|
||||||
padding: inherit;
|
padding: inherit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=password],
|
input[type=password],
|
||||||
select {
|
select {
|
||||||
display: block;
|
display: block;
|
||||||
margin-bottom: $default-fields-spacer;
|
margin-bottom: $default-fields-spacer;
|
||||||
|
margin-bottom: 0;
|
||||||
|
|
||||||
&.small-margin {
|
&.small-margin {
|
||||||
margin-bottom: $default-spacer;
|
margin-bottom: $default-spacer;
|
||||||
|
@ -347,7 +349,7 @@
|
||||||
|
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
margin-bottom: $default-fields-spacer;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
[data-reach-combobox-input] {
|
[data-reach-combobox-input] {
|
||||||
|
@ -529,12 +531,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[data-react-component-value]:not([data-react-component-value^="ComboMultiple"]) {
|
|
||||||
[data-reach-combobox-input]:not(.no-margin) {
|
|
||||||
margin-bottom: $default-fields-spacer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[data-react-component-value^="ComboMultiple"] {
|
[data-react-component-value^="ComboMultiple"] {
|
||||||
margin-bottom: $default-fields-spacer;
|
margin-bottom: $default-fields-spacer;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.attachment.fr-upload-group{ { id: attachment ? dom_id(attachment, :edit) : nil, class: class_names("fr-mb-2w": !(as_multiple? && downloadable?)) }.compact, **replace_controller_attributes }
|
.attachment.fr-upload-group{ { id: attachment ? dom_id(attachment, :edit) : nil, class: class_names("fr-mb-1w": !(as_multiple? && downloadable?)) }.compact, **replace_controller_attributes }
|
||||||
- if persisted?
|
- if persisted?
|
||||||
%div{ id: dom_id(attachment, :persisted_row) }
|
%div{ id: dom_id(attachment, :persisted_row) }
|
||||||
.flex.flex-gap-2{ class: class_names("attachment-error": attachment.virus_scanner_error?) }
|
.flex.flex-gap-2{ class: class_names("attachment-error": attachment.virus_scanner_error?) }
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
.fr-mb-4w.attachment-multiple{ class: class_names("fr-downloads-group": view_as == :download, "destroyable": user_can_destroy?), **replace_controller_attributes }
|
.attachment-multiple{ class: class_names("fr-downloads-group": view_as == :download, "destroyable": user_can_destroy?), **replace_controller_attributes }
|
||||||
= template
|
= template
|
||||||
|
|
||||||
%ul
|
- if @attachments.size >= 1
|
||||||
- each_attachment do |attachment, index|
|
%ul.fr-my-1v
|
||||||
%li{ id: dom_id(attachment) }
|
- each_attachment do |attachment, index|
|
||||||
= render Attachment::EditComponent.new(champ:, attached_file:, attachment:, index:, as_multiple: true, view_as:, user_can_destroy:, user_can_replace:, form_object_name:)
|
%li{ id: dom_id(attachment) }
|
||||||
|
= render Attachment::EditComponent.new(champ:, attached_file:, attachment:, index:, as_multiple: true, view_as:, user_can_destroy:, user_can_replace:, form_object_name:)
|
||||||
|
|
||||||
%div{ id: empty_component_id, class: class_names("hidden": !can_attach_next?) }
|
%div{ id: empty_component_id, class: class_names("hidden": !can_attach_next?) }
|
||||||
= render Attachment::EditComponent.new(champ:, attached_file:, attachment: nil, index: attachments_count, user_can_destroy:, user_can_replace:, form_object_name:)
|
= render Attachment::EditComponent.new(champ:, attached_file:, attachment: nil, index: attachments_count, user_can_destroy:, user_can_replace:, form_object_name:)
|
||||||
|
|
|
@ -49,7 +49,6 @@ class Dsfr::InputComponent < ApplicationComponent
|
||||||
object.class.human_attribute_name(@attribute)
|
object.class.human_attribute_name(@attribute)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# kind of input helpers
|
# kind of input helpers
|
||||||
def password?
|
def password?
|
||||||
@input_type == :password_field
|
@input_type == :password_field
|
||||||
|
@ -64,6 +63,4 @@ class Dsfr::InputComponent < ApplicationComponent
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -68,7 +68,7 @@ module Dsfr
|
||||||
end
|
end
|
||||||
|
|
||||||
def describedby_id
|
def describedby_id
|
||||||
dom_id(@champ, :error_messages)
|
dom_id(@champ, :error_full_messages)
|
||||||
end
|
end
|
||||||
|
|
||||||
def errors_on_another_attribute?
|
def errors_on_another_attribute?
|
||||||
|
@ -80,7 +80,7 @@ module Dsfr
|
||||||
end
|
end
|
||||||
|
|
||||||
# errors helpers
|
# errors helpers
|
||||||
def error_messages
|
def error_full_messages
|
||||||
errors.full_messages_for(attribute_or_rich_body)
|
errors.full_messages_for(attribute_or_rich_body)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ class EditableChamp::EditableChampComponent < ApplicationComponent
|
||||||
'editable-champ': true,
|
'editable-champ': true,
|
||||||
"editable-champ-#{@champ.type_champ}": true,
|
"editable-champ-#{@champ.type_champ}": true,
|
||||||
"hidden": !@champ.visible?,
|
"hidden": !@champ.visible?,
|
||||||
"fr-input-group": true,
|
"fr-input-group": true
|
||||||
}.merge(input_group_error_class_names)
|
}.merge(input_group_error_class_names)
|
||||||
),
|
),
|
||||||
id: @champ.input_group_id,
|
id: @champ.input_group_id,
|
||||||
|
|
|
@ -4,12 +4,12 @@
|
||||||
= render component_class.new(form: @form, champ: @champ, seen_at: @seen_at)
|
= render component_class.new(form: @form, champ: @champ, seen_at: @seen_at)
|
||||||
|
|
||||||
- if errors_on_attribute?
|
- if errors_on_attribute?
|
||||||
- if error_messages.size == 1
|
- if error_full_messages.size == 1
|
||||||
%p.fr-error-text{ id: describedby_id }= error_messages.first
|
%p.fr-error-text{ id: describedby_id }= error_full_messages.first
|
||||||
- else
|
- else
|
||||||
.fr-error-text{ id: describedby_id }
|
.fr-error-text{ id: describedby_id }
|
||||||
%ul.list-style-type-none.fr-pl-0
|
%ul.list-style-type-none.fr-pl-0
|
||||||
- error_messages.map do |error_message|
|
- error_full_messages.each do |error_message|
|
||||||
%li= error_message
|
%li= error_message
|
||||||
|
|
||||||
= @form.hidden_field :id, value: @champ.id
|
= @form.hidden_field :id, value: @champ.id
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
= render EditableChamp::EditableChampComponent.new champ:, form:
|
= render EditableChamp::EditableChampComponent.new champ:, form:
|
||||||
- else
|
- else
|
||||||
= turbo_stream.update champ.labelledby_id do
|
= turbo_stream.update champ.labelledby_id do
|
||||||
= render EditableChamp::ChampLabelContentComponent.new champ:
|
= render EditableChamp::ChampLabelContentComponent.new champ:, form:
|
||||||
|
|
||||||
= turbo_stream.remove_all(".editable-champ .spinner-removable");
|
= turbo_stream.remove_all(".editable-champ .spinner-removable");
|
||||||
= turbo_stream.hide_all(".editable-champ .spinner");
|
= turbo_stream.hide_all(".editable-champ .spinner");
|
||||||
|
|
Loading…
Reference in a new issue