1
0

Added Ingredient visibility filter

Fixed index display (many? -> any? persisted)
This commit is contained in:
cryptogopher
2019-11-02 19:30:52 +01:00
parent 05c79782f5
commit 3294689cb4
8 changed files with 24 additions and 10 deletions

View File

@@ -1,21 +1,26 @@
<fieldset id="filters" class="collapsible">
<legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend>
<%= form_tag url, id: 'filters_form', method: :get, remote: true do %>
<table>
<table class="filter">
<tr>
<td style="width:100%;"></td>
<td>
<%= text_field_tag 'filters[name]', session[:filters][:name],
placeholder: 'name filter' %>
placeholder: 'name' %>
</td>
<td style="padding-left:8px;">
<td>
<%= select_tag 'filters[visibility]',
visibility_options(session[:filters][:visibility]),
:onchange => '$("#filters_form").submit(); return false;' %>
</td>
<td>
<%= link_to l(:button_apply), '#', :class => "icon icon-checked",
:onclick => '$("#filters_form").submit(); return false;' %>
</td>
<td style="padding-left:8px;">
<td>
<%= link_to l(:button_clear), '#', :class => "icon icon-reload",
:onclick => '$("#filters_form input").val(""); $("#filters_form").submit();
return false;' %>
:onclick => '$("#filters_form input, #filters_form select").val("");
$("#filters_form").submit(); return false;' %>
</td>
</tr>
</table>

View File

@@ -1,4 +1,4 @@
<% if @ingredients.many? %>
<% if @ingredients.any? { |i| i.persisted? } %>
<table class="list">
<thead>
<tr>

View File

@@ -1,4 +1,4 @@
<% if @quantities.many? %>
<% if @quantities.any? { |q| q.persisted? } %>
<table class="list">
<thead>
<tr>

View File

@@ -23,7 +23,7 @@
</div>
<h2><%= t ".heading" %></h2>
<% if @sources.many? %>
<% if @sources.any? { |s| s.persisted? } %>
<table class="list">
<thead>
<tr>

View File

@@ -23,7 +23,7 @@
</div>
<h2><%= t ".heading" %></h2>
<% if @units.many? %>
<% if @units.any? { |u| u.persisted? } %>
<table class="list">
<thead>
<tr>