1
0
mirror of https://github.com/danog/yawarehouse.git synced 2025-01-06 04:58:35 +01:00
yawarehouse/app/views/sections/index.html.erb
2018-05-27 12:34:07 +02:00

23 lines
1.0 KiB
Plaintext

<h1>Warehouse</h1>
<hr>
<%= form_with url: sections_path, method: :get, local: true do |form|%>
<%= form.label :"Show only sections with more than:" %>
<%= form.number_field :count, onchange: "this.form.submit();", value: params[:count] %>
<%= "product".pluralize(params.has_key?(:count) ? Integer(params[:count]) : 0) %>.
<% end %>
<hr>
<ul>
<li><%= link_to 'New section', new_section_path %><br><br></li>
<% @sections.each do |section| %>
<% if !params.has_key?(:count) || section.products.count > Integer(params[:count]) %>
<li>
ID: <%= section.id %> (<%= link_to 'Edit', edit_section_path(section.id) %> - <%= link_to 'Delete', section_path(section.id), method: :delete, data: { confirm: 'Are you sure?' } %>)<br>
Description: <%= section.description %><br>
<%= link_to pluralize(section.products.count, 'product'), section_products_path(section.id) %> (<%= link_to 'Add product', new_section_product_path(section.id) %>)
<br><br>
</li>
<% end %>
<% end %>
</ul>