diff --git a/app/views/branded/guidance_groups/_index_by_theme.html.erb b/app/views/branded/guidance_groups/_index_by_theme.html.erb new file mode 100644 index 0000000..624c1f7 --- /dev/null +++ b/app/views/branded/guidance_groups/_index_by_theme.html.erb @@ -0,0 +1,57 @@ +<%# locals{ question, dataset, guidance_groups_by_theme } %> +<% parent_id = guidance_groups_by_theme.object_id %> +
+
+ +
+ <% guidance_groups_by_theme.each_pair do |guidance_group, theme_hash| %> + <% guidances_output = [] %> + <% theme_hash.each_pair do |theme, guidances| %> + <% question_guidance_id = "#{question.object_id}-#{guidances.object_id}-dataset-#{dataset.id}" %> + <%# if guidances with this theme have not been output %> + <% if (guidances.map(&:id) - guidances_output).any? %> +
+
" + aria-expanded="false" + aria-controls="<%= "##{question_guidance_id}" %>"> + +
+
" + class="panel-collapse collapse" + role="tabpanel" + aria-labelledby="<%= "panel-heading-#{question_guidance_id}" %>"> +
+ <% multiple = false %> + <% guidances.each do |guidance| %> + <% if multiple %> +
+ <% end %> +

+ <% unless guidances_output.include?(guidance.id) %> + <%= sanitize(guidance.text) %> + <% guidances_output << guidance.id %> + <% multiple = true %> + <% end %> +

+ <% end %> +
+
+
+ <% end %> + <% end %> + <% end %> +
diff --git a/app/views/branded/phases/_guidances_notes.html.erb b/app/views/branded/phases/_guidances_notes.html.erb index 6e7e6ac..6cb8045 100644 --- a/app/views/branded/phases/_guidances_notes.html.erb +++ b/app/views/branded/phases/_guidances_notes.html.erb @@ -63,7 +63,7 @@ <% end %> <% if tab[:groups].present? %> <%= render partial: 'guidance_groups/index_by_theme', - locals: { question: question, guidance_groups_by_theme: tab[:groups] } %> + locals: { question: question, dataset: dataset, guidance_groups_by_theme: tab[:groups] } %> <% end %>