katalyst-tables 3.3.2 → 3.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15f5912b36b82347b774b75d9339a7f41cff2c6d9973c51e8f5142fd829b7814
4
- data.tar.gz: da4fadb4364f0c2bf2d19a75a992ef7d00d912ca5c27d2d851fb96c32eaa7fbc
3
+ metadata.gz: 3d7d6dcd92a6643324d8dbc5cf4c94981dc44d4a1a9735cc9ea3fc3af7527ef3
4
+ data.tar.gz: 85a3f731c82146be98b237e3bfe79c8ee412629cf4115928b04ed8e701306be5
5
5
  SHA512:
6
- metadata.gz: 74661bd722d18e4fdac80a0979a2516b500b6ad4402d03a396ce53b3b6cee2edb5c2ad9aa70086969033189a3a4622cb4ddd907269670228fc1e2838d5973189
7
- data.tar.gz: 0262fadd6c9840db3a91575bb0ebfed71891abb00ecfcc6a73e0a87a8c666f7da85a5e60f26dc424f2e9388097812546b5900245d3f63377c524489b19272c5a
6
+ metadata.gz: 70b38e57a58ffb9d4bc1ba4d5044edd9624e90261e576b95a854aba4622fb9ed2e1b1b184643d244cfdb6647bb9509aa7e6402dd06a149bc32b6ad6ddc623883
7
+ data.tar.gz: c6d0d0810eaaf9b742789008375979f793953c979f0a8a1fbb436b84d06958cb0b24b9aecccb0070b5158f899858de252c63f5aeb72b97ffe038387cf04146af
@@ -3,6 +3,7 @@
3
3
  <%= form.text_field(
4
4
  name,
5
5
  type: :search,
6
+ placeholder:,
6
7
  autocomplete: "off",
7
8
  **html_attributes,
8
9
  ) %>
@@ -37,6 +37,10 @@ module Katalyst
37
37
 
38
38
  private
39
39
 
40
+ def placeholder
41
+ t("katalyst.tables.query.placeholder", name: collection.model_name.human.pluralize.downcase)
42
+ end
43
+
40
44
  def query_attribute
41
45
  collection.class.attribute_types.detect { |_, a| a.type == :query }&.first
42
46
  end
@@ -30,9 +30,9 @@ module Katalyst
30
30
 
31
31
  def examples_for(key)
32
32
  key = key.to_s
33
- values_method = "#{key.parameterize.underscore}_values"
34
- if respond_to?(values_method)
35
- public_send(values_method)
33
+ examples_method = "#{key.parameterize.underscore}_examples"
34
+ if respond_to?(examples_method)
35
+ public_send(examples_method)
36
36
  elsif @attributes.key?(key)
37
37
  @attributes[key].type.examples_for(unscoped_items, @attributes[key])
38
38
  end
@@ -1,6 +1,8 @@
1
1
  en:
2
2
  katalyst:
3
3
  tables:
4
+ query:
5
+ placeholder: "Filter %{name}"
4
6
  orderable:
5
7
  value:
6
8
  "⠿"
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "katalyst/tables/collection/type/helpers/extensions"
4
+
3
5
  module Katalyst
4
6
  module Tables
5
7
  module Collection
@@ -46,6 +46,8 @@ module Katalyst
46
46
 
47
47
  return unless model.attribute_types.has_key?(column)
48
48
 
49
+ column = model.arel_table[column]
50
+
49
51
  filter(scope, attribute)
50
52
  .group(column)
51
53
  .distinct
@@ -2,6 +2,22 @@
2
2
 
3
3
  require "active_model/type"
4
4
 
5
+ require "katalyst/tables/collection/type/helpers/delegate"
6
+ require "katalyst/tables/collection/type/helpers/extensions"
7
+ require "katalyst/tables/collection/type/helpers/multiple"
8
+ require "katalyst/tables/collection/type/helpers/range"
9
+
10
+ require "katalyst/tables/collection/type/value"
11
+
12
+ require "katalyst/tables/collection/type/boolean"
13
+ require "katalyst/tables/collection/type/date"
14
+ require "katalyst/tables/collection/type/enum"
15
+ require "katalyst/tables/collection/type/float"
16
+ require "katalyst/tables/collection/type/integer"
17
+ require "katalyst/tables/collection/type/query"
18
+ require "katalyst/tables/collection/type/search"
19
+ require "katalyst/tables/collection/type/string"
20
+
5
21
  module Katalyst
6
22
  module Tables
7
23
  module Collection
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Katalyst
4
+ module Tables
5
+ module Collection
6
+ extend ActiveSupport::Autoload
7
+
8
+ autoload :Type
9
+ end
10
+ end
11
+ end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_support"
4
+ require "active_support/rails"
3
5
  require "view_component"
4
6
  require "katalyst/html_attributes"
5
7
 
@@ -8,6 +10,10 @@ require_relative "tables/engine"
8
10
 
9
11
  module Katalyst
10
12
  module Tables
13
+ extend ActiveSupport::Autoload
14
+
15
+ autoload :Collection
16
+
11
17
  class Error < StandardError; end
12
18
 
13
19
  def self.config
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: katalyst-tables
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.2
4
+ version: 3.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katalyst Interactive
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-28 00:00:00.000000000 Z
11
+ date: 2024-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: katalyst-html-attributes
@@ -135,23 +135,24 @@ files:
135
135
  - app/models/katalyst/tables/collection/array.rb
136
136
  - app/models/katalyst/tables/collection/base.rb
137
137
  - app/models/katalyst/tables/collection/filter.rb
138
- - app/models/katalyst/tables/collection/type.rb
139
- - app/models/katalyst/tables/collection/type/boolean.rb
140
- - app/models/katalyst/tables/collection/type/date.rb
141
- - app/models/katalyst/tables/collection/type/enum.rb
142
- - app/models/katalyst/tables/collection/type/float.rb
143
- - app/models/katalyst/tables/collection/type/helpers/delegate.rb
144
- - app/models/katalyst/tables/collection/type/helpers/extensions.rb
145
- - app/models/katalyst/tables/collection/type/helpers/multiple.rb
146
- - app/models/katalyst/tables/collection/type/helpers/range.rb
147
- - app/models/katalyst/tables/collection/type/integer.rb
148
- - app/models/katalyst/tables/collection/type/query.rb
149
- - app/models/katalyst/tables/collection/type/search.rb
150
- - app/models/katalyst/tables/collection/type/string.rb
151
- - app/models/katalyst/tables/collection/type/value.rb
152
138
  - config/importmap.rb
153
139
  - config/locales/tables.en.yml
154
140
  - lib/katalyst/tables.rb
141
+ - lib/katalyst/tables/collection.rb
142
+ - lib/katalyst/tables/collection/type.rb
143
+ - lib/katalyst/tables/collection/type/boolean.rb
144
+ - lib/katalyst/tables/collection/type/date.rb
145
+ - lib/katalyst/tables/collection/type/enum.rb
146
+ - lib/katalyst/tables/collection/type/float.rb
147
+ - lib/katalyst/tables/collection/type/helpers/delegate.rb
148
+ - lib/katalyst/tables/collection/type/helpers/extensions.rb
149
+ - lib/katalyst/tables/collection/type/helpers/multiple.rb
150
+ - lib/katalyst/tables/collection/type/helpers/range.rb
151
+ - lib/katalyst/tables/collection/type/integer.rb
152
+ - lib/katalyst/tables/collection/type/query.rb
153
+ - lib/katalyst/tables/collection/type/search.rb
154
+ - lib/katalyst/tables/collection/type/string.rb
155
+ - lib/katalyst/tables/collection/type/value.rb
155
156
  - lib/katalyst/tables/config.rb
156
157
  - lib/katalyst/tables/engine.rb
157
158
  homepage: https://github.com/katalyst/tables