Sha256: 0dd128c704a9bcc05c4270bb38f4292122a800adf4849afa3bb5487011ba8a7e

Contents?: true

Size: 1.95 KB

Versions: 4

Compression:

Stored size: 1.95 KB

Contents

<% field_id = "questionnaire_responses_#{answer_idx}" %>

<% if answer.question.separator? %>

  <%= render partial: "decidim/forms/questionnaires/answers/#{answer.question.question_type}", locals: { answer:, answer_form:, answer_idx:, field_id:, disabled: } %>
  <%= answer_form.hidden_field :question_id %>

<% elsif answer.question.title_and_description? %>

  <div class="answer-questionnaire__step-heading">
    <h3 class="h3"><%= translated_attribute(answer.question.body) %></h3>
    <% if translated_attribute(answer.question.description).present? %>
      <div>
        <%= decidim_sanitize_editor_admin translated_attribute(answer.question.description) %>
      </div>
    <% end %>
  </div>

  <%= render partial: "decidim/forms/questionnaires/answers/#{answer.question.question_type}", locals: { answer:, answer_form:, answer_idx:, field_id:, disabled: } %>
  <%= answer_form.hidden_field :question_id %>

<% else %>

  <div class="answer-questionnaire__question">
    <%= label_tag field_id, answer.label, class: "answer-questionnaire__question-label questionnaire-question", data: { "answer-idx": cleaned_answer_idx } %>
    <% if translated_attribute(answer.question.description).present? %>
      <div class="answer-questionnaire__question-description">
        <%= decidim_sanitize_editor_admin translated_attribute(answer.question.description) %>
      </div>
    <% end %>

    <% if answer.question.max_choices %>
      <small class="form-error max-choices-alert"><%= t(".max_choices_alert") %></small>
    <% end %>

    <% answer.errors.full_messages.each do |msg| %>
      <small class="form-error is-visible"><%= msg %></small>
    <% end %>

    <%= render partial: "decidim/forms/questionnaires/answers/#{answer.question.question_type}", locals: { answer:, answer_form:, answer_idx:, field_id:, disabled:, maxlength: (answer.question.max_characters if answer.question.max_characters.positive?) } %>
    <%= answer_form.hidden_field :question_id %>
  </div>

<% end %>

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-forms-0.28.1 app/views/decidim/forms/questionnaires/_answer.html.erb
decidim-forms-0.28.0 app/views/decidim/forms/questionnaires/_answer.html.erb
decidim-forms-0.28.0.rc5 app/views/decidim/forms/questionnaires/_answer.html.erb
decidim-forms-0.28.0.rc4 app/views/decidim/forms/questionnaires/_answer.html.erb