ez-resources 0.2.1 → 0.2.3
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 +4 -4
- data/app/cells/ez/resources/collection/table.slim +1 -1
- data/app/cells/ez/resources/collection_cell.rb +4 -0
- data/app/cells/ez/resources/search/show.slim +15 -6
- data/app/cells/ez/resources/search_cell.rb +6 -2
- data/lib/ez/resources/manager/field.rb +2 -0
- data/lib/ez/resources/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a317ea72d6485a3d0e87da7a1eac6e6cf86247e51cbbba211ffff43ef90fac1
|
4
|
+
data.tar.gz: 9640c94a71e4928409229f0c1fb719bcb769e46856a972088f8443d5609ad856
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
@@ -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
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
|
@@ -26,7 +26,7 @@ module Ez
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def field_label(field)
|
29
|
-
"#{field.title} (#{t "search.suffix.#{field.search_suffix}"})"
|
29
|
+
field.search_label || "#{field.title} (#{t "search.suffix.#{field.search_suffix}"})"
|
30
30
|
end
|
31
31
|
|
32
32
|
private
|
@@ -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
|
@@ -20,6 +20,7 @@ module Ez
|
|
20
20
|
:searchable,
|
21
21
|
:sortable,
|
22
22
|
:search_suffix,
|
23
|
+
:search_label,
|
23
24
|
:options
|
24
25
|
|
25
26
|
def initialize(options = {})
|
@@ -38,6 +39,7 @@ module Ez
|
|
38
39
|
@searchable = options.delete(:searchable) != false
|
39
40
|
@sortable = options.delete(:sortable) || false
|
40
41
|
@search_suffix = options.delete(:search_suffix) || :cont
|
42
|
+
@search_label = options.delete(:search_label)
|
41
43
|
@options = options # use for all other custom options
|
42
44
|
end
|
43
45
|
|
data/lib/ez/resources/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2023-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cells-rails
|