headmin 0.4.1 → 0.5.1
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/.lock-487e157d270f3062a98b7b2a012753708-1272821827 +0 -0
- data/CHANGELOG.md +16 -2
- data/Gemfile.lock +77 -79
- data/app/assets/javascripts/headmin/controllers/date_range_controller.js +12 -6
- data/app/assets/javascripts/headmin/controllers/filter_controller.js +61 -11
- data/app/assets/javascripts/headmin/controllers/filter_row_controller.js +50 -0
- data/app/assets/javascripts/headmin/controllers/flatpickr_controller.js +2 -6
- data/app/assets/javascripts/headmin/controllers/popup_controller.js +3 -1
- data/app/assets/javascripts/headmin/controllers/table_actions_controller.js +16 -21
- data/app/assets/javascripts/headmin/index.js +2 -0
- data/app/assets/javascripts/headmin.js +119 -38
- data/app/assets/stylesheets/headmin/filter.scss +74 -0
- data/app/assets/stylesheets/headmin/general.scss +0 -1
- data/app/assets/stylesheets/headmin/layout/body.scss +5 -0
- data/app/assets/stylesheets/headmin/popup.scss +0 -1
- data/app/assets/stylesheets/headmin/table.scss +7 -0
- data/app/assets/stylesheets/headmin.css +73 -2
- data/app/controllers/concerns/headmin/filterable.rb +27 -0
- data/app/models/concerns/headmin/field.rb +4 -2
- data/app/models/concerns/headmin/fieldable.rb +138 -44
- data/app/models/headmin/blocks_view.rb +1 -1
- data/app/models/headmin/filter/base.rb +238 -0
- data/app/models/headmin/filter/base_view.rb +64 -0
- data/app/models/headmin/filter/boolean.rb +15 -0
- data/app/models/headmin/filter/boolean_view.rb +61 -0
- data/app/models/headmin/filter/button_view.rb +25 -0
- data/app/models/headmin/filter/conditional_view.rb +16 -0
- data/app/models/headmin/filter/date.rb +19 -0
- data/app/models/headmin/filter/date_view.rb +52 -0
- data/app/models/headmin/filter/flatpickr_view.rb +54 -0
- data/app/models/headmin/filter/menu_item_view.rb +6 -0
- data/app/models/headmin/filter/money.rb +13 -0
- data/app/models/headmin/filter/number.rb +27 -0
- data/app/models/headmin/filter/number_view.rb +54 -0
- data/app/models/headmin/filter/operator_view.rb +30 -0
- data/app/models/headmin/filter/options_view.rb +61 -0
- data/app/models/headmin/filter/row_view.rb +13 -0
- data/app/models/headmin/filter/search.rb +18 -0
- data/app/models/headmin/filter/search_view.rb +31 -0
- data/app/models/headmin/filter/text.rb +25 -0
- data/app/models/headmin/filter/text_view.rb +53 -0
- data/app/models/headmin/filters.rb +29 -0
- data/app/models/headmin/form/color_view.rb +48 -0
- data/app/models/headmin/form/datetime_range_view.rb +25 -0
- data/app/models/headmin/form/datetime_view.rb +45 -0
- data/app/models/headmin/form/flatpickr_range_view.rb +4 -15
- data/app/models/headmin/form/flatpickr_view.rb +3 -12
- data/app/models/view_model.rb +1 -1
- data/app/views/examples/admin.html.erb +13 -13
- data/app/views/examples/auth.html.erb +1 -1
- data/app/views/headmin/_blocks.html.erb +1 -1
- data/app/views/headmin/_filters.html.erb +6 -6
- data/app/views/headmin/_form.html.erb +2 -2
- data/app/views/headmin/_index.html.erb +1 -1
- data/app/views/headmin/_pagination.html.erb +1 -1
- data/app/views/headmin/_popup.html.erb +2 -2
- data/app/views/headmin/_table.html.erb +1 -1
- data/app/views/headmin/dropdown/_devise.html.erb +8 -8
- data/app/views/headmin/dropdown/_locale.html.erb +4 -4
- data/app/views/headmin/filters/_base.html.erb +95 -0
- data/app/views/headmin/filters/_boolean.html.erb +23 -0
- data/app/views/headmin/filters/_date.html.erb +14 -38
- data/app/views/headmin/filters/_flatpickr.html.erb +15 -48
- data/app/views/headmin/filters/_number.html.erb +23 -0
- data/app/views/headmin/filters/_options.html.erb +24 -0
- data/app/views/headmin/filters/_search.html.erb +14 -12
- data/app/views/headmin/filters/_text.html.erb +23 -0
- data/app/views/headmin/filters/filter/_button.html.erb +9 -10
- data/app/views/headmin/filters/filter/_conditional.html.erb +18 -0
- data/app/views/headmin/filters/filter/_menu_item.html.erb +5 -2
- data/app/views/headmin/filters/filter/_null_select.html.erb +8 -0
- data/app/views/headmin/filters/filter/_operator.html.erb +16 -0
- data/app/views/headmin/filters/filter/_row.html.erb +11 -0
- data/app/views/headmin/forms/_blocks.html.erb +1 -1
- data/app/views/headmin/forms/_color.html.erb +32 -0
- data/app/views/headmin/forms/_date_range.html.erb +3 -3
- data/app/views/headmin/forms/_datetime.html.erb +41 -0
- data/app/views/headmin/forms/_datetime_range.html.erb +40 -0
- data/app/views/headmin/forms/_file.html.erb +3 -3
- data/app/views/headmin/forms/_flatpickr.html.erb +1 -1
- data/app/views/headmin/forms/_flatpickr_range.html.erb +3 -4
- data/app/views/headmin/forms/_label.html.erb +1 -1
- data/app/views/headmin/forms/_repeater.html.erb +12 -12
- data/app/views/headmin/forms/fields/_base.html.erb +1 -1
- data/app/views/headmin/forms/fields/_file.html.erb +3 -3
- data/app/views/headmin/forms/fields/_files.html.erb +17 -0
- data/app/views/headmin/forms/fields/_group.html.erb +5 -5
- data/app/views/headmin/forms/fields/_list.html.erb +4 -4
- data/app/views/headmin/forms/fields/_text.html.erb +2 -2
- data/app/views/headmin/layout/_footer.html.erb +1 -1
- data/app/views/headmin/layout/_main.html.erb +1 -1
- data/app/views/headmin/nav/_dropdown.html.erb +3 -3
- data/app/views/headmin/nav/_item.html.erb +2 -2
- data/app/views/headmin/nav/item/_devise.html.erb +8 -8
- data/app/views/headmin/nav/item/_locale.html.erb +4 -4
- data/app/views/headmin/table/_actions.html.erb +3 -6
- data/app/views/headmin/table/actions/_export.html.erb +1 -1
- data/app/views/headmin/table/body/_color.html.erb +10 -0
- data/app/views/headmin/table/body/_row.html.erb +3 -3
- data/app/views/headmin/table/foot/_id.html.erb +1 -1
- data/app/views/headmin/views/devise/confirmations/_new.html.erb +1 -1
- data/app/views/headmin/views/devise/passwords/_edit.html.erb +2 -2
- data/app/views/headmin/views/devise/passwords/_new.html.erb +1 -1
- data/app/views/headmin/views/devise/registrations/_edit.html.erb +4 -4
- data/app/views/headmin/views/devise/registrations/_new.html.erb +3 -3
- data/app/views/headmin/views/devise/sessions/_new.html.erb +3 -3
- data/app/views/headmin/views/devise/unlocks/_new.html.erb +1 -1
- data/config/locales/en.yml +4 -0
- data/config/locales/headmin/dropdown/en.yml +6 -0
- data/config/locales/headmin/dropdown/nl.yml +6 -0
- data/config/locales/headmin/filters/en.yml +26 -1
- data/config/locales/headmin/filters/nl.yml +26 -1
- data/config/locales/headmin/layout/en.yml +0 -9
- data/config/locales/headmin/layout/nl.yml +0 -9
- data/config/locales/headmin/nav/en.yml +7 -0
- data/config/locales/headmin/nav/nl.yml +7 -0
- data/config/locales/nl.yml +4 -0
- data/lib/generators/templates/views/layouts/auth.html.erb +1 -1
- data/lib/headmin/version.rb +1 -1
- data/package.json +1 -1
- metadata +47 -7
- data/app/controllers/concerns/headmin/filter.rb +0 -5
- data/app/controllers/concerns/headmin/searchable.rb +0 -15
- data/app/views/headmin/filters/_select.html.erb +0 -45
- data/app/views/headmin/filters/filter/_template.html.erb +0 -13
- data/app/views/headmin/forms/fields/_image.html.erb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a80387ee0e1dfc309d65f5e5eb450260dc84fda671904c3886eb50d2087c3eb
|
4
|
+
data.tar.gz: 98282252c395347dbb1c2490247c323649b4d282d1bc0d7a6bad32c51ec7ebfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c7271cbff3e46599c77506c07bdd0d0fc0d132bf7230202913a394b4b285f599c37866f52d28ff5d79b19ea59c754db7f25fab68bba71795e87d7d42139285a
|
7
|
+
data.tar.gz: 9900e4731b52d46486ea772433696774856b974d7bd2dc758628ce964c5d990296910c1a59a04990f5e509a5a1e341f3d9848d2043ad2ee2c14029c8096feae9
|
File without changes
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
# Headmin Changelog
|
2
2
|
|
3
|
-
##
|
3
|
+
## 0.5
|
4
|
+
- FEATURE: Filters now have support for operators and conditionals
|
5
|
+
- BREAK: `headmin/filters` now return a form object that is required for each individual form
|
6
|
+
- DEPRECATED: `Headmin::Searchable` is replaced with `Headmin::Filterable`.
|
7
|
+
- A `filter(params, types)` method is available and accepts an optional types argument.
|
8
|
+
- The `search()` method is now deprecated and no longer required
|
9
|
+
|
10
|
+
## 0.4.2
|
11
|
+
- FEATURE: New field type "files" to allow simple gallery creation
|
12
|
+
- FIX: Fields hash with duplicate keys no longer mix up
|
13
|
+
- BREAK: Image field is now deprecated. Use the file field instead
|
14
|
+
- BREAK: Field uses "has_many_attached :files" instead of "has_one_attache :file" now. Rename "file" to "files" in `active_storage_attachments`
|
15
|
+
- BREAK: You need to set a File object in the fields_hash, instead of creating an intermediate Blob instance
|
16
|
+
|
17
|
+
## 0.4
|
4
18
|
- FEATURE: Introduction of a `ViewModel` class to clean up the component views. This allows for a cleaner abstraction and better testing.
|
5
19
|
- FEATURE: New `wysiwyg` component which currently defaults to Redactor X. Redactor X will be swapped with a free open source version in the 1.0 release.
|
6
20
|
- FEATURE: `headmin/forms/redactorx` now accepts `hybrid: true` to hide the controls
|
@@ -15,7 +29,7 @@
|
|
15
29
|
- BREAK: `headmin/forms/actions` and all of its child components have been removed
|
16
30
|
- BREAK: `$font-weight-medium` has been removed from headmin overrides variables. We don't want to introduce new variable names that look like they are part of Bootstrap.
|
17
31
|
- BREAK: `headmin/forms/date_range` has a different way of setting attribute specific values. We now have a `:start` and `:end` attribute that accept all possible input options for their respective inputs. Both have a required `:attribute` parameter now.
|
18
|
-
|
32
|
+
- BREAK: filter concern (controllers) has been renamed to filterable
|
19
33
|
```erb
|
20
34
|
# Old
|
21
35
|
<%= render "headmin/forms/date_range", form: form, start_attribute: :start_date, end_attribute: :end_date %>
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
headmin (0.
|
4
|
+
headmin (0.5.1)
|
5
5
|
closure_tree (~> 7.4)
|
6
6
|
inline_svg (~> 1.7)
|
7
7
|
redcarpet (~> 3.5)
|
@@ -10,67 +10,67 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
actioncable (7.0.
|
14
|
-
actionpack (= 7.0.
|
15
|
-
activesupport (= 7.0.
|
13
|
+
actioncable (7.0.2.4)
|
14
|
+
actionpack (= 7.0.2.4)
|
15
|
+
activesupport (= 7.0.2.4)
|
16
16
|
nio4r (~> 2.0)
|
17
17
|
websocket-driver (>= 0.6.1)
|
18
|
-
actionmailbox (7.0.
|
19
|
-
actionpack (= 7.0.
|
20
|
-
activejob (= 7.0.
|
21
|
-
activerecord (= 7.0.
|
22
|
-
activestorage (= 7.0.
|
23
|
-
activesupport (= 7.0.
|
18
|
+
actionmailbox (7.0.2.4)
|
19
|
+
actionpack (= 7.0.2.4)
|
20
|
+
activejob (= 7.0.2.4)
|
21
|
+
activerecord (= 7.0.2.4)
|
22
|
+
activestorage (= 7.0.2.4)
|
23
|
+
activesupport (= 7.0.2.4)
|
24
24
|
mail (>= 2.7.1)
|
25
25
|
net-imap
|
26
26
|
net-pop
|
27
27
|
net-smtp
|
28
|
-
actionmailer (7.0.
|
29
|
-
actionpack (= 7.0.
|
30
|
-
actionview (= 7.0.
|
31
|
-
activejob (= 7.0.
|
32
|
-
activesupport (= 7.0.
|
28
|
+
actionmailer (7.0.2.4)
|
29
|
+
actionpack (= 7.0.2.4)
|
30
|
+
actionview (= 7.0.2.4)
|
31
|
+
activejob (= 7.0.2.4)
|
32
|
+
activesupport (= 7.0.2.4)
|
33
33
|
mail (~> 2.5, >= 2.5.4)
|
34
34
|
net-imap
|
35
35
|
net-pop
|
36
36
|
net-smtp
|
37
37
|
rails-dom-testing (~> 2.0)
|
38
|
-
actionpack (7.0.
|
39
|
-
actionview (= 7.0.
|
40
|
-
activesupport (= 7.0.
|
38
|
+
actionpack (7.0.2.4)
|
39
|
+
actionview (= 7.0.2.4)
|
40
|
+
activesupport (= 7.0.2.4)
|
41
41
|
rack (~> 2.0, >= 2.2.0)
|
42
42
|
rack-test (>= 0.6.3)
|
43
43
|
rails-dom-testing (~> 2.0)
|
44
44
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
45
|
-
actiontext (7.0.
|
46
|
-
actionpack (= 7.0.
|
47
|
-
activerecord (= 7.0.
|
48
|
-
activestorage (= 7.0.
|
49
|
-
activesupport (= 7.0.
|
45
|
+
actiontext (7.0.2.4)
|
46
|
+
actionpack (= 7.0.2.4)
|
47
|
+
activerecord (= 7.0.2.4)
|
48
|
+
activestorage (= 7.0.2.4)
|
49
|
+
activesupport (= 7.0.2.4)
|
50
50
|
globalid (>= 0.6.0)
|
51
51
|
nokogiri (>= 1.8.5)
|
52
|
-
actionview (7.0.
|
53
|
-
activesupport (= 7.0.
|
52
|
+
actionview (7.0.2.4)
|
53
|
+
activesupport (= 7.0.2.4)
|
54
54
|
builder (~> 3.1)
|
55
55
|
erubi (~> 1.4)
|
56
56
|
rails-dom-testing (~> 2.0)
|
57
57
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
58
|
-
activejob (7.0.
|
59
|
-
activesupport (= 7.0.
|
58
|
+
activejob (7.0.2.4)
|
59
|
+
activesupport (= 7.0.2.4)
|
60
60
|
globalid (>= 0.3.6)
|
61
|
-
activemodel (7.0.
|
62
|
-
activesupport (= 7.0.
|
63
|
-
activerecord (7.0.
|
64
|
-
activemodel (= 7.0.
|
65
|
-
activesupport (= 7.0.
|
66
|
-
activestorage (7.0.
|
67
|
-
actionpack (= 7.0.
|
68
|
-
activejob (= 7.0.
|
69
|
-
activerecord (= 7.0.
|
70
|
-
activesupport (= 7.0.
|
61
|
+
activemodel (7.0.2.4)
|
62
|
+
activesupport (= 7.0.2.4)
|
63
|
+
activerecord (7.0.2.4)
|
64
|
+
activemodel (= 7.0.2.4)
|
65
|
+
activesupport (= 7.0.2.4)
|
66
|
+
activestorage (7.0.2.4)
|
67
|
+
actionpack (= 7.0.2.4)
|
68
|
+
activejob (= 7.0.2.4)
|
69
|
+
activerecord (= 7.0.2.4)
|
70
|
+
activesupport (= 7.0.2.4)
|
71
71
|
marcel (~> 1.0)
|
72
72
|
mini_mime (>= 1.1.0)
|
73
|
-
activesupport (7.0.
|
73
|
+
activesupport (7.0.2.4)
|
74
74
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
75
75
|
i18n (>= 1.6, < 2)
|
76
76
|
minitest (>= 5.1)
|
@@ -91,25 +91,24 @@ GEM
|
|
91
91
|
closure_tree (7.4.0)
|
92
92
|
activerecord (>= 4.2.10)
|
93
93
|
with_advisory_lock (>= 4.0.0)
|
94
|
-
concurrent-ruby (1.1.
|
94
|
+
concurrent-ruby (1.1.10)
|
95
95
|
crass (1.0.6)
|
96
|
-
debug (1.
|
96
|
+
debug (1.5.0)
|
97
97
|
irb (>= 1.3.6)
|
98
98
|
reline (>= 0.2.7)
|
99
99
|
digest (3.1.0)
|
100
100
|
erubi (1.10.0)
|
101
101
|
globalid (1.0.0)
|
102
102
|
activesupport (>= 5.0)
|
103
|
-
i18n (1.
|
103
|
+
i18n (1.10.0)
|
104
104
|
concurrent-ruby (~> 1.0)
|
105
105
|
inline_svg (1.8.0)
|
106
106
|
activesupport (>= 3.0)
|
107
107
|
nokogiri (>= 1.6)
|
108
108
|
io-console (0.5.11)
|
109
|
-
io-wait (0.2.1)
|
110
109
|
irb (1.4.1)
|
111
110
|
reline (>= 0.3.0)
|
112
|
-
loofah (2.
|
111
|
+
loofah (2.16.0)
|
113
112
|
crass (~> 1.0.2)
|
114
113
|
nokogiri (>= 1.5.9)
|
115
114
|
mail (2.7.1)
|
@@ -118,7 +117,7 @@ GEM
|
|
118
117
|
matrix (0.4.2)
|
119
118
|
method_source (1.0.0)
|
120
119
|
mini_mime (1.1.2)
|
121
|
-
minitest (5.
|
120
|
+
minitest (5.15.0)
|
122
121
|
minitest-spec-rails (6.1.0)
|
123
122
|
minitest (>= 5.0)
|
124
123
|
railties (>= 4.1)
|
@@ -130,78 +129,77 @@ GEM
|
|
130
129
|
digest
|
131
130
|
net-protocol
|
132
131
|
timeout
|
133
|
-
net-protocol (0.1.
|
134
|
-
io-wait
|
132
|
+
net-protocol (0.1.3)
|
135
133
|
timeout
|
136
134
|
net-smtp (0.3.1)
|
137
135
|
digest
|
138
136
|
net-protocol
|
139
137
|
timeout
|
140
138
|
nio4r (2.5.8)
|
141
|
-
nokogiri (1.13.
|
139
|
+
nokogiri (1.13.4-arm64-darwin)
|
142
140
|
racc (~> 1.4)
|
143
|
-
nokogiri (1.13.
|
141
|
+
nokogiri (1.13.4-x86_64-darwin)
|
144
142
|
racc (~> 1.4)
|
145
|
-
nokogiri (1.13.
|
143
|
+
nokogiri (1.13.4-x86_64-linux)
|
146
144
|
racc (~> 1.4)
|
147
|
-
parallel (1.
|
148
|
-
parser (3.1.
|
145
|
+
parallel (1.22.1)
|
146
|
+
parser (3.1.2.0)
|
149
147
|
ast (~> 2.4.1)
|
150
|
-
public_suffix (4.0.
|
148
|
+
public_suffix (4.0.7)
|
151
149
|
racc (1.6.0)
|
152
150
|
rack (2.2.3)
|
153
151
|
rack-test (1.1.0)
|
154
152
|
rack (>= 1.0, < 3)
|
155
|
-
rails (7.0.
|
156
|
-
actioncable (= 7.0.
|
157
|
-
actionmailbox (= 7.0.
|
158
|
-
actionmailer (= 7.0.
|
159
|
-
actionpack (= 7.0.
|
160
|
-
actiontext (= 7.0.
|
161
|
-
actionview (= 7.0.
|
162
|
-
activejob (= 7.0.
|
163
|
-
activemodel (= 7.0.
|
164
|
-
activerecord (= 7.0.
|
165
|
-
activestorage (= 7.0.
|
166
|
-
activesupport (= 7.0.
|
153
|
+
rails (7.0.2.4)
|
154
|
+
actioncable (= 7.0.2.4)
|
155
|
+
actionmailbox (= 7.0.2.4)
|
156
|
+
actionmailer (= 7.0.2.4)
|
157
|
+
actionpack (= 7.0.2.4)
|
158
|
+
actiontext (= 7.0.2.4)
|
159
|
+
actionview (= 7.0.2.4)
|
160
|
+
activejob (= 7.0.2.4)
|
161
|
+
activemodel (= 7.0.2.4)
|
162
|
+
activerecord (= 7.0.2.4)
|
163
|
+
activestorage (= 7.0.2.4)
|
164
|
+
activesupport (= 7.0.2.4)
|
167
165
|
bundler (>= 1.15.0)
|
168
|
-
railties (= 7.0.
|
166
|
+
railties (= 7.0.2.4)
|
169
167
|
rails-dom-testing (2.0.3)
|
170
168
|
activesupport (>= 4.2.0)
|
171
169
|
nokogiri (>= 1.6)
|
172
170
|
rails-html-sanitizer (1.4.2)
|
173
171
|
loofah (~> 2.3)
|
174
|
-
railties (7.0.
|
175
|
-
actionpack (= 7.0.
|
176
|
-
activesupport (= 7.0.
|
172
|
+
railties (7.0.2.4)
|
173
|
+
actionpack (= 7.0.2.4)
|
174
|
+
activesupport (= 7.0.2.4)
|
177
175
|
method_source
|
178
176
|
rake (>= 12.2)
|
179
177
|
thor (~> 1.0)
|
180
178
|
zeitwerk (~> 2.5)
|
181
179
|
rainbow (3.1.1)
|
182
|
-
rake (13.0.
|
180
|
+
rake (13.0.6)
|
183
181
|
redcarpet (3.5.1)
|
184
|
-
regexp_parser (2.
|
182
|
+
regexp_parser (2.3.1)
|
185
183
|
reline (0.3.1)
|
186
184
|
io-console (~> 0.5)
|
187
185
|
rexml (3.2.5)
|
188
186
|
rouge (3.28.0)
|
189
|
-
rubocop (1.
|
187
|
+
rubocop (1.28.2)
|
190
188
|
parallel (~> 1.10)
|
191
189
|
parser (>= 3.1.0.0)
|
192
190
|
rainbow (>= 2.2.2, < 4.0)
|
193
191
|
regexp_parser (>= 1.8, < 3.0)
|
194
192
|
rexml
|
195
|
-
rubocop-ast (>= 1.
|
193
|
+
rubocop-ast (>= 1.17.0, < 2.0)
|
196
194
|
ruby-progressbar (~> 1.7)
|
197
195
|
unicode-display_width (>= 1.4.0, < 3.0)
|
198
|
-
rubocop-ast (1.
|
199
|
-
parser (>= 3.
|
200
|
-
rubocop-performance (1.13.
|
196
|
+
rubocop-ast (1.17.0)
|
197
|
+
parser (>= 3.1.1.0)
|
198
|
+
rubocop-performance (1.13.3)
|
201
199
|
rubocop (>= 1.7.0, < 2.0)
|
202
200
|
rubocop-ast (>= 0.4.0)
|
203
201
|
ruby-progressbar (1.11.0)
|
204
|
-
sprockets (4.0.
|
202
|
+
sprockets (4.0.3)
|
205
203
|
concurrent-ruby (~> 1.0)
|
206
204
|
rack (> 1, < 3)
|
207
205
|
sprockets-rails (3.4.2)
|
@@ -209,9 +207,9 @@ GEM
|
|
209
207
|
activesupport (>= 5.2)
|
210
208
|
sprockets (>= 3.0.0)
|
211
209
|
sqlite3 (1.4.2)
|
212
|
-
standard (1.
|
213
|
-
rubocop (= 1.
|
214
|
-
rubocop-performance (= 1.13.
|
210
|
+
standard (1.11.0)
|
211
|
+
rubocop (= 1.28.2)
|
212
|
+
rubocop-performance (= 1.13.3)
|
215
213
|
strscan (3.0.1)
|
216
214
|
thor (1.2.1)
|
217
215
|
timeout (0.2.0)
|
@@ -1,10 +1,6 @@
|
|
1
1
|
import { Controller } from '@hotwired/stimulus'
|
2
2
|
|
3
3
|
export default class extends Controller {
|
4
|
-
static get targets () {
|
5
|
-
return ['dateInput', 'startDateInput', 'endDateInput']
|
6
|
-
}
|
7
|
-
|
8
4
|
update (event) {
|
9
5
|
const flatpickr = event.target._flatpickr
|
10
6
|
const startDate = flatpickr.selectedDates[0]
|
@@ -15,11 +11,21 @@ export default class extends Controller {
|
|
15
11
|
}
|
16
12
|
|
17
13
|
setStartDateInputValue (value) {
|
18
|
-
|
14
|
+
const startDateInput = this.startDateInput()
|
15
|
+
startDateInput.value = value
|
19
16
|
}
|
20
17
|
|
21
18
|
setEndDateInputValue (value) {
|
22
|
-
|
19
|
+
const endDateInput = this.endDateInput()
|
20
|
+
endDateInput.value = value
|
21
|
+
}
|
22
|
+
|
23
|
+
startDateInput () {
|
24
|
+
return this.element.nextElementSibling
|
25
|
+
}
|
26
|
+
|
27
|
+
endDateInput () {
|
28
|
+
return this.startDateInput().nextElementSibling
|
23
29
|
}
|
24
30
|
|
25
31
|
formatDate (date) {
|
@@ -2,7 +2,13 @@ import { Controller } from '@hotwired/stimulus'
|
|
2
2
|
|
3
3
|
export default class extends Controller {
|
4
4
|
static get targets () {
|
5
|
-
return ['button', 'popup']
|
5
|
+
return ['button', 'popup', 'conditional', 'operator', 'value', 'hidden', 'wrapper', 'template', 'row']
|
6
|
+
}
|
7
|
+
|
8
|
+
static get values () {
|
9
|
+
return {
|
10
|
+
name: String
|
11
|
+
}
|
6
12
|
}
|
7
13
|
|
8
14
|
// Attaches controller logic to the element itself
|
@@ -10,16 +16,7 @@ export default class extends Controller {
|
|
10
16
|
connect () {
|
11
17
|
this.element.controller = this
|
12
18
|
|
13
|
-
|
14
|
-
document.addEventListener('click', (event) => {
|
15
|
-
this.handleOutsideClick(event)
|
16
|
-
})
|
17
|
-
}
|
18
|
-
|
19
|
-
handleOutsideClick (event) {
|
20
|
-
if (!this.isClickedInside(event)) {
|
21
|
-
this.close()
|
22
|
-
}
|
19
|
+
this.updateHiddenValue()
|
23
20
|
}
|
24
21
|
|
25
22
|
toggle (event) {
|
@@ -41,6 +38,38 @@ export default class extends Controller {
|
|
41
38
|
this.popupTarget.classList.add('closed')
|
42
39
|
}
|
43
40
|
|
41
|
+
add (event) {
|
42
|
+
event.preventDefault()
|
43
|
+
const html = this.getTemplateHTML()
|
44
|
+
this.wrapperTarget.insertAdjacentHTML('beforeend', html)
|
45
|
+
}
|
46
|
+
|
47
|
+
remove (event) {
|
48
|
+
event.preventDefault()
|
49
|
+
const inputGroup = event.currentTarget.closest('[data-filter-target="row"]')
|
50
|
+
// Check if there is a previous element (the conditional select). If no element (first inputGroup), take the next element.
|
51
|
+
const conditional = inputGroup.previousElementSibling != null ? inputGroup.previousElementSibling : inputGroup.nextElementSibling
|
52
|
+
|
53
|
+
inputGroup.remove()
|
54
|
+
// If there is only one inputGroup, the conditional is null, so do not attempt to remove it
|
55
|
+
if (conditional != null) conditional.remove()
|
56
|
+
|
57
|
+
// After we remove the UI, run update to also remove filter from the hidden input
|
58
|
+
this.updateHiddenValue()
|
59
|
+
|
60
|
+
// Check if there are still inputs left, else remove filter
|
61
|
+
if (this.valueTargets.length === 0) {
|
62
|
+
this.removeFilter()
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
removeFilter () {
|
67
|
+
const form = this.buttonTarget.closest('form')
|
68
|
+
this.buttonTarget.remove()
|
69
|
+
this.popupTarget.remove()
|
70
|
+
form.submit()
|
71
|
+
}
|
72
|
+
|
44
73
|
isClickedInside (event) {
|
45
74
|
if (!event) {
|
46
75
|
return false
|
@@ -50,4 +79,25 @@ export default class extends Controller {
|
|
50
79
|
const inAddButton = event.target.dataset.action === 'click->filters#add'
|
51
80
|
return (inPopup || inButton || inAddButton)
|
52
81
|
}
|
82
|
+
|
83
|
+
updateHiddenValue () {
|
84
|
+
this.hiddenTarget.value = this.buildInstructionString()
|
85
|
+
}
|
86
|
+
|
87
|
+
buildInstructionString () {
|
88
|
+
let string = ''
|
89
|
+
for (const row of this.rowTargets) {
|
90
|
+
const conditional = row.previousElementSibling ? row.previousElementSibling.querySelector('[data-filter-target="conditional"]').value : null
|
91
|
+
const operator = row.querySelector('[data-filter-target="operator"]').value
|
92
|
+
const value = row.querySelector('[data-filter-target="value"]').value
|
93
|
+
string += `${conditional || ''}${operator}:${value}`
|
94
|
+
}
|
95
|
+
|
96
|
+
return string
|
97
|
+
}
|
98
|
+
|
99
|
+
getTemplateHTML () {
|
100
|
+
const template = this.templateTarget
|
101
|
+
return template.innerHTML
|
102
|
+
}
|
53
103
|
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
import { Controller } from '@hotwired/stimulus'
|
2
|
+
|
3
|
+
export default class extends Controller {
|
4
|
+
static get targets () {
|
5
|
+
return ['original', 'operator', 'null']
|
6
|
+
}
|
7
|
+
|
8
|
+
connect () {
|
9
|
+
this.operatorTarget.addEventListener('change', () => this.handleOperatorChange())
|
10
|
+
this.handleOperatorChange()
|
11
|
+
}
|
12
|
+
|
13
|
+
handleOperatorChange () {
|
14
|
+
if (this.operatorTarget.value === 'is_null' || this.operatorTarget.value === 'is_not_null') {
|
15
|
+
this.toggleNullInput()
|
16
|
+
} else {
|
17
|
+
this.toggleOriginalInput()
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
toggleNullInput () {
|
22
|
+
this.hideOriginal()
|
23
|
+
this.showNull()
|
24
|
+
}
|
25
|
+
|
26
|
+
toggleOriginalInput () {
|
27
|
+
this.showOriginal()
|
28
|
+
this.hideNull()
|
29
|
+
}
|
30
|
+
|
31
|
+
hideOriginal () {
|
32
|
+
this.originalTarget.style.display = 'none'
|
33
|
+
this.originalTarget.setAttribute('data-filter-target', 'value_original')
|
34
|
+
}
|
35
|
+
|
36
|
+
showOriginal () {
|
37
|
+
this.originalTarget.style.display = 'block'
|
38
|
+
this.originalTarget.setAttribute('data-filter-target', 'value')
|
39
|
+
}
|
40
|
+
|
41
|
+
hideNull () {
|
42
|
+
this.nullTarget.style.display = 'none'
|
43
|
+
this.nullTarget.setAttribute('data-filter-target', 'value_null')
|
44
|
+
}
|
45
|
+
|
46
|
+
showNull () {
|
47
|
+
this.nullTarget.style.display = 'block'
|
48
|
+
this.nullTarget.setAttribute('data-filter-target', 'value')
|
49
|
+
}
|
50
|
+
}
|
@@ -4,17 +4,13 @@ import { Dutch } from 'flatpickr/dist/esm/l10n/nl.js'
|
|
4
4
|
import I18n from '../config/i18n'
|
5
5
|
|
6
6
|
export default class extends Controller {
|
7
|
-
static get targets () {
|
8
|
-
return ['input']
|
9
|
-
}
|
10
|
-
|
11
7
|
connect () {
|
12
8
|
const options = { ...this.defaultOptions(), ...this.options() }
|
13
|
-
flatpickr(this.
|
9
|
+
flatpickr(this.element, options)
|
14
10
|
}
|
15
11
|
|
16
12
|
options () {
|
17
|
-
return JSON.parse(this.
|
13
|
+
return JSON.parse(this.element.getAttribute('data-flatpickr'))
|
18
14
|
}
|
19
15
|
|
20
16
|
defaultOptions () {
|
@@ -19,6 +19,9 @@ export default class extends Controller {
|
|
19
19
|
}
|
20
20
|
|
21
21
|
handleOutsideClick (event) {
|
22
|
+
const itemRemoved = !document.body.contains(event.target) // Ignore items that were removed from DOM (else this triggers a close)
|
23
|
+
if (itemRemoved) return
|
24
|
+
|
22
25
|
const inPopup = event.target.closest('[data-popup-target="popup"]') !== null
|
23
26
|
const inButton = event.target.closest('[data-popup-target="button"]') !== null
|
24
27
|
const openPopup = document.querySelector('[data-popup-target="popup"]:not(.closed)')
|
@@ -53,7 +56,6 @@ export default class extends Controller {
|
|
53
56
|
close (event) {
|
54
57
|
const button = event.target.closest('[data-popup-target="button"]')
|
55
58
|
const popup = this.popupById(button.dataset.popupId)
|
56
|
-
|
57
59
|
this.closePopup(popup)
|
58
60
|
}
|
59
61
|
|
@@ -2,12 +2,12 @@ import { Controller } from '@hotwired/stimulus'
|
|
2
2
|
|
3
3
|
export default class extends Controller {
|
4
4
|
static get targets () {
|
5
|
-
return ['wrapper', 'form', 'select', 'method', 'button', '
|
5
|
+
return ['wrapper', 'form', 'select', 'method', 'button', 'idInput', 'counter']
|
6
6
|
}
|
7
7
|
|
8
8
|
connect () {
|
9
9
|
this.wrapperTarget.addEventListener('idSelectionChanged', (event) => {
|
10
|
-
this.
|
10
|
+
this.updateIdInput(event.detail.ids)
|
11
11
|
this.updateCounter(event.detail.count)
|
12
12
|
this.toggleCounter(event.detail.count)
|
13
13
|
})
|
@@ -21,17 +21,24 @@ export default class extends Controller {
|
|
21
21
|
this.enableButton()
|
22
22
|
}
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
this.addId(id)
|
29
|
-
})
|
24
|
+
updateIdInput (ids) {
|
25
|
+
if (ids == null) {
|
26
|
+
this.disableIdInput()
|
27
|
+
this.idInputTarget.value = ''
|
30
28
|
} else {
|
31
|
-
this.
|
29
|
+
this.enableIdInput()
|
30
|
+
this.idInputTarget.value = `in:${ids.join(',')}`
|
32
31
|
}
|
33
32
|
}
|
34
33
|
|
34
|
+
disableIdInput () {
|
35
|
+
this.idInputTarget.removeAttribute('name')
|
36
|
+
}
|
37
|
+
|
38
|
+
enableIdInput () {
|
39
|
+
this.idInputTarget.setAttribute('name', 'id')
|
40
|
+
}
|
41
|
+
|
35
42
|
updateCounter (count) {
|
36
43
|
let htmlString = ''
|
37
44
|
switch (count) {
|
@@ -94,16 +101,4 @@ export default class extends Controller {
|
|
94
101
|
enableButton () {
|
95
102
|
this.buttonTarget.removeAttribute('disabled')
|
96
103
|
}
|
97
|
-
|
98
|
-
addId (id) {
|
99
|
-
const template = this.idInputTemplateTarget
|
100
|
-
const input = template.innerHTML.replace(/ID/g, id)
|
101
|
-
this.formTarget.insertAdjacentHTML('afterbegin', input)
|
102
|
-
}
|
103
|
-
|
104
|
-
removeIds () {
|
105
|
-
this.idTargets.forEach((input) => {
|
106
|
-
this.formTarget.removeChild(input)
|
107
|
-
})
|
108
|
-
}
|
109
104
|
}
|
@@ -6,6 +6,7 @@ import DateRangeController from './controllers/date_range_controller'
|
|
6
6
|
import DropzoneController from './controllers/dropzone_controller'
|
7
7
|
import FilePreviewController from './controllers/file_preview_controller'
|
8
8
|
import FilterController from './controllers/filter_controller'
|
9
|
+
import FilterRowController from './controllers/filter_row_controller'
|
9
10
|
import FiltersController from './controllers/filters_controller'
|
10
11
|
import FlatpickrController from './controllers/flatpickr_controller'
|
11
12
|
import HelloController from './controllers/hello_controller'
|
@@ -26,6 +27,7 @@ export class Headmin {
|
|
26
27
|
Stimulus.register('dropzone', DropzoneController)
|
27
28
|
Stimulus.register('file-preview', FilePreviewController)
|
28
29
|
Stimulus.register('filter', FilterController)
|
30
|
+
Stimulus.register('filter-row', FilterRowController)
|
29
31
|
Stimulus.register('filters', FiltersController)
|
30
32
|
Stimulus.register('flatpickr', FlatpickrController)
|
31
33
|
Stimulus.register('hello', HelloController)
|