app/views/decidim/forms/admin/questionnaires/_question.html.erb in decidim-forms-0.21.0 vs app/views/decidim/forms/admin/questionnaires/_question.html.erb in decidim-forms-0.22.0

- old
+ new

@@ -3,16 +3,25 @@ <div class="card questionnaire-question" id="<%= id %>-field"> <div class="card-divider question-divider"> <h2 class="card-title"> <span> <% if editable %> - <%== "#{icon("move")} #{t(".question")}" %> - <% else %> - <%= t(".question") %> + <%== icon("move") %> <% end %> + <%= dynamic_title(translated_attribute(question.body), class: "question-title-statement", max_length: 50, omission: "...", placeholder: t(".question")) %> </span> + <button type="button" class="button small secondary button--title question--collapse" data-toggle="<%= id %>-question-card button--collapse-question-<%= id %> button--expand-question-<%= id %>"> + <span id="button--collapse-question-<%= id %>" data-toggler=".hide" class="icon-collapse hide"> + <%== icon("caret-top", aria_label: t(".collapse"), role: "img") %> + </span> + + <span id="button--expand-question-<%= id %>" data-toggler=".hide" class="icon-expand"> + <%== icon("caret-bottom", aria_label: t(".expand"), role: "img") %> + </span> + </button> + <% if editable %> <button class="button small alert hollow move-up-question button--title"> <%== "#{icon("arrow-top")} #{t(".up")}" %> </button> @@ -25,11 +34,11 @@ </button> <% end %> </h2> </div> - <div class="card-section"> + <div class="card-section collapsible hide" data-toggler=".hide" id="<%= id %>-question-card"> <div class="row column"> <%= form.translated( :text_field, :body, @@ -79,11 +88,25 @@ <% end %> <%= form.hidden_field :position, value: question.position || 0, disabled: !editable %> <%= form.hidden_field :deleted, disabled: !editable %> - <div class="questionnaire-question-answer-options" data-template="<%= child_template_selector %>"> + <div class="questionnaire-question-matrix-rows" data-template="<%= matrix_row_template_selector %>"> + <div class="questionnaire-question-matrix-rows-list"> + <% question.matrix_rows.each do |matrix_row| %> + <%= fields_for "questionnaire[questions][#{question.to_param}][matrix_rows][]", matrix_row do |matrix_row_form| %> + <%= render "decidim/forms/admin/questionnaires/matrix_row", form: matrix_row_form, question: question, editable: editable %> + <% end %> + <% end %> + </div> + + <% if editable %> + <button class="button add-matrix-row"><%= t(".add_matrix_row") %></button> + <% end %> + </div> + + <div class="questionnaire-question-answer-options" data-template="<%= answer_option_template_selector %>"> <div class="questionnaire-question-answer-options-list"> <% question.answer_options.each do |answer_option| %> <%= fields_for "questionnaire[questions][#{question.to_param}][answer_options][]", answer_option do |answer_option_form| %> <%= render "decidim/forms/admin/questionnaires/answer_option", form: answer_option_form, question: question, editable: editable %> <% end %> @@ -98,10 +121,10 @@ <div class="row column questionnaire-question-max-choices"> <%= form.select( :max_choices, (2..question.number_of_options), - { prompt: t(".any") }, + { include_blank: t(".any") }, disabled: !editable ) %> </div> </div>