ez-resources 0.2.2 → 0.2.3

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: 0a317ea72d6485a3d0e87da7a1eac6e6cf86247e51cbbba211ffff43ef90fac1
4
+ data.tar.gz: 9640c94a71e4928409229f0c1fb719bcb769e46856a972088f8443d5609ad856
5
5
  SHA512:
6
- metadata.gz: 8ecfcbf112bc353e6b20ff08e6b5041db933b007f3c97d04c7ce8730698d35ca980cb631a5c9ba62d3ecac10c2f18ae7c42a511b3a9014ca7e6e49e26d21f99e
7
- data.tar.gz: 322224c6d06813aa0b16207ced31fdb81b885d5c1ecc1a16cc9a9c25bff4e7d3c918dcdc04ee479cae97656183624032075d9a0803cd324acdb4835d1a10290d
6
+ metadata.gz: b33cca2c20343a57a9462a6378d4469cbd41a0f35e13eb27370786e95c4d254180e49a7afa9a16b898d36b2f9517fb049cd5874ae653bec19b0b8de6e7c7f9ae
7
+ data.tar.gz: 80571b7351f5e7da1e068c816540a06f8599561d9fe5b6ec5378e8a1e8aabaed7120eda4b55f6220fa6b6d54933e961ebb1f80b916f2595b3afe16cca056f04c
@@ -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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ez
4
4
  module Resources
5
- VERSION = '0.2.2'
5
+ VERSION = '0.2.3'
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.3
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-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cells-rails