Skip to content
Snippets Groups Projects
Forked from PortalMEC / portalmec
2492 commits behind the upstream repository.
_form.html.erb 2.21 KiB
<%= form_for(@learning_object) do |f| %>
    <% if @learning_object.errors.any? %>
        <div id="error_explanation">
          <h2><%= pluralize(@learning_object.errors.count, "error") %> prohibited this learning_object from being
            saved:</h2>

          <ul>
            <% @learning_object.errors.full_messages.each do |message| %>
                <li><%= message %></li>
            <% end %>
          </ul>
        </div>
    <% end %>

    <div class="row">
      <div class="col-md-12">

      </div>

      <div class="row">
        <div class="col-md-12">
          <fieldset>
            <legend>Envie seu objeto educacional</legend>
            <%= f.label :name, "Título" %>
            <%= f.text_field :name, class: "form-control" %> <br>

            <%= f.label :description, "Descreva seu objeto" %>
            <%= f.text_area :description, class: "form-control" %><br>

            <%= f.label :language, "Idioma do objeto" %>
            <%= f.text_field :language, class: "form-control" %><br>

            <%= f.label :author, "Autor" %>
            <%= f.text_field :author, class: "form-control" %><br>

            <%= f.label :type, "Tipo do objeto" %>
            <% @types.each do |type| %>
                <br><input type="radio" name="learning_object[type]" value="<%= type %>"> <%= type %>
            <% end %>
            <br><br>

            <%= f.label :subjects, "Assuntos (Selecione 1 ou mais assuntos)" %>
            <select id='subjectSelect' name="learning_object[subjects][]" multiple>
              <%= @subjects.each do |subject| %>
                  <option value='<%= subject %>'><%= subject %></option>
              <% end %>
            </select>
            <br><br>

            <%= f.label :school_level, "Nível Escolar" %><br>
            <select name="learning_object[school_level]">
              <%= @school_levels.each do |school_level| %>
                  <option value="<%= school_level %>"><%= school_level %></option>
              <% end %>
            </select>
            <br><br>
            <%= f.submit 'Criar Objeto' %>
          </fieldset>
        </div>
      </div>
    </div>

<% end %>
<script>
  $("#subjectSelect").select2({
    placeholder: "Assuntos"
  });
</script>