ez-resources 0.2.2 → 0.2.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: 47d29f29e01ad1b5f219ff7ab58bb7f6394179367b106726d7add1615fb7d25d
4
- data.tar.gz: 766c145a98f669b4b4210be7a4e054137d5056de10da89dc2d87328020b46e4c
3
+ metadata.gz: df9a053ecff5d70725db5d431e5d4c6300214d308bebd3aeb265cde0ff3207e1
4
+ data.tar.gz: 107c43e96b9e49bc05b3e42fcd2dd19fd026dca9cc4c7cc4de7b16d35f21e2eb
5
5
  SHA512:
6
- metadata.gz: 8ecfcbf112bc353e6b20ff08e6b5041db933b007f3c97d04c7ce8730698d35ca980cb631a5c9ba62d3ecac10c2f18ae7c42a511b3a9014ca7e6e49e26d21f99e
7
- data.tar.gz: 322224c6d06813aa0b16207ced31fdb81b885d5c1ecc1a16cc9a9c25bff4e7d3c918dcdc04ee479cae97656183624032075d9a0803cd324acdb4835d1a10290d
6
+ metadata.gz: '08f114b5587039d6a523376af6f2a479dc191a19579390150a24b136990e7254a688d3a0802413950e0279abb5317cb6bda48b3874d26998399267f5df8f9165'
7
+ data.tar.gz: 5c2a4346c8990a8df4116e15f8c48bcfbb6cb02620b01cff340c80f53ce523acb625e00322bc2242dc88cf3ccfd6a7ac932c9b7206e444532c2dc3503612fd60
@@ -33,7 +33,7 @@
33
33
  = edit_link(record)
34
34
  = remove_link(record)
35
35
  - model.collection_actions.each do |custom_action|
36
- = link_to t("actions.#{custom_action.name}"), custom_action.builder.call(controller, record), custom_action.options.merge(class: css_for('collection-table-td-action-item'))
36
+ = link_to custom_action_label(custom_action), custom_action.builder.call(controller, record), custom_action.options.merge(class: css_for('collection-table-td-action-item'))
37
37
 
38
38
  - if paginator && paginator.count > 20
39
39
  == pagination
@@ -56,6 +56,10 @@ module Ez
56
56
  end
57
57
  end
58
58
 
59
+ def custom_action_label(action)
60
+ action.options[:title] || t("actions.#{action.name}")
61
+ end
62
+
59
63
  def new_link
60
64
  return unless model.actions.include?(:new)
61
65
  return unless Manager::Hooks.can?(:can_create?, model)
@@ -7,12 +7,21 @@
7
7
  - model.collection_columns.each do |field|
8
8
  - if field.searchable && SEARCHABLE_FIELDS.include?(field.type)
9
9
  = div_for 'collection-search-panel-field'
10
- = f.input field_input_name(field),
11
- label: field_label(field),
12
- required: false,
13
- as: cast_field_type(field.type),
14
- collection: field.collection,
15
- include_blank: true
10
+ - if field.type == :checkboxes
11
+ = label_tag field.search_label
12
+ .checkboxes
13
+ - field.collection.each do |item|
14
+ .ui.checkbox
15
+ - checked = params.dig(:q, field.search_suffix) || []
16
+ = check_box_tag("q[#{field.search_suffix}][]", item.id, checked.include?(item.id.to_s), id: "checkbox-#{item.id}")
17
+ = label_tag item.id, item.name
18
+ - else
19
+ = f.input field_input_name(field),
20
+ label: field_label(field),
21
+ required: false,
22
+ as: cast_field_type(field.type),
23
+ collection: field.collection,
24
+ include_blank: true
16
25
 
17
26
  = f.submit t('actions.apply'), class: css_for('collection-search-panel-submit-button')
18
27
 
@@ -3,7 +3,7 @@
3
3
  module Ez
4
4
  module Resources
5
5
  class SearchCell < ApplicationCell
6
- SEARCHABLE_FIELDS = %i[string association select link boolean].freeze
6
+ SEARCHABLE_FIELDS = %i[string association select link boolean checkboxes].freeze
7
7
 
8
8
  form
9
9
 
@@ -38,6 +38,10 @@ module Ez
38
38
  def association?(field)
39
39
  field.type == :association && field.options[:association].present?
40
40
  end
41
+
42
+ def checked_checkbox
43
+ params.dig(:q, field.search_suffix) || []
44
+ end
41
45
  end
42
46
  end
43
47
  end
@@ -129,9 +129,9 @@ module Ez
129
129
  pagy, paginated_collection = pagy dsl_config.collection_query.call(search.result,
130
130
  controller)
131
131
  else
132
- pagy, paginated_collection = pagy search.result.includes(dsl_config.includes)
132
+ pagy, paginated_collection = pagy search.result.includes(dsl_config.includes),
133
+ items_param: :items
133
134
  end
134
-
135
135
  @paginator = pagy
136
136
  paginated_collection
137
137
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ez
4
4
  module Resources
5
- VERSION = '0.2.2'
5
+ VERSION = '0.2.4'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ez-resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Volodya Sveredyuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-08 00:00:00.000000000 Z
11
+ date: 2023-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cells-rails
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: pagy
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '4.3'
61
+ version: 6.0.4
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '4.3'
68
+ version: 6.0.4
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rails
71
71
  requirement: !ruby/object:Gem::Requirement