Sha256: 46d07ffb32435f98288f15a3b5bf2291894219ccc6c408aad549dce7fd66f072

Contents?: true

Size: 968 Bytes

Versions: 5

Compression:

Stored size: 968 Bytes

Contents

<%= simple_form_for ([@site, @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

5 entries across 5 versions & 1 rubygems

Version Path
cas-cms-1.0.0.alpha2 app/views/cas/sites/sections/contents/_form_for_survey.html.erb
cas-cms-1.0.0.alpha1 app/views/cas/sites/sections/contents/_form_for_survey.html.erb
cas-cms-0.1.3 app/views/cas/sites/sections/contents/_form_for_survey.html.erb
cas-cms-0.1.2 app/views/cas/sites/sections/contents/_form_for_survey.html.erb
cas-cms-0.1.1 app/views/cas/sites/sections/contents/_form_for_survey.html.erb