volontariat/voluntary

View on GitHub
app/views/products/_form.html.erb

Summary

Maintainability
Test Coverage
<%= simple_form_for(@product, url: @product.new_record? ? products_path : product_path(@product), html: {class: 'form-horizontal'}, wrapper: :horizontal_form) do |f| %>
  <%= render partial: 'shared/form/error_messages', locals: { resource: @product } %>

  <%= f.input :name %>  
  <%= f.input :text, as: :text, input_html: {style: 'width: 500px; height:300px;'} %>
  
  <div class="form-group string required">
    <label class="string required control-label col-sm-3 control-label">
      <abbr title="required">*</abbr> <%= t('areas.index.title') %>
    </label>
    <div class="col-sm-9">
  <% Area.all.each do |area| %>
      <label class="checkbox">
        <input class="check_boxes required" id="product_area_ids_<%=area.id%>" name="product[area_ids][]" 
        type="checkbox" value="<%=area.id%>"<%= @product.area_ids.include?(area.id) ? ' checked="checked"' : '' %>/>
        <%= link_to area.name, area %>
      </label>
  <% end %>
    </div>
  </div>  
  
  <div class="form-group">
    <div class="col-sm-offset-3 col-sm-9">
      <%= f.button :submit %>
    </div>
  </div>
<% end %>