Sha256: af2f6217d290b7a672a5827a418830ea63fd9f7ebe9290388c296c78bceed6c3

Contents?: true

Size: 961 Bytes

Versions: 1

Compression:

Stored size: 961 Bytes

Contents

<%= simple_form_for ([@section, @content]) do |f| %>
  <p>
    <%= f.input :title, as: :string, label: 'Título:' %>
  </p>

  <% questions = @content.metadata.dig("survey", "questions") %>
  <%= simple_fields_for "content[metadata]" do |o| %>
    <% 4.times do |t| %>
      <%= o.input "survey][questions][#{t}][text",
        label: "Pergunta #{t+1}",
        required: (t == 0 ? true : false),
        input_html: {
          id: "question_#{t+1}_text",
          value: questions&.dig("#{t}", "text")
        } %>

      <%= o.input "survey][questions][#{t}][votes",
        as: :hidden,
        input_html: {
          id: "question_#{t+1}_votes",
          value: questions&.dig("#{t}", "votes") || 0
        } %>
    <% end %>
  <% end %>

  <p>
    <%= f.input :published,
      as: :boolean,
      label: 'Publicado?',
      input_html: { checked: true } %>
  </p>

  <div class="actions">
    <%= f.submit "Salvar", id: 'submit' %>
  </div>
<% end %>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cas-cms-0.1.0 app/views/cas/sections/contents/_form_for_survey.html.erb