Improve help messages in SDG selector

Hopefully now it's a bit more obvious that SDGs can be selected by
clicking on them and that the field to select goals and the field to
select targets/goals are related (since they're now part of the same
fieldset).
This commit is contained in:
Javi Martín
2021-02-07 15:19:49 +01:00
parent 6ecb6757a6
commit ab2b3a2671
8 changed files with 30 additions and 17 deletions

View File

@@ -1,9 +1,9 @@
<div class="sdg-related-list-selector">
<div class="input-section">
<%= f.label :related_sdg_list %>
<fieldset class="sdg-related-list-selector">
<legend><%= t("sdg.related_list_selector.title") %></legend>
<div class="input-section">
<fieldset class="goals">
<legend><%= t("sdg.related_list_selector.goal_list") %></legend>
<legend><%= t("sdg.related_list_selector.goal_list", record: relatable_name) %></legend>
<%= f.collection_check_boxes(:sdg_goal_ids, goals, :id, :code) do |checkbox_form| %>
<%= goal_field(checkbox_form) %>
<% end %>
@@ -11,15 +11,14 @@
<%= f.text_field :related_sdg_list,
class: "input",
label: false,
placeholder: t("sdg.related_list_selector.placeholder"),
hint: t("sdg.related_list_selector.hint"),
label: t("sdg.related_list_selector.hint"),
data: { "suggestions-list": sdg_related_suggestions,
"remove-tag-text": t("sdg.related_list_selector.remove_tag") } %>
</div>
<div class="help-section callout primary hide">
<h3><%= t("sdg.related_list_selector.help.title", record: f.object.model_name.human) %></h3>
<h3><%= t("sdg.related_list_selector.help.title", record: relatable_name) %></h3>
<ul class="selected-info"></ul>
</div>
</div>
</fieldset>

View File

@@ -49,4 +49,8 @@ class SDG::RelatedListSelectorComponent < ApplicationComponent
goal_or_target.code
end
end
def relatable_name
f.object.model_name.human.downcase
end
end