snaptable 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6edfbac91d3d9a0930ebc3ed0d430a58b7c3851b
4
- data.tar.gz: d06c18668c831f9cf2ae3d8a0f5c63a03cd230a0
3
+ metadata.gz: a22442e1f0816b6884b6241596b11cd1d1280b98
4
+ data.tar.gz: e6bc598de7d2d5319fe02463382b86f73afd9faf
5
5
  SHA512:
6
- metadata.gz: d5706288fb9030274d7469d950e2b60a664a100e11523abf00132705bcff26952e2d9eb455f88732fd24b72e074f360397b6789face063d5ce8a502010cef9cd
7
- data.tar.gz: 1fa2661b90067c7ce758d8a7c2f146161191c56f6341105c750671263de8b6bc95b7077f54089ac0a5feca72e029f9898adc15a05c14f10e6b1397b8ce561c6b
6
+ metadata.gz: 9d9403fdf46902ba310d79f5fb908ad0c4b3d626e3722a6707f90c06a99a65715dc46814eea2897b5a34f700cab49d69239a3384ddf8f6a31869f9d8ec82dfbf
7
+ data.tar.gz: 892246813211c0a9afaf0f25c5505ae499a2aad8dc42dea6ed815d26f564d7b43a320254a7330d8e56444b2b8c3322b4e4ad628df79ca07827fc81707a16640d
@@ -2,6 +2,7 @@
2
2
  <p><%= t("table.search.title") %></p>
3
3
  <%= form_tag nil, method: :get, remote: true do %>
4
4
  <%= hidden_field_tag :table, presenter.table_name %>
5
+ <%= hidden_field_tag :buttons, presenter.instance_variable_get(:@buttons) %>
5
6
  <%= search_field_tag :query, params[:query] %>
6
7
  <%= submit_tag t("table.search.submit") %>
7
8
  <% end %>
@@ -12,7 +12,7 @@ module Snaptable
12
12
 
13
13
  def filter(collection)
14
14
  if options[:search] == true && !params[:query].blank?
15
- collection.joins(search_associations).where(query, query: "%#{params[:query]}%", id: params[:query].to_i)
15
+ collection.joins(search_associations).where(query, query: "%#{params[:query].downcase}%", id: params[:query].to_i)
16
16
  else
17
17
  collection
18
18
  end
@@ -23,7 +23,7 @@ module Snaptable
23
23
  def query
24
24
  query_fields.map do |key, values|
25
25
  values.map do |value|
26
- "#{key}.#{value} LIKE :query OR"
26
+ "LOWER(#{key}.#{value}) LIKE :query OR"
27
27
  end.join(" ")
28
28
  end.join(" ") + " #{column_name('id')} = :id"
29
29
  end
@@ -11,7 +11,7 @@ module Snaptable
11
11
  respond_to do |format|
12
12
  format.html
13
13
  format.js do
14
- render '/snaptable/sort', locals: { content: self.present(buttons: @buttons) }
14
+ render '/snaptable/sort', locals: { content: self.present(buttons: params[:buttons]) }
15
15
  end
16
16
  end
17
17
  end
@@ -4,7 +4,7 @@ module Snaptable
4
4
 
5
5
  def sortable(column)
6
6
  if model.reflect_on_association(column.gsub /_id/, '').nil?
7
- view_context.link_to({sort: column, direction: direction(column), query: params[:query], paginate_key => page, table: table_name}, {remote: true, class: css_class(column)}) do
7
+ view_context.link_to({sort: column, direction: direction(column), query: params[:query], paginate_key => page, table: table_name, buttons: @buttons}, {remote: true, class: css_class(column)}) do
8
8
  model.human_attribute_name(column)
9
9
  end
10
10
  else
@@ -1,3 +1,3 @@
1
1
  module Snaptable
2
- VERSION = "2.1.0"
2
+ VERSION = "2.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snaptable
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - khcr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-11 00:00:00.000000000 Z
11
+ date: 2018-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails