activeadmin 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activeadmin might be problematic. Click here for more details.

Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +43 -28
  3. data/CONTRIBUTING.md +47 -21
  4. data/app/assets/javascripts/active_admin/base.js +509 -0
  5. data/app/assets/stylesheets/active_admin/_base.scss +29 -29
  6. data/app/assets/stylesheets/active_admin/_header.scss +3 -5
  7. data/app/assets/stylesheets/active_admin/_mixins.scss +1 -1
  8. data/{vendor → app}/assets/stylesheets/active_admin/_normalize.scss +0 -0
  9. data/app/assets/stylesheets/active_admin/components/_tables.scss +1 -2
  10. data/app/assets/stylesheets/active_admin/mixins/_all.scss +8 -8
  11. data/app/assets/stylesheets/active_admin/mixins/_variables.scss +5 -0
  12. data/app/assets/stylesheets/active_admin/print.scss +2 -2
  13. data/app/assets/stylesheets/active_admin/structure/_main_structure.scss +1 -1
  14. data/app/javascript/active_admin/base.js +19 -0
  15. data/app/{assets/javascripts/active_admin/ext/jquery-ui.es6 → javascript/active_admin/ext/jquery-ui.js} +0 -0
  16. data/app/{assets/javascripts/active_admin/ext/jquery.es6 → javascript/active_admin/ext/jquery.js} +0 -0
  17. data/app/{assets/javascripts/active_admin/lib/batch_actions.es6 → javascript/active_admin/initializers/batch-actions.js} +4 -2
  18. data/app/javascript/active_admin/initializers/checkbox-toggler.js +3 -0
  19. data/app/{assets/javascripts/active_admin/initializers/datepicker.es6 → javascript/active_admin/initializers/datepicker.js} +0 -0
  20. data/app/javascript/active_admin/initializers/dropdown-menu.js +9 -0
  21. data/app/javascript/active_admin/initializers/filters.js +10 -0
  22. data/app/{assets/javascripts/active_admin/lib/has_many.es6 → javascript/active_admin/initializers/has-many.js} +0 -0
  23. data/app/javascript/active_admin/initializers/per-page.js +13 -0
  24. data/app/javascript/active_admin/initializers/table-checkbox-toggler.js +3 -0
  25. data/app/{assets/javascripts/active_admin/initializers/tabs.es6 → javascript/active_admin/initializers/tabs.js} +0 -0
  26. data/app/{assets/javascripts/active_admin/lib/checkbox-toggler.es6 → javascript/active_admin/lib/checkbox-toggler.js} +2 -2
  27. data/app/{assets/javascripts/active_admin/lib/dropdown-menu.es6 → javascript/active_admin/lib/dropdown-menu.js} +2 -9
  28. data/app/javascript/active_admin/lib/filters.js +39 -0
  29. data/app/{assets/javascripts/active_admin/lib/modal_dialog.es6 → javascript/active_admin/lib/modal-dialog.js} +3 -1
  30. data/app/javascript/active_admin/lib/per-page.js +38 -0
  31. data/app/{assets/javascripts/active_admin/lib/table-checkbox-toggler.es6 → javascript/active_admin/lib/table-checkbox-toggler.js} +4 -2
  32. data/app/javascript/active_admin/lib/utils.js +40 -0
  33. data/config/locales/az.yml +138 -0
  34. data/docs/1-general-configuration.md +20 -0
  35. data/docs/Gemfile.lock +55 -54
  36. data/lib/active_admin.rb +0 -1
  37. data/lib/active_admin/application.rb +1 -1
  38. data/lib/active_admin/filters/active_filter.rb +1 -1
  39. data/lib/active_admin/inputs/filters/date_range_input.rb +4 -4
  40. data/lib/active_admin/resource.rb +1 -1
  41. data/lib/active_admin/resource_controller/polymorphic_routes.rb +3 -2
  42. data/lib/active_admin/version.rb +1 -1
  43. data/lib/active_admin/views/components/paginated_collection.rb +1 -0
  44. data/lib/active_admin/views/components/table_for.rb +1 -0
  45. data/lib/active_admin/views/pages/base.rb +1 -1
  46. data/lib/active_admin/views/pages/index.rb +1 -0
  47. metadata +27 -43
  48. data/app/assets/images/active_admin/nested_menu_arrow.gif +0 -0
  49. data/app/assets/images/active_admin/nested_menu_arrow_dark.gif +0 -0
  50. data/app/assets/images/active_admin/orderable.png +0 -0
  51. data/app/assets/javascripts/active_admin/base.es6 +0 -23
  52. data/app/assets/javascripts/active_admin/initializers/filters.es6 +0 -45
  53. data/app/assets/javascripts/active_admin/lib/active_admin.es6 +0 -41
  54. data/app/assets/javascripts/active_admin/lib/per_page.es6 +0 -47
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ddd5ccf937ae176b3ba0e13d2af256758dbde0c4aafe9b966c752bb1bb411ea8
4
- data.tar.gz: fa4bbd86cf444fb150d6cd624ed8a3125144481878001de32461f5256e30b835
3
+ metadata.gz: 7d4b2286091c361bd4e0e7b408ed7e4f6bf3aa118492ed037cb51b2f6e882cf4
4
+ data.tar.gz: b9381cb429a6ccfda90d0a51f646c759843c387bda107dcb3d66cffa26cd083f
5
5
  SHA512:
6
- metadata.gz: 84c708ca4b0aa8580a3181de153dd698f39c427e9c28adca8c7b3d1f75ff09ba41fa9955d84c6eeb3beccd174db2147a54980123302093cb0d51dd22a021ff40
7
- data.tar.gz: 95fc6f7f92134b18270a2ccfdb05c1c55e9151bde9390bbd752f3735633f494c4145674534c1f2bc964687dc513aeb925a5427c8678ea3380340b89859431ebe
6
+ metadata.gz: 8dba7ffe9ed0516ebfc0f484d548962d677d9d6a36cbf097c0e76e06db7ef87c0469791fdb7917ddd2b831927225958107a16aab3cd096f1ffbf8bc49ebf697d
7
+ data.tar.gz: d9dd9f7295fe4f0ccc852ab375637578c86621bd30435d62f2c7d7754ccb5693910aa39e0a154fdbd5535613b3f829ef31a8520761162006e12755e85db9dabb
@@ -2,13 +2,33 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 2.5.0 [☰](https://github.com/activeadmin/activeadmin/compare/v2.4.0..v2.5.0)
6
+
7
+ ### Enhancements
8
+
9
+ * Azerbaijani translation. [#5078] by [@orkhan]
10
+
11
+ ### Bug Fixes
12
+
13
+ * Convert namespace to sym to prevent duplicate namespaces such as :foo and 'foo'. [#5931] by [@westonganger]
14
+ * Use filter label when condition has a predicate. [#5886] by [@ko-lem]
15
+ * Fix error when routing with array containing symbol. [#5870] by [@jwesorick]
16
+ * Fix error when there is a model named `Tag` and `meta_tags` have been configured. [#5893] by [@micred], [@FabioRos] and [@deivid-rodriguez]
17
+ * Allow specifying custom `input_html` for `DateRangeInput`. [#5867] by [@mirelon]
18
+ * Adjust `#main_content` right margin to take into account possible custom values of `$sidebar-width` and `$section-padding`. [#5887] by [@guigs]
19
+ * Improved polymorphic routes generation to avoid problems when multiple `belongs_to` are defined. [#5938] by [@leio10]
20
+
21
+ ### Dependency Changes
22
+
23
+ * Support for Rails 5.0 and Rails 5.1 has been dropped. [#5877] by [@deivid-rodriguez]
24
+
5
25
  ## 2.4.0 [☰](https://github.com/activeadmin/activeadmin/compare/v2.3.1..v2.4.0)
6
26
 
7
27
  ### Enhancements
8
28
 
9
29
  * Make optimization to not use expensive COUNT queries also work for decorated actions. [#5811] by [@irmela]
10
- * Render a text filter instead of a select for large associations (opt-in) [#5548] by [@DanielHeath]
11
- * Improve German translations [#5874] by [@juril33t]
30
+ * Render a text filter instead of a select for large associations (opt-in). [#5548] by [@DanielHeath]
31
+ * Improve German translations. [#5874] by [@juril33t]
12
32
 
13
33
  ## 2.3.1 [☰](https://github.com/activeadmin/activeadmin/compare/v2.3.0..v2.3.1)
14
34
 
@@ -20,8 +40,6 @@
20
40
 
21
41
  ### Enhancements
22
42
 
23
- #### Minor
24
-
25
43
  * Bump minimum ransack requirement to make sure everyone gets a version that works ok with all supported versions of Rails. [#5831] by [@deivid-rodriguez]
26
44
 
27
45
  ### Bug Fixes
@@ -36,14 +54,12 @@
36
54
 
37
55
  ### Enhancements
38
56
 
39
- #### Minor
40
-
41
57
  * The `status_tag` component now supports different labels for `false` and `nil` boolean cases through the locale. Both default to display "No" for backwards compatibility. [#5794] by [@javierjulio]
42
58
  * Add Macedonian locale. [#5710] by [@violeta-p]
43
59
 
44
60
  ### Bug Fixes
45
61
 
46
- * Fix pundit policy retrieving for static pages when the pundit namespace is :active_admin. [#5777] by [@kwent]
62
+ * Fix pundit policy retrieving for static pages when the pundit namespace is `:active_admin`. [#5777] by [@kwent]
47
63
  * Fix show page title not being properly escaped if title's content included HTML. [#5802] by [@deivid-rodriguez]
48
64
  * Revert [21b6138f] from [#5740] since it actually caused the performance in development to regress. [#5801] by [@deivid-rodriguez]
49
65
 
@@ -55,7 +71,7 @@
55
71
  * Crash when rendering comments from a custom controller block. [#5758] by [@deivid-rodriguez]
56
72
  * Switch `sass` dependency to `sassc-rails`, since `sass` is no longer supported and since it restores support for directly importing `css` files. [#5504] by [@deivid-rodriguez]
57
73
 
58
- ### Removals
74
+ ### Dependency Changes
59
75
 
60
76
  * Support for ruby 2.3 has been removed. [#5751] by [@deivid-rodriguez]
61
77
 
@@ -67,8 +83,6 @@ _No changes_.
67
83
 
68
84
  ### Enhancements
69
85
 
70
- #### Minor
71
-
72
86
  * Require arbre `~> 1.2, >= 1.2.1`. [#5726] by [@ionut998], and [#5738] by [@deivid-rodriguez]
73
87
 
74
88
  ## 2.0.0.rc1 [☰](https://github.com/activeadmin/activeadmin/compare/v1.4.3..v2.0.0.rc1)
@@ -84,9 +98,6 @@ _No changes_.
84
98
  ```
85
99
 
86
100
  * Consider authorization when displaying comments in show page. [#5555] by [@amiuhle]
87
-
88
- #### Minor
89
-
90
101
  * Add better support for rendering lists. [#5370] by [@dkniffin]
91
102
  * Undeprecate `config.register_stylesheet` and `config.register_javascript` for lack of better solution for including external assets. It might be reevaluated in the future. [#5662] by [@deivid-rodriguez]
92
103
 
@@ -103,7 +114,7 @@ _No changes_.
103
114
  * Sidebar title internationalization. [#5417] by [@WaKeMaTTa]
104
115
  * `filter` labels not allowing a `Proc` to be passed. [#5418] by [@WaKeMaTTa]
105
116
 
106
- ### Removals
117
+ ### Dependency Changes
107
118
 
108
119
  * Rails 4.2 support has been dropped. [#5104] by [@javierjulio] and [@deivid-rodriguez]
109
120
  * Dependency on coffee-rails has been removed. [#5081] by [@javierjulio]
@@ -139,8 +150,6 @@ _No changes_.
139
150
 
140
151
  ### Enhancements
141
152
 
142
- #### Minor
143
-
144
153
  * Add missing I18n for comments. [#5458], [#5461] by [@mauriciopasquier]
145
154
  * Fix batch_actions.delete_confirmation translation in zh-CN.yml. [#5453] by [@ShallmentMo]
146
155
  * Add some missing italian translations. [#5433] by [@stefsava]
@@ -178,8 +187,6 @@ _No changes_.
178
187
 
179
188
  ### Enhancements
180
189
 
181
- #### Major
182
-
183
190
  * Rails 5.2 support [#5343] by [@varyonic], [#5399], [#5401] by [@zorab47]
184
191
 
185
192
  ## 1.2.1 [☰](https://github.com/activeadmin/activeadmin/compare/v1.2.0..v1.2.1)
@@ -192,8 +199,6 @@ _No changes_.
192
199
 
193
200
  ### Enhancements
194
201
 
195
- #### Minor
196
-
197
202
  * Do not display pagination info when there are no comments. [#5119] by [@alex-bogomolov]
198
203
  * Revert generated config files to pluralized. [#5120] by [@varyonic], [#5137] by [@deivid-rodriguez]
199
204
  * Warn when action definition overwrites controller method. [#5167] by [@aarek]
@@ -224,7 +229,7 @@ _No changes_.
224
229
  * Fixed [#5043]. Do not crash in sidebar rendering when a default scope is not specified. [#5044] by [@Fivell]
225
230
  * Fixed [#3894]. Make tab's component work with non-ascii titles. [#5046] by [@Fivell]
226
231
 
227
- ### Removals
232
+ ### Dependency Changes
228
233
 
229
234
  * Ruby 2.1 support has been dropped. [#5003] by [@deivid-rodriguez]
230
235
  * Replaced `sass-rails` with `sass` dependency. [#5037] by [@javierjulio]
@@ -262,8 +267,6 @@ _No changes_.
262
267
 
263
268
  ### Enhancements
264
269
 
265
- #### Minor
266
-
267
270
  * Support proc as an input_html option value when declaring filters. [#5029] by [@Fivell]
268
271
  * Base localization support, better associations handling for active filters sidebar. [#4951] by [@Fivell]
269
272
  * Allow AA scopes to return paginated collections. [#4996] by [@Fivell]
@@ -287,16 +290,11 @@ _No changes_.
287
290
 
288
291
  ### Enhancements
289
292
 
290
- #### Major
291
-
292
293
  * Migration from Metasearch to Ransack. [#1979] by [@seanlinsley]
293
294
  * Rails 4 support. [#2326] by many people :heart:
294
295
  * Rails 4.2 support. [#3731] by [@gonzedge] and [@timoschilling]
295
296
  * Rails 5 support. [#4254] by [@seanlinsley]
296
297
  * Rails 5.1 support. [#4882] by [@varyonic]
297
-
298
- #### Minor
299
-
300
298
  * "Create another" checkbox for the new resource page. [#4477] by [@bolshakov]
301
299
  * Page supports belongs_to. [#4759] by [@Fivell] and [@zorab47]
302
300
  * Support for custom sorting strategies. [#4768] by [@Fivell]
@@ -427,6 +425,7 @@ Please check [0-6-stable] for previous changes.
427
425
  [#5052]: https://github.com/activeadmin/activeadmin/pull/5052
428
426
  [#5060]: https://github.com/activeadmin/activeadmin/pull/5060
429
427
  [#5069]: https://github.com/activeadmin/activeadmin/pull/5069
428
+ [#5078]: https://github.com/activeadmin/activeadmin/pull/5078
430
429
  [#5081]: https://github.com/activeadmin/activeadmin/pull/5081
431
430
  [#5088]: https://github.com/activeadmin/activeadmin/pull/5088
432
431
  [#5093]: https://github.com/activeadmin/activeadmin/pull/5093
@@ -516,6 +515,14 @@ Please check [0-6-stable] for previous changes.
516
515
  [#5842]: https://github.com/activeadmin/activeadmin/pull/5842
517
516
  [#5854]: https://github.com/activeadmin/activeadmin/pull/5854
518
517
  [#5874]: https://github.com/activeadmin/activeadmin/pull/5874
518
+ [#5877]: https://github.com/activeadmin/activeadmin/pull/5877
519
+ [#5886]: https://github.com/activeadmin/activeadmin/pull/5886
520
+ [#5870]: https://github.com/activeadmin/activeadmin/pull/5870
521
+ [#5893]: https://github.com/activeadmin/activeadmin/pull/5893
522
+ [#5867]: https://github.com/activeadmin/activeadmin/pull/5867
523
+ [#5887]: https://github.com/activeadmin/activeadmin/pull/5887
524
+ [#5931]: https://github.com/activeadmin/activeadmin/pull/5931
525
+ [#5938]: https://github.com/activeadmin/activeadmin/pull/5938
519
526
 
520
527
  [@5t111111]: https://github.com/5t111111
521
528
  [@aarek]: https://github.com/aarek
@@ -541,10 +548,12 @@ Please check [0-6-stable] for previous changes.
541
548
  [@drn]: https://github.com/drn
542
549
  [@eikes]: https://github.com/eikes
543
550
  [@f1sherman]: https://github.com/f1sherman
551
+ [@FabioRos]: https://github.com/FabioRos
544
552
  [@faucct]: https://github.com/faucct
545
553
  [@Fivell]: https://github.com/Fivell
546
554
  [@glebtv]: https://github.com/glebtv
547
555
  [@gonzedge]: https://github.com/gonzedge
556
+ [@guigs]: https://github.com/guigs
548
557
  [@HappyKadaver]: https://github.com/HappyKadaver
549
558
  [@innparusu95]: https://github.com/innparusu95
550
559
  [@ionut998]: https://github.com/ionut998
@@ -556,7 +565,9 @@ Please check [0-6-stable] for previous changes.
556
565
  [@johnnyshields]: https://github.com/johnnyshields
557
566
  [@jscheid]: https://github.com/jscheid
558
567
  [@juril33t]: https://github.com/juril33t
568
+ [@jwesorick]: https://github.com/jwesorick
559
569
  [@kjeldahl]: https://github.com/kjeldahl
570
+ [@ko-lem]: https://github.com/ko-lem
560
571
  [@kobeumut]: https://github.com/kobeumut
561
572
  [@Kris-LIBIS]: https://github.com/Kris-LIBIS
562
573
  [@kwent]: https://github.com/kwent
@@ -564,8 +575,11 @@ Please check [0-6-stable] for previous changes.
564
575
  [@markstory]: https://github.com/markstory
565
576
  [@mauriciopasquier]: https://github.com/mauriciopasquier
566
577
  [@mconiglio]: https://github.com/mconiglio
578
+ [@micred]: https://github.com/micred
579
+ [@mirelon]: https://github.com/mirelon
567
580
  [@ndbroadbent]: https://github.com/ndbroadbent
568
581
  [@Nguyenanh]: https://github.com/Nguyenanh
582
+ [@orkhan]: https://github.com/orkhan
569
583
  [@panasyuk]: https://github.com/panasyuk
570
584
  [@PChambino]: https://github.com/PChambino
571
585
  [@potatosalad]: https://github.com/potatosalad
@@ -587,6 +601,7 @@ Please check [0-6-stable] for previous changes.
587
601
  [@violeta-p]: https://github.com/violeta-p
588
602
  [@WaKeMaTTa]: https://github.com/WaKeMaTTa
589
603
  [@wasifhossain]: https://github.com/wasifhossain
604
+ [@westonganger]: https://github.com/westonganger
590
605
  [@Wowu]: https://github.com/Wowu
591
606
  [@wspurgin]: https://github.com/wspurgin
592
607
  [@zorab47]: https://github.com/zorab47
@@ -5,15 +5,15 @@ like you that make Active Admin such a great tool.
5
5
 
6
6
  ### Where do I go from here?
7
7
 
8
- If you've noticed a bug or have a question that doesn't belong on the
9
- [mailing list][] or [Stack Overflow][], [search the issue tracker][] to see if
10
- someone else in the community has already created a ticket. If not, go ahead and
11
- [make one][new issue]!
8
+ If you've noticed a bug or have a question that doesn't belong on the [mailing
9
+ list] or [Stack Overflow], [search the issue tracker] to see if someone else in
10
+ the community has already created a ticket. If not, go ahead and [make one][new
11
+ issue]!
12
12
 
13
13
  ### Fork & create a branch
14
14
 
15
- If this is something you think you can fix, then [fork Active Admin][] and
16
- create a branch with a descriptive name.
15
+ If this is something you think you can fix, then [fork Active Admin] and create
16
+ a branch with a descriptive name.
17
17
 
18
18
  A good branch name would be (where issue #325 is the ticket you're working on):
19
19
 
@@ -34,6 +34,20 @@ Now install the development dependencies:
34
34
  bundle install
35
35
  ```
36
36
 
37
+ Then install javascript dependencies with [Yarn] (requires a current version of [Node.js]):
38
+
39
+ ```sh
40
+ bin/yarn install
41
+ ```
42
+
43
+ JS assets are located in `app/javascript/active_admin`. The config will take care of compiling a complete bundle with [Rollup] using the `build` script and exported to `app/assets/javascripts/active_admin/base.js` ready to be used by Sprockets.
44
+
45
+ To update javascript bundle run (add `-w` flag for watch mode):
46
+
47
+ ```sh
48
+ bin/yarn build
49
+ ```
50
+
37
51
  Now you should be able to run the entire suite using:
38
52
 
39
53
  ```sh
@@ -43,27 +57,19 @@ bin/rake
43
57
  The test run will generate a sample Rails application in `tmp/test_apps` to run the
44
58
  tests against.
45
59
 
46
- If your tests are passing locally but they're failing on CircleCI, it's probably
47
- because of some breaking change or problem with the latest version of some
48
- dependency. You should be able to reproduce the issue locally by:
49
-
50
- * Removing the `Gemfile.lock` file.
51
- * Running `bundle install`.
52
- * Re-running the tests again like you did previously.
53
-
54
- This is not your fault though, so if this happens feel free to investigate, but
55
- also feel free to ping maintainers about the issue you just found.
56
-
57
60
  If you want to test against a Rails version different from the latest, make sure
58
61
  you use the correct Gemfile, for example:
59
62
 
60
63
  ```sh
61
- export BUNDLE_GEMFILE=gemfiles/rails_51.gemfile
64
+ export BUNDLE_GEMFILE=gemfiles/rails_60/Gemfile
62
65
  ```
63
66
 
67
+ **Warning** SCSS assets are aimed to be used indifferently with Sprockets **and** webpacker.
68
+ As such, make sure not to use any sass-rails directives such as `asset-url` or `image-url`.
69
+
64
70
  ### Did you find a bug?
65
71
 
66
- * **Ensure the bug was not already reported** by [searching all issues][].
72
+ * **Ensure the bug was not already reported** by [searching all issues].
67
73
 
68
74
  * If you're unable to find an open issue addressing the problem,
69
75
  [open a new one][new issue]. Be sure to include a **title and clear
@@ -77,12 +83,12 @@ export BUNDLE_GEMFILE=gemfiles/rails_51.gemfile
77
83
  issue description**:
78
84
  * [**ActiveAdmin** master issues][master template]
79
85
 
80
- ### 5. Implement your fix or feature
86
+ ### Implement your fix or feature
81
87
 
82
88
  At this point, you're ready to make your changes! Feel free to ask for help;
83
89
  everyone is a beginner at first :smile_cat:
84
90
 
85
- ### 6. View your changes in a Rails application
91
+ ### View your changes in a Rails application
86
92
 
87
93
  Active Admin is meant to be used by humans, not cucumbers. So make sure to take
88
94
  a look at your changes in a browser.
@@ -123,6 +129,22 @@ checks as the rest of the project. `bin/rake lint` will give you feedback in
123
129
  this regard. You can check & fix style issues by running each linter
124
130
  individually. Run `bin/rake -T lint` to see the available linters.
125
131
 
132
+ ### Add a changelog entry
133
+
134
+ If your PR includes user-observable changes, you'll be asked to add a changelog
135
+ entry following the existing changelog format.
136
+
137
+ The changelog format is the following:
138
+
139
+ * One line per PR describing your fix or enhancement.
140
+ * Entries end with a dot, followed by "[#pr-number] by [@github-username]".
141
+ * Entries are added under the "Unreleased" section at the top of the file, under
142
+ the "Bug Fixes" or "Enhancements" subsection.
143
+ * References to github usernames and pull requests use [shortcut reference
144
+ links].
145
+ * Your github username reference definition is included in the correct
146
+ alphabetical position at the bottom of the file.
147
+
126
148
  ### Make a Pull Request
127
149
 
128
150
  At this point, you should switch back to your master branch and make sure it's
@@ -213,3 +235,7 @@ Maintainers need to do the following to push out a release:
213
235
  [make a pull request]: https://help.github.com/articles/creating-a-pull-request
214
236
  [git rebasing]: http://git-scm.com/book/en/Git-Branching-Rebasing
215
237
  [interactive rebase]: https://help.github.com/articles/interactive-rebase
238
+ [shortcut reference links]: https://github.github.com/gfm/#shortcut-reference-link
239
+ [Rollup]: https://rollupjs.org/guide/en/#quick-start
240
+ [Yarn]: https://yarnpkg.com/en/docs/install
241
+ [Node.js]: https://nodejs.org/en/
@@ -0,0 +1,509 @@
1
+ /**
2
+ * Warning: This file is auto-generated, do not modify. Instead, make your changes in 'app/javascript/active_admin/' and run `yarn build`
3
+ */
4
+ //= require jquery3
5
+ //= require jquery-ui/widgets/datepicker
6
+ //= require jquery-ui/widgets/dialog
7
+ //= require jquery-ui/widgets/sortable
8
+ //= require jquery-ui/widgets/tabs
9
+ //= require jquery-ui/widget
10
+ //= require jquery_ujs
11
+ //= require_self
12
+
13
+ (function(factory) {
14
+ typeof define === "function" && define.amd ? define([ "jquery", "jquery-ui/ui/widgets/datepicker", "jquery-ui/ui/widgets/dialog", "jquery-ui/ui/widgets/sortable", "jquery-ui/ui/widgets/tabs", "jquery-ui/ui/widget", "jquery-ujs" ], factory) : factory();
15
+ })(function() {
16
+ "use strict";
17
+ $.fn.serializeObject = function() {
18
+ return this.serializeArray().reduce(function(obj, item) {
19
+ obj[item.name] = item.value;
20
+ return obj;
21
+ }, {});
22
+ };
23
+ $.ui.dialog.prototype._focusTabbable = function() {
24
+ this.uiDialog.focus();
25
+ };
26
+ function ModalDialog(message, inputs, callback) {
27
+ var html = '<form id="dialog_confirm" title="' + message + '"><ul>';
28
+ for (var name in inputs) {
29
+ var elem, opts, wrapper;
30
+ var type = inputs[name];
31
+ if (/^(datepicker|checkbox|text|number)$/.test(type)) {
32
+ wrapper = "input";
33
+ } else if (type === "textarea") {
34
+ wrapper = "textarea";
35
+ } else if ($.isArray(type)) {
36
+ var _ref = [ "select", "option", type, "" ];
37
+ wrapper = _ref[0];
38
+ elem = _ref[1];
39
+ opts = _ref[2];
40
+ type = _ref[3];
41
+ } else {
42
+ throw new Error("Unsupported input type: {" + name + ": " + type + "}");
43
+ }
44
+ var klass = type === "datepicker" ? type : "";
45
+ html += "<li>\n <label>" + (name.charAt(0).toUpperCase() + name.slice(1)) + "</label>\n <" + wrapper + ' name="' + name + '" class="' + klass + '" type="' + type + '">' + (opts ? function() {
46
+ var result = [];
47
+ opts.forEach(function(v) {
48
+ var $elem = $("<" + elem + "/>");
49
+ if ($.isArray(v)) {
50
+ $elem.text(v[0]).val(v[1]);
51
+ } else {
52
+ $elem.text(v);
53
+ }
54
+ result.push($elem.wrap("<div>").parent().html());
55
+ });
56
+ return result;
57
+ }().join("") : "") + ("</" + wrapper + ">") + "</li>";
58
+ var _ref2 = [];
59
+ wrapper = _ref2[0];
60
+ elem = _ref2[1];
61
+ opts = _ref2[2];
62
+ type = _ref2[3];
63
+ klass = _ref2[4];
64
+ }
65
+ html += "</ul></form>";
66
+ var form = $(html).appendTo("body");
67
+ $("body").trigger("modal_dialog:before_open", [ form ]);
68
+ form.dialog({
69
+ modal: true,
70
+ open: function open(event, ui) {
71
+ $("body").trigger("modal_dialog:after_open", [ form ]);
72
+ },
73
+ dialogClass: "active_admin_dialog",
74
+ buttons: {
75
+ OK: function OK() {
76
+ callback($(this).serializeObject());
77
+ $(this).dialog("close");
78
+ },
79
+ Cancel: function Cancel() {
80
+ $(this).dialog("close").remove();
81
+ }
82
+ }
83
+ });
84
+ }
85
+ var onDOMReady = function onDOMReady() {
86
+ $(".batch_actions_selector li a").off("click confirm:complete");
87
+ $(".batch_actions_selector li a").on("click", function(event) {
88
+ var _this = this;
89
+ var message;
90
+ event.stopPropagation();
91
+ event.preventDefault();
92
+ if (message = $(this).data("confirm")) {
93
+ ModalDialog(message, $(this).data("inputs"), function(inputs) {
94
+ $(_this).trigger("confirm:complete", inputs);
95
+ });
96
+ } else {
97
+ $(this).trigger("confirm:complete");
98
+ }
99
+ });
100
+ $(".batch_actions_selector li a").on("confirm:complete", function(event, inputs) {
101
+ var val;
102
+ if (val = JSON.stringify(inputs)) {
103
+ $("#batch_action_inputs").removeAttr("disabled").val(val);
104
+ } else {
105
+ $("#batch_action_inputs").attr("disabled", "disabled");
106
+ }
107
+ $("#batch_action").val($(this).data("action"));
108
+ $("#collection_selection").submit();
109
+ });
110
+ if ($(".batch_actions_selector").length && $(":checkbox.toggle_all").length) {
111
+ if ($(".paginated_collection table.index_table").length) {
112
+ $(".paginated_collection table.index_table").tableCheckboxToggler();
113
+ } else {
114
+ $(".paginated_collection").checkboxToggler();
115
+ }
116
+ $(document).on("change", ".paginated_collection :checkbox", function() {
117
+ if ($(".paginated_collection :checkbox:checked").length && $(".dropdown_menu_list").children().length) {
118
+ $(".batch_actions_selector").each(function() {
119
+ $(this).aaDropdownMenu("enable");
120
+ });
121
+ } else {
122
+ $(".batch_actions_selector").each(function() {
123
+ $(this).aaDropdownMenu("disable");
124
+ });
125
+ }
126
+ });
127
+ }
128
+ };
129
+ $(document).ready(onDOMReady).on("page:load turbolinks:load", onDOMReady);
130
+ var CheckboxToggler = function() {
131
+ function CheckboxToggler(options, container) {
132
+ this.options = options;
133
+ this.container = container;
134
+ this._init();
135
+ this._bind();
136
+ }
137
+ var _proto = CheckboxToggler.prototype;
138
+ _proto.option = function option(key, value) {};
139
+ _proto._init = function _init() {
140
+ if (!this.container) {
141
+ throw new Error("Container element not found");
142
+ } else {
143
+ this.$container = $(this.container);
144
+ }
145
+ if (!this.$container.find(".toggle_all").length) {
146
+ throw new Error('"toggle all" checkbox not found');
147
+ } else {
148
+ this.toggle_all_checkbox = this.$container.find(".toggle_all");
149
+ }
150
+ this.checkboxes = this.$container.find(":checkbox").not(this.toggle_all_checkbox);
151
+ };
152
+ _proto._bind = function _bind() {
153
+ var _this = this;
154
+ this.checkboxes.change(function(event) {
155
+ return _this._didChangeCheckbox(event.target);
156
+ });
157
+ this.toggle_all_checkbox.change(function() {
158
+ return _this._didChangeToggleAllCheckbox();
159
+ });
160
+ };
161
+ _proto._didChangeCheckbox = function _didChangeCheckbox(checkbox) {
162
+ var numChecked = this.checkboxes.filter(":checked").length;
163
+ var allChecked = numChecked === this.checkboxes.length;
164
+ var someChecked = numChecked > 0 && numChecked < this.checkboxes.length;
165
+ this.toggle_all_checkbox.prop({
166
+ checked: allChecked,
167
+ indeterminate: someChecked
168
+ });
169
+ };
170
+ _proto._didChangeToggleAllCheckbox = function _didChangeToggleAllCheckbox() {
171
+ var setting = this.toggle_all_checkbox.prop("checked");
172
+ this.checkboxes.prop({
173
+ checked: setting
174
+ });
175
+ return setting;
176
+ };
177
+ return CheckboxToggler;
178
+ }();
179
+ $.widget.bridge("checkboxToggler", CheckboxToggler);
180
+ (function($) {
181
+ $(document).on("focus", "input.datepicker:not(.hasDatepicker)", function() {
182
+ var input = $(this);
183
+ if (input[0].type === "date") {
184
+ return;
185
+ }
186
+ var defaults = {
187
+ dateFormat: "yy-mm-dd"
188
+ };
189
+ var options = input.data("datepicker-options");
190
+ input.datepicker($.extend(defaults, options));
191
+ });
192
+ })(jQuery);
193
+ var DropdownMenu = function() {
194
+ function DropdownMenu(options, element) {
195
+ this.options = options;
196
+ this.element = element;
197
+ this.$element = $(this.element);
198
+ var defaults = {
199
+ fadeInDuration: 20,
200
+ fadeOutDuration: 100,
201
+ onClickActionItemCallback: null
202
+ };
203
+ this.options = $.extend(defaults, this.options);
204
+ this.isOpen = false;
205
+ this.$menuButton = this.$element.find(".dropdown_menu_button");
206
+ this.$menuList = this.$element.find(".dropdown_menu_list_wrapper");
207
+ this._buildMenuList();
208
+ this._bind();
209
+ }
210
+ var _proto = DropdownMenu.prototype;
211
+ _proto.open = function open() {
212
+ this.isOpen = true;
213
+ this.$menuList.fadeIn(this.options.fadeInDuration);
214
+ this._position();
215
+ return this;
216
+ };
217
+ _proto.close = function close() {
218
+ this.isOpen = false;
219
+ this.$menuList.fadeOut(this.options.fadeOutDuration);
220
+ return this;
221
+ };
222
+ _proto.destroy = function destroy() {
223
+ this.$element = null;
224
+ return this;
225
+ };
226
+ _proto.isDisabled = function isDisabled() {
227
+ return this.$menuButton.hasClass("disabled");
228
+ };
229
+ _proto.disable = function disable() {
230
+ this.$menuButton.addClass("disabled");
231
+ };
232
+ _proto.enable = function enable() {
233
+ this.$menuButton.removeClass("disabled");
234
+ };
235
+ _proto.option = function option(key, value) {
236
+ if ($.isPlainObject(key)) {
237
+ return this.options = $.extend(true, this.options, key);
238
+ } else if (key != null) {
239
+ return this.options[key];
240
+ } else {
241
+ return this.options[key] = value;
242
+ }
243
+ };
244
+ _proto._buildMenuList = function _buildMenuList() {
245
+ this.$nipple = $('<div class="dropdown_menu_nipple"></div>');
246
+ this.$menuList.prepend(this.$nipple);
247
+ this.$menuList.hide();
248
+ };
249
+ _proto._bind = function _bind() {
250
+ var _this = this;
251
+ $("body").click(function() {
252
+ if (_this.isOpen) {
253
+ _this.close();
254
+ }
255
+ });
256
+ this.$menuButton.click(function() {
257
+ if (!_this.isDisabled()) {
258
+ if (_this.isOpen) {
259
+ _this.close();
260
+ } else {
261
+ _this.open();
262
+ }
263
+ }
264
+ return false;
265
+ });
266
+ };
267
+ _proto._position = function _position() {
268
+ this.$menuList.css("top", this.$menuButton.position().top + this.$menuButton.outerHeight() + 10);
269
+ var button_left = this.$menuButton.position().left;
270
+ var button_center = this.$menuButton.outerWidth() / 2;
271
+ var button_right = button_left + button_center * 2;
272
+ var menu_center = this.$menuList.outerWidth() / 2;
273
+ var nipple_center = this.$nipple.outerWidth() / 2;
274
+ var window_right = $(window).width();
275
+ var centered_menu_left = button_left + button_center - menu_center;
276
+ var centered_menu_right = button_left + button_center + menu_center;
277
+ if (centered_menu_left < 0) {
278
+ this.$menuList.css("left", button_left);
279
+ this.$nipple.css("left", button_center - nipple_center);
280
+ } else if (centered_menu_right > window_right) {
281
+ this.$menuList.css("right", window_right - button_right);
282
+ this.$nipple.css("right", button_center - nipple_center);
283
+ } else {
284
+ this.$menuList.css("left", centered_menu_left);
285
+ this.$nipple.css("left", menu_center - nipple_center);
286
+ }
287
+ };
288
+ return DropdownMenu;
289
+ }();
290
+ $.widget.bridge("aaDropdownMenu", DropdownMenu);
291
+ var onDOMReady$1 = function onDOMReady() {
292
+ return $(".dropdown_menu").aaDropdownMenu();
293
+ };
294
+ $(document).ready(onDOMReady$1).on("page:load turbolinks:load", onDOMReady$1);
295
+ function hasTurbolinks() {
296
+ return typeof Turbolinks !== "undefined" && Turbolinks.supported;
297
+ }
298
+ function turbolinksVisit(params) {
299
+ var path = [ window.location.pathname, "?", toQueryString(params) ].join("");
300
+ Turbolinks.visit(path);
301
+ }
302
+ function queryString() {
303
+ return (window.location.search || "").replace(/^\?/, "");
304
+ }
305
+ function queryStringToParams() {
306
+ var decode = function decode(value) {
307
+ return decodeURIComponent((value || "").replace(/\+/g, "%20"));
308
+ };
309
+ return queryString().split("&").map(function(pair) {
310
+ return pair.split("=");
311
+ }).map(function(_ref) {
312
+ var key = _ref[0], value = _ref[1];
313
+ return {
314
+ name: decode(key),
315
+ value: decode(value)
316
+ };
317
+ });
318
+ }
319
+ function toQueryString(params) {
320
+ var encode = function encode(value) {
321
+ return encodeURIComponent(value || "");
322
+ };
323
+ return params.map(function(_ref2) {
324
+ var name = _ref2.name, value = _ref2.value;
325
+ return [ encode(name), encode(value) ];
326
+ }).map(function(pair) {
327
+ return pair.join("=");
328
+ }).join("&");
329
+ }
330
+ var Filters = function() {
331
+ function Filters() {}
332
+ Filters._clearForm = function _clearForm(event) {
333
+ var regex = /^(q\[|q%5B|q%5b|page|utf8|commit)/;
334
+ var params = queryStringToParams().filter(function(_ref) {
335
+ var name = _ref.name;
336
+ return !name.match(regex);
337
+ });
338
+ event.preventDefault();
339
+ if (hasTurbolinks()) {
340
+ turbolinksVisit(params);
341
+ } else {
342
+ window.location.search = toQueryString(params);
343
+ }
344
+ };
345
+ Filters._disableEmptyInputFields = function _disableEmptyInputFields(event) {
346
+ var params = $(this).find(":input").filter(function(i, input) {
347
+ return input.value === "";
348
+ }).prop({
349
+ disabled: true
350
+ }).end().serializeArray();
351
+ if (hasTurbolinks()) {
352
+ event.preventDefault();
353
+ turbolinksVisit(params);
354
+ }
355
+ };
356
+ Filters._setSearchType = function _setSearchType() {
357
+ $(this).siblings("input").prop({
358
+ name: "q[" + this.value + "]"
359
+ });
360
+ };
361
+ return Filters;
362
+ }();
363
+ (function($) {
364
+ $(document).on("click", ".clear_filters_btn", Filters._clearForm).on("submit", ".filter_form", Filters._disableEmptyInputFields).on("change", ".filter_form_field.select_and_search select", Filters._setSearchType);
365
+ })(jQuery);
366
+ $(function() {
367
+ $(document).on("click", "a.button.has_many_remove", function(event) {
368
+ event.preventDefault();
369
+ var parent = $(this).closest(".has_many_container");
370
+ var to_remove = $(this).closest("fieldset");
371
+ recompute_positions(parent);
372
+ parent.trigger("has_many_remove:before", [ to_remove, parent ]);
373
+ to_remove.remove();
374
+ return parent.trigger("has_many_remove:after", [ to_remove, parent ]);
375
+ });
376
+ $(document).on("click", "a.button.has_many_add", function(event) {
377
+ var before_add;
378
+ event.preventDefault();
379
+ var parent = $(this).closest(".has_many_container");
380
+ parent.trigger(before_add = $.Event("has_many_add:before"), [ parent ]);
381
+ if (!before_add.isDefaultPrevented()) {
382
+ var index = parent.data("has_many_index") || parent.children("fieldset").length - 1;
383
+ parent.data({
384
+ has_many_index: ++index
385
+ });
386
+ var regex = new RegExp($(this).data("placeholder"), "g");
387
+ var html = $(this).data("html").replace(regex, index);
388
+ var fieldset = $(html).insertBefore(this);
389
+ recompute_positions(parent);
390
+ return parent.trigger("has_many_add:after", [ fieldset, parent ]);
391
+ }
392
+ });
393
+ $(document).on("change", '.has_many_container[data-sortable] :input[name$="[_destroy]"]', function() {
394
+ recompute_positions($(this).closest(".has_many"));
395
+ });
396
+ init_sortable();
397
+ $(document).on("has_many_add:after", ".has_many_container", init_sortable);
398
+ });
399
+ var init_sortable = function init_sortable() {
400
+ var elems = $(".has_many_container[data-sortable]:not(.ui-sortable)");
401
+ elems.sortable({
402
+ items: "> fieldset",
403
+ handle: "> ol > .handle",
404
+ start: function start(ev, ui) {
405
+ ui.item.css({
406
+ opacity: .3
407
+ });
408
+ },
409
+ stop: function stop(ev, ui) {
410
+ ui.item.css({
411
+ opacity: 1
412
+ });
413
+ recompute_positions($(this));
414
+ }
415
+ });
416
+ elems.each(recompute_positions);
417
+ };
418
+ var recompute_positions = function recompute_positions(parent) {
419
+ parent = parent instanceof jQuery ? parent : $(this);
420
+ var input_name = parent.data("sortable");
421
+ var position = parseInt(parent.data("sortable-start") || 0, 10);
422
+ parent.children("fieldset").each(function() {
423
+ var destroy_input = $(this).find("> ol > .input > :input[name$='[_destroy]']");
424
+ var sortable_input = $(this).find("> ol > .input > :input[name$='[" + input_name + "]']");
425
+ if (sortable_input.length) {
426
+ sortable_input.val(destroy_input.is(":checked") ? "" : position++);
427
+ }
428
+ });
429
+ };
430
+ var PerPage = function() {
431
+ function PerPage(element) {
432
+ this.element = element;
433
+ }
434
+ var _proto = PerPage.prototype;
435
+ _proto.update = function update() {
436
+ var params = queryStringToParams().filter(function(_ref) {
437
+ var name = _ref.name;
438
+ return name != "per_page" || name != "page";
439
+ });
440
+ params.push({
441
+ name: "per_page",
442
+ value: this.element.value
443
+ });
444
+ if (hasTurbolinks()) {
445
+ turbolinksVisit(params);
446
+ } else {
447
+ window.location.search = toQueryString(params);
448
+ }
449
+ };
450
+ PerPage._jQueryInterface = function _jQueryInterface(config) {
451
+ return this.each(function() {
452
+ var $this = $(this);
453
+ var data = $this.data("perPage");
454
+ if (!data) {
455
+ data = new PerPage(this);
456
+ $this.data("perPage", data);
457
+ }
458
+ if (config === "update") {
459
+ data[config]();
460
+ }
461
+ });
462
+ };
463
+ return PerPage;
464
+ }();
465
+ (function($) {
466
+ $(document).on("change", ".pagination_per_page > select", function(event) {
467
+ PerPage._jQueryInterface.call($(this), "update");
468
+ });
469
+ $.fn["perPage"] = PerPage._jQueryInterface;
470
+ $.fn["perPage"].Constructor = PerPage;
471
+ })(jQuery);
472
+ function _inheritsLoose(subClass, superClass) {
473
+ subClass.prototype = Object.create(superClass.prototype);
474
+ subClass.prototype.constructor = subClass;
475
+ subClass.__proto__ = superClass;
476
+ }
477
+ var TableCheckboxToggler = function(_CheckboxToggler) {
478
+ _inheritsLoose(TableCheckboxToggler, _CheckboxToggler);
479
+ function TableCheckboxToggler() {
480
+ return _CheckboxToggler.apply(this, arguments) || this;
481
+ }
482
+ var _proto = TableCheckboxToggler.prototype;
483
+ _proto._bind = function _bind() {
484
+ var _this = this;
485
+ _CheckboxToggler.prototype._bind.apply(this, arguments);
486
+ this.$container.find("tbody td").click(function(event) {
487
+ if (event.target.type !== "checkbox") {
488
+ _this._didClickCell(event.target);
489
+ }
490
+ });
491
+ };
492
+ _proto._didChangeCheckbox = function _didChangeCheckbox(checkbox) {
493
+ _CheckboxToggler.prototype._didChangeCheckbox.apply(this, arguments);
494
+ $(checkbox).parents("tr").toggleClass("selected", checkbox.checked);
495
+ };
496
+ _proto._didChangeToggleAllCheckbox = function _didChangeToggleAllCheckbox() {
497
+ this.$container.find("tbody tr").toggleClass("selected", _CheckboxToggler.prototype._didChangeToggleAllCheckbox.apply(this, arguments));
498
+ };
499
+ _proto._didClickCell = function _didClickCell(cell) {
500
+ $(cell).parent("tr").find(":checkbox").click();
501
+ };
502
+ return TableCheckboxToggler;
503
+ }(CheckboxToggler);
504
+ $.widget.bridge("tableCheckboxToggler", TableCheckboxToggler);
505
+ var onDOMReady$2 = function onDOMReady() {
506
+ return $("#active_admin_content .tabs").tabs();
507
+ };
508
+ $(document).ready(onDOMReady$2).on("page:load turbolinks:load", onDOMReady$2);
509
+ });