activeadmin 1.4.2 → 2.3.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +306 -144
- data/CONTRIBUTING.md +21 -16
- data/README.md +44 -11
- data/app/assets/javascripts/active_admin/base.es6 +23 -0
- data/app/assets/javascripts/active_admin/ext/jquery-ui.es6 +7 -0
- data/app/assets/javascripts/active_admin/ext/jquery.es6 +9 -0
- data/app/assets/javascripts/active_admin/initializers/datepicker.es6 +16 -0
- data/app/assets/javascripts/active_admin/initializers/filters.es6 +45 -0
- data/app/assets/javascripts/active_admin/initializers/tabs.es6 +6 -0
- data/app/assets/javascripts/active_admin/lib/active_admin.es6 +41 -0
- data/app/assets/javascripts/active_admin/lib/batch_actions.es6 +59 -0
- data/app/assets/javascripts/active_admin/lib/checkbox-toggler.es6 +49 -0
- data/app/assets/javascripts/active_admin/lib/dropdown-menu.es6 +123 -0
- data/app/assets/javascripts/active_admin/lib/has_many.es6 +95 -0
- data/app/assets/javascripts/active_admin/lib/modal_dialog.es6 +61 -0
- data/app/assets/javascripts/active_admin/lib/per_page.es6 +47 -0
- data/app/assets/javascripts/active_admin/lib/table-checkbox-toggler.es6 +36 -0
- data/app/assets/stylesheets/active_admin/_forms.scss +2 -14
- data/app/assets/stylesheets/active_admin/components/_status_tags.scss +0 -5
- data/app/assets/stylesheets/active_admin/components/_tabs.scss +1 -1
- data/app/assets/stylesheets/active_admin/mixins/_gradients.scss +1 -1
- data/app/views/active_admin/devise/confirmations/new.html.erb +1 -1
- data/app/views/active_admin/devise/passwords/edit.html.erb +1 -1
- data/app/views/active_admin/devise/passwords/new.html.erb +1 -1
- data/app/views/active_admin/devise/registrations/new.html.erb +1 -2
- data/app/views/active_admin/devise/shared/_error_messages.html.erb +15 -0
- data/app/views/active_admin/devise/unlocks/new.html.erb +1 -1
- data/app/views/kaminari/active_admin_countless/_first_page.html.erb +11 -0
- data/app/views/kaminari/active_admin_countless/_gap.html.erb +8 -0
- data/app/views/kaminari/active_admin_countless/_next_page.html.erb +11 -0
- data/app/views/kaminari/active_admin_countless/_page.html.erb +12 -0
- data/app/views/kaminari/active_admin_countless/_paginator.html.erb +24 -0
- data/app/views/kaminari/active_admin_countless/_prev_page.html.erb +11 -0
- data/app/views/layouts/active_admin_logged_out.html.erb +1 -1
- data/config/locales/ar.yml +3 -2
- data/config/locales/bg.yml +1 -1
- data/config/locales/bs.yml +1 -0
- data/config/locales/ca.yml +1 -1
- data/config/locales/cs.yml +1 -0
- data/config/locales/da.yml +1 -0
- data/config/locales/de-CH.yml +1 -0
- data/config/locales/de.yml +1 -0
- data/config/locales/el.yml +1 -0
- data/config/locales/en-CA.yml +1 -0
- data/config/locales/en-GB.yml +1 -0
- data/config/locales/en.yml +1 -0
- data/config/locales/eo.yml +1 -0
- data/config/locales/es-MX.yml +1 -0
- data/config/locales/es.yml +1 -0
- data/config/locales/fa.yml +1 -0
- data/config/locales/fi.yml +1 -0
- data/config/locales/fr.yml +2 -1
- data/config/locales/he.yml +1 -1
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +5 -0
- data/config/locales/id.yml +1 -0
- data/config/locales/it.yml +1 -0
- data/config/locales/ja.yml +1 -0
- data/config/locales/ko.yml +1 -0
- data/config/locales/lt.yml +3 -2
- data/config/locales/lv.yml +1 -0
- data/config/locales/mk.yml +134 -0
- data/config/locales/nb.yml +1 -0
- data/config/locales/nl.yml +1 -0
- data/config/locales/pl.yml +1 -0
- data/config/locales/pt-BR.yml +1 -0
- data/config/locales/pt-PT.yml +1 -0
- data/config/locales/ro.yml +1 -0
- data/config/locales/ru.yml +1 -0
- data/config/locales/sk.yml +1 -0
- data/config/locales/sv-SE.yml +1 -0
- data/config/locales/tr.yml +1 -0
- data/config/locales/uk.yml +3 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-CN.yml +1 -0
- data/config/locales/zh-TW.yml +1 -0
- data/docs/0-installation.md +2 -2
- data/docs/12-arbre-components.md +13 -0
- data/docs/13-authorization-adapter.md +6 -6
- data/docs/2-resource-customization.md +1 -1
- data/docs/3-index-pages/index-as-table.md +7 -0
- data/docs/CNAME +1 -1
- data/docs/Gemfile +0 -1
- data/docs/Gemfile.lock +3 -4
- data/docs/_config.yml +2 -0
- data/docs/_includes/top-menu.html +2 -2
- data/docs/index.html +109 -8
- data/docs/stylesheets/main.css +29 -0
- data/lib/active_admin.rb +10 -4
- data/lib/active_admin/application.rb +11 -18
- data/lib/active_admin/application_settings.rb +3 -0
- data/lib/active_admin/asset_registration.rb +0 -8
- data/lib/active_admin/base_controller.rb +6 -6
- data/lib/active_admin/base_controller/authorization.rb +3 -4
- data/lib/active_admin/batch_actions/controller.rb +2 -2
- data/lib/active_admin/batch_actions/resource_extension.rb +9 -5
- data/lib/active_admin/callbacks.rb +1 -1
- data/lib/active_admin/controller_action.rb +2 -1
- data/lib/active_admin/csv_builder.rb +4 -3
- data/lib/active_admin/dependency.rb +3 -75
- data/lib/active_admin/dsl.rb +1 -8
- data/lib/active_admin/error.rb +4 -2
- data/lib/active_admin/filters/active_filter.rb +5 -4
- data/lib/active_admin/filters/active_sidebar.rb +5 -1
- data/lib/active_admin/filters/forms.rb +2 -2
- data/lib/active_admin/filters/formtastic_addons.rb +1 -1
- data/lib/active_admin/filters/resource_extension.rb +3 -3
- data/lib/active_admin/form_builder.rb +3 -3
- data/lib/active_admin/generators/boilerplate.rb +12 -4
- data/lib/active_admin/helpers/scope_chain.rb +1 -0
- data/lib/active_admin/inputs/datepicker_input.rb +1 -1
- data/lib/active_admin/inputs/filters/base/search_method_select.rb +2 -2
- data/lib/active_admin/menu_item.rb +1 -1
- data/lib/active_admin/namespace.rb +2 -2
- data/lib/active_admin/namespace_settings.rb +7 -4
- data/lib/active_admin/orm/active_record/comments.rb +4 -4
- data/lib/active_admin/orm/active_record/comments/comment.rb +2 -2
- data/lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb +10 -5
- data/lib/active_admin/page_dsl.rb +1 -1
- data/lib/active_admin/page_presenter.rb +2 -1
- data/lib/active_admin/pundit_adapter.rb +18 -5
- data/lib/active_admin/resource.rb +17 -3
- data/lib/active_admin/resource/action_items.rb +1 -1
- data/lib/active_admin/resource/attributes.rb +7 -4
- data/lib/active_admin/resource/belongs_to.rb +6 -1
- data/lib/active_admin/resource/menu.rb +3 -3
- data/lib/active_admin/resource/model.rb +15 -0
- data/lib/active_admin/resource/naming.rb +3 -3
- data/lib/active_admin/resource/routes.rb +20 -7
- data/lib/active_admin/resource/scopes.rb +3 -3
- data/lib/active_admin/resource/sidebars.rb +1 -1
- data/lib/active_admin/resource_collection.rb +2 -2
- data/lib/active_admin/resource_controller.rb +2 -0
- data/lib/active_admin/resource_controller/action_builder.rb +10 -0
- data/lib/active_admin/resource_controller/polymorphic_routes.rb +36 -0
- data/lib/active_admin/resource_controller/resource_class_methods.rb +2 -0
- data/lib/active_admin/resource_controller/scoping.rb +1 -1
- data/lib/active_admin/resource_dsl.rb +6 -4
- data/lib/active_admin/router.rb +3 -2
- data/lib/active_admin/scope.rb +11 -7
- data/lib/active_admin/settings_node.rb +1 -1
- data/lib/active_admin/sidebar_section.rb +3 -1
- data/lib/active_admin/version.rb +1 -1
- data/lib/active_admin/view_helpers.rb +1 -1
- data/lib/active_admin/view_helpers/breadcrumb_helper.rb +2 -2
- data/lib/active_admin/view_helpers/display_helper.rb +13 -4
- data/lib/active_admin/view_helpers/download_format_links_helper.rb +1 -0
- data/lib/active_admin/view_helpers/method_or_proc_helper.rb +3 -0
- data/lib/active_admin/views.rb +1 -1
- data/lib/active_admin/views/components/active_admin_form.rb +7 -1
- data/lib/active_admin/views/components/attributes_table.rb +3 -3
- data/lib/active_admin/views/components/paginated_collection.rb +2 -2
- data/lib/active_admin/views/components/sidebar_section.rb +0 -3
- data/lib/active_admin/views/components/status_tag.rb +6 -19
- data/lib/active_admin/views/components/table_for.rb +2 -2
- data/lib/active_admin/views/components/tabs.rb +11 -2
- data/lib/active_admin/views/footer.rb +1 -1
- data/lib/active_admin/views/index_as_table.rb +12 -4
- data/lib/active_admin/views/pages/base.rb +3 -0
- data/lib/generators/active_admin/assets/assets_generator.rb +2 -2
- data/lib/generators/active_admin/assets/templates/active_admin.js +1 -0
- data/lib/generators/active_admin/install/install_generator.rb +6 -2
- data/lib/generators/active_admin/install/templates/active_admin.rb.erb +24 -2
- data/lib/generators/active_admin/install/templates/dashboard.rb +2 -3
- data/lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb.erb +1 -15
- data/lib/generators/active_admin/page/page_generator.rb +1 -1
- data/lib/generators/active_admin/resource/resource_generator.rb +1 -1
- data/lib/generators/active_admin/resource/templates/admin.rb.erb +40 -37
- data/lib/ransack_ext.rb +3 -3
- data/vendor/assets/javascripts/jquery-ui/form-reset-mixin.js +80 -0
- data/vendor/assets/javascripts/jquery-ui/form.js +22 -0
- data/vendor/assets/javascripts/jquery-ui/labels.js +65 -0
- data/vendor/assets/javascripts/jquery-ui/widgets/checkboxradio.js +274 -283
- metadata +113 -100
- data/.circleci/config.yml +0 -467
- data/.github/ISSUE_TEMPLATE.md +0 -20
- data/.gitignore +0 -46
- data/.mdlrc +0 -1
- data/.rspec +0 -1
- data/.rspec_parallel +0 -2
- data/.rubocop.yml +0 -94
- data/.simplecov +0 -11
- data/.yardopts +0 -7
- data/Gemfile +0 -10
- data/Gemfile.common +0 -53
- data/Gemfile.lock +0 -431
- data/Rakefile +0 -23
- data/activeadmin.gemspec +0 -32
- data/app/assets/javascripts/active_admin/base.js.coffee +0 -13
- data/app/assets/javascripts/active_admin/ext/jquery-ui.js.coffee +0 -6
- data/app/assets/javascripts/active_admin/ext/jquery.js.coffee +0 -7
- data/app/assets/javascripts/active_admin/initializers/batch_actions.js.coffee +0 -11
- data/app/assets/javascripts/active_admin/initializers/datepicker.js.coffee +0 -14
- data/app/assets/javascripts/active_admin/initializers/filters.js.coffee +0 -26
- data/app/assets/javascripts/active_admin/initializers/tabs.js.coffee +0 -7
- data/app/assets/javascripts/active_admin/lib/batch_actions.js.coffee +0 -42
- data/app/assets/javascripts/active_admin/lib/checkbox-toggler.js.coffee +0 -46
- data/app/assets/javascripts/active_admin/lib/dropdown-menu.js.coffee +0 -104
- data/app/assets/javascripts/active_admin/lib/flash.js.coffee +0 -19
- data/app/assets/javascripts/active_admin/lib/has_many.js.coffee +0 -79
- data/app/assets/javascripts/active_admin/lib/modal_dialog.js.coffee +0 -45
- data/app/assets/javascripts/active_admin/lib/per_page.js.coffee +0 -46
- data/app/assets/javascripts/active_admin/lib/table-checkbox-toggler.js.coffee +0 -22
- data/bin/install_chromedriver.sh +0 -17
- data/codecov.yml +0 -25
- data/config/i18n-tasks.yml +0 -26
- data/config/mdl_style.rb +0 -11
- data/cucumber.yml +0 -7
- data/gemfiles/rails_42.gemfile +0 -10
- data/gemfiles/rails_42.gemfile.lock +0 -410
- data/gemfiles/rails_50.gemfile +0 -10
- data/gemfiles/rails_50.gemfile.lock +0 -424
- data/gemfiles/rails_51.gemfile +0 -10
- data/gemfiles/rails_51.gemfile.lock +0 -423
- data/lib/active_admin/event.rb +0 -24
- data/lib/active_admin/helpers/output_safety_helper.rb +0 -35
- data/lib/active_admin/reloader.rb +0 -25
- data/lib/bug_report_templates/active_admin_master.rb +0 -111
- data/lib/generators/active_admin/assets/templates/active_admin.js.coffee +0 -1
- data/tasks/application_generator.rb +0 -48
- data/tasks/docs.rake +0 -64
- data/tasks/gemfiles.rake +0 -8
- data/tasks/lint.rake +0 -110
- data/tasks/local.rake +0 -27
- data/tasks/test.rake +0 -43
data/CONTRIBUTING.md
CHANGED
@@ -26,8 +26,7 @@ git checkout -b 325-add-japanese-translations
|
|
26
26
|
Make sure you're using a recent ruby and have the `bundler` gem installed, at
|
27
27
|
least version `1.14.3`.
|
28
28
|
|
29
|
-
You'll also need chrome
|
30
|
-
scenarios.
|
29
|
+
You'll also need chrome installed in order to run cucumber scenarios.
|
31
30
|
|
32
31
|
Now install the development dependencies:
|
33
32
|
|
@@ -38,10 +37,10 @@ bundle install
|
|
38
37
|
Now you should be able to run the entire suite using:
|
39
38
|
|
40
39
|
```sh
|
41
|
-
|
40
|
+
bin/rake
|
42
41
|
```
|
43
42
|
|
44
|
-
The test run will generate a sample Rails application in `
|
43
|
+
The test run will generate a sample Rails application in `tmp/test_apps` to run the
|
45
44
|
tests against.
|
46
45
|
|
47
46
|
If your tests are passing locally but they're failing on CircleCI, it's probably
|
@@ -91,11 +90,11 @@ a look at your changes in a browser.
|
|
91
90
|
To boot up a test Rails app:
|
92
91
|
|
93
92
|
```sh
|
94
|
-
|
93
|
+
bin/rake local server
|
95
94
|
```
|
96
95
|
|
97
96
|
This will automatically create a Rails app if none already exists, and store it
|
98
|
-
in the
|
97
|
+
in the `tmp/development_apps` folder.
|
99
98
|
|
100
99
|
You should now be able to open <http://localhost:3000/admin> in your browser.
|
101
100
|
You can log in using:
|
@@ -107,21 +106,22 @@ If you need to perform any other commands on the test application, just pass
|
|
107
106
|
them to the `local` rake task. For example, to boot the rails console:
|
108
107
|
|
109
108
|
```sh
|
110
|
-
|
109
|
+
bin/rake local console
|
111
110
|
```
|
112
111
|
|
113
|
-
Or to migrate the database
|
112
|
+
Or to migrate the database, if you create a new migration or just play around
|
113
|
+
with the db:
|
114
114
|
|
115
115
|
```sh
|
116
|
-
|
116
|
+
bin/rake local db:migrate
|
117
117
|
```
|
118
118
|
|
119
119
|
### Get the style right
|
120
120
|
|
121
121
|
Your patch should follow the same conventions & pass the same code quality
|
122
|
-
checks as the rest of the project. `
|
123
|
-
|
124
|
-
individually. Run `
|
122
|
+
checks as the rest of the project. `bin/rake lint` will give you feedback in
|
123
|
+
this regard. You can check & fix style issues by running each linter
|
124
|
+
individually. Run `bin/rake -T lint` to see the available linters.
|
125
125
|
|
126
126
|
### Make a Pull Request
|
127
127
|
|
@@ -184,7 +184,9 @@ Maintainers need to do the following to push out a release:
|
|
184
184
|
|
185
185
|
* Make sure all pull requests are in and that changelog is current
|
186
186
|
* Update `version.rb` file and changelog with new version number
|
187
|
-
*
|
187
|
+
* If it's not a patch level release, create a stable branch for that release,
|
188
|
+
otherwise switch to the stable branch corresponding to the patch release you
|
189
|
+
want to ship:
|
188
190
|
|
189
191
|
```sh
|
190
192
|
git checkout master
|
@@ -195,16 +197,19 @@ Maintainers need to do the following to push out a release:
|
|
195
197
|
git push activeadmin N-N-stable:N-N-stable
|
196
198
|
```
|
197
199
|
|
198
|
-
*
|
200
|
+
* Make sure you have [chandler] properly configured. Chandler is used to
|
201
|
+
automatically submit github release notes from the changelog right after
|
202
|
+
pushing the gem to rubygems.
|
203
|
+
* `bin/rake release`
|
199
204
|
|
200
|
-
[
|
205
|
+
[chandler]: https://github.com/mattbrictson/chandler#2-configure-credentials
|
201
206
|
[mailing list]: http://groups.google.com/group/activeadmin
|
202
207
|
[Stack Overflow]: http://stackoverflow.com/questions/tagged/activeadmin
|
203
208
|
[search the issue tracker]: https://github.com/activeadmin/activeadmin/issues?q=something
|
204
209
|
[new issue]: https://github.com/activeadmin/activeadmin/issues/new
|
205
210
|
[fork Active Admin]: https://help.github.com/articles/fork-a-repo
|
206
211
|
[searching all issues]: https://github.com/activeadmin/activeadmin/issues?q=
|
207
|
-
[master template]: https://github.com/activeadmin/activeadmin/blob/master/
|
212
|
+
[master template]: https://github.com/activeadmin/activeadmin/blob/master/tasks/bug_report_template.rb
|
208
213
|
[make a pull request]: https://help.github.com/articles/creating-a-pull-request
|
209
214
|
[git rebasing]: http://git-scm.com/book/en/Git-Branching-Rebasing
|
210
215
|
[interactive rebase]: https://help.github.com/articles/interactive-rebase
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@ creating elegant backends for website administration.
|
|
5
5
|
|
6
6
|
[![Version ][rubygems_badge]][rubygems]
|
7
7
|
[![Circle CI ][circle_badge]][circle]
|
8
|
-
[![Coverage ][
|
8
|
+
[![Coverage ][coverage_badge]][coverage]
|
9
9
|
[![Tidelift ][tidelift_badge]][tidelift]
|
10
10
|
[![Inch CI ][inch_badge]][inch]
|
11
11
|
|
@@ -21,6 +21,11 @@ creating elegant backends for website administration.
|
|
21
21
|
* Try the [live demo][demo].
|
22
22
|
* The [wiki] includes links to tutorials, articles and sample projects.
|
23
23
|
|
24
|
+
## For enterprise
|
25
|
+
|
26
|
+
Active Admin for enterprise is available via the Tidelift subscription. [Learn
|
27
|
+
More][tidelift_enterprise].
|
28
|
+
|
24
29
|
## Need help?
|
25
30
|
|
26
31
|
Please use [StackOverflow][stackoverflow] for help requests and how-to questions.
|
@@ -32,16 +37,22 @@ Google Groups, IRC #activeadmin and Gitter are not actively monitored.
|
|
32
37
|
|
33
38
|
## Want to contribute?
|
34
39
|
|
35
|
-
|
36
|
-
is
|
40
|
+
If you want to contribute through code or documentation, the [Contributing
|
41
|
+
guide is the best place to start][contributing]. If you have questions, feel free
|
42
|
+
to ask.
|
37
43
|
|
38
44
|
## Want to support us?
|
39
45
|
|
40
|
-
|
46
|
+
If you want to support us financially, you can [help fund the project
|
47
|
+
through a Tidelift subscription][tidelift_support]. By buying a Tidelift subscription
|
48
|
+
you make sure your whole dependency stack is properly maintained, while also
|
49
|
+
getting a comprehensive view of outdated dependencies, new releases, security
|
50
|
+
alerts, and licensing compatibility issues.
|
41
51
|
|
42
|
-
You can support us with a weekly tip via [Liberapay]
|
52
|
+
You can also support us with a weekly tip via [Liberapay].
|
43
53
|
|
44
|
-
|
54
|
+
Finally, we have an [Open Collective][opencollective page] where you can become a backer or
|
55
|
+
sponsor for the project, and also submit expenses to it.
|
45
56
|
|
46
57
|
## Dependencies
|
47
58
|
|
@@ -56,6 +67,23 @@ Tool | Description
|
|
56
67
|
[Kaminari] | Elegant pagination for any sort of collection
|
57
68
|
[Ransack] | Provides a simple search API to query your data
|
58
69
|
|
70
|
+
## Security contact information
|
71
|
+
|
72
|
+
Please use the Tidelift security contact to [report a security vulnerability][Tidelift security contact].
|
73
|
+
Tidelift will coordinate the fix and disclosure.
|
74
|
+
|
75
|
+
## Acknowledgements
|
76
|
+
|
77
|
+
Thanks to [Greg Bell][Greg] for creating and sharing this project with the open source community.
|
78
|
+
|
79
|
+
Thanks to [all the people that ever contributed through code][contributors] or
|
80
|
+
other means such as bug reports, issue triaging, feature suggestions, code
|
81
|
+
snippet tips, Slack discussions and so on.
|
82
|
+
|
83
|
+
Thanks to [Tidelift][tidelift] and all our Tidelift subscribers.
|
84
|
+
|
85
|
+
Thanks to [Open Collective][opencollective contributors] and all our Open Collective contributors.
|
86
|
+
|
59
87
|
[Arbre]: https://github.com/activeadmin/arbre
|
60
88
|
[Devise]: https://github.com/plataformatec/devise
|
61
89
|
[Formtastic]: https://github.com/justinfrench/formtastic
|
@@ -67,18 +95,23 @@ Tool | Description
|
|
67
95
|
[rubygems]: https://rubygems.org/gems/activeadmin
|
68
96
|
[circle_badge]: https://circleci.com/gh/activeadmin/activeadmin/tree/master.svg
|
69
97
|
[circle]: https://circleci.com/gh/activeadmin/activeadmin/tree/master
|
70
|
-
[
|
71
|
-
[
|
98
|
+
[coverage_badge]: https://api.codeclimate.com/v1/badges/779e407d22bacff19733/test_coverage
|
99
|
+
[coverage]: https://codeclimate.com/github/activeadmin/activeadmin/test_coverage
|
72
100
|
[inch_badge]: http://inch-ci.org/github/activeadmin/activeadmin.svg?branch=master
|
73
101
|
[inch]: http://inch-ci.org/github/activeadmin/activeadmin
|
74
102
|
[tidelift_badge]: https://tidelift.com/badges/github/activeadmin/activeadmin
|
75
103
|
[tidelift]: https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=readme
|
104
|
+
[tidelift_enterprise]: https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=referral&utm_campaign=github&utm_content=enterprise
|
105
|
+
[tidelift_support]: https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=referral&utm_campaign=github&utm_content=support
|
76
106
|
|
77
107
|
[docs]: http://activeadmin.info/0-installation.html
|
78
108
|
[demo]: http://demo.activeadmin.info/admin
|
79
109
|
[wiki]: https://github.com/activeadmin/activeadmin/wiki
|
80
110
|
[stackoverflow]: http://stackoverflow.com/questions/tagged/activeadmin
|
81
111
|
[contributing]: https://github.com/activeadmin/activeadmin/blob/master/CONTRIBUTING.md
|
82
|
-
[
|
83
|
-
[
|
84
|
-
[
|
112
|
+
[Liberapay]: https://liberapay.com/Active-Admin/donate
|
113
|
+
[Tidelift security contact]: https://tidelift.com/security
|
114
|
+
[Greg]: https://github.com/gregbell
|
115
|
+
[contributors]: https://github.com/activeadmin/activeadmin/graphs/contributors
|
116
|
+
[opencollective page]: https://opencollective.com/activeadmin
|
117
|
+
[opencollective contributors]: https://opencollective.com/activeadmin#contributors
|
@@ -0,0 +1,23 @@
|
|
1
|
+
//= require jquery3
|
2
|
+
//= require jquery-ui/widgets/datepicker
|
3
|
+
//= require jquery-ui/widgets/dialog
|
4
|
+
//= require jquery-ui/widgets/sortable
|
5
|
+
//= require jquery-ui/widgets/tabs
|
6
|
+
//= require jquery-ui/widget
|
7
|
+
//= require jquery_ujs
|
8
|
+
//= require_self
|
9
|
+
//= require ./ext/jquery
|
10
|
+
//= require ./ext/jquery-ui
|
11
|
+
//= require ./lib/active_admin
|
12
|
+
//= require ./lib/batch_actions
|
13
|
+
//= require ./lib/dropdown-menu
|
14
|
+
//= require ./lib/has_many
|
15
|
+
//= require ./lib/modal_dialog
|
16
|
+
//= require ./lib/per_page
|
17
|
+
//= require ./lib/checkbox-toggler
|
18
|
+
//= require ./lib/table-checkbox-toggler
|
19
|
+
//= require ./initializers/datepicker
|
20
|
+
//= require ./initializers/filters
|
21
|
+
//= require ./initializers/tabs
|
22
|
+
|
23
|
+
window.ActiveAdmin = {}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
// Short-circuits `_focusTabbable` to focus on the modal itself instead of
|
2
|
+
// elements inside the modal. Without this, if a datepicker is the first input,
|
3
|
+
// it'll immediately pop up when the modal opens.
|
4
|
+
// See this ticket for more info: http://bugs.jqueryui.com/ticket/4731
|
5
|
+
$.ui.dialog.prototype._focusTabbable = function() {
|
6
|
+
this.uiDialog.focus();
|
7
|
+
};
|
@@ -0,0 +1,9 @@
|
|
1
|
+
// `serializeArray` generates => [{ name: 'foo', value: 'bar' }]
|
2
|
+
// This function remaps it to => { foo: 'bar' }
|
3
|
+
$.fn.serializeObject = function() {
|
4
|
+
return this.serializeArray()
|
5
|
+
.reduce((obj, item) => {
|
6
|
+
obj[item.name] = item.value
|
7
|
+
return obj
|
8
|
+
}, {});
|
9
|
+
};
|
@@ -0,0 +1,16 @@
|
|
1
|
+
(($) => {
|
2
|
+
|
3
|
+
$(document)
|
4
|
+
.on('focus', 'input.datepicker:not(.hasDatepicker)', function() {
|
5
|
+
const input = $(this);
|
6
|
+
|
7
|
+
// Only create datepickers in compatible browsers
|
8
|
+
if (input[0].type === 'date') { return; }
|
9
|
+
|
10
|
+
const defaults = { dateFormat: 'yy-mm-dd' };
|
11
|
+
const options = input.data('datepicker-options');
|
12
|
+
|
13
|
+
input.datepicker($.extend(defaults, options));
|
14
|
+
});
|
15
|
+
|
16
|
+
})(jQuery);
|
@@ -0,0 +1,45 @@
|
|
1
|
+
(($, ActiveAdmin) => {
|
2
|
+
|
3
|
+
class Filters {
|
4
|
+
|
5
|
+
static _clearForm(event) {
|
6
|
+
const regex = /^(q\[|q%5B|q%5b|page|utf8|commit)/;
|
7
|
+
const params = ActiveAdmin
|
8
|
+
.queryStringToParams()
|
9
|
+
.filter(({name}) => !name.match(regex));
|
10
|
+
|
11
|
+
event.preventDefault();
|
12
|
+
|
13
|
+
if (ActiveAdmin.turbolinks) {
|
14
|
+
ActiveAdmin.turbolinksVisit(params);
|
15
|
+
} else {
|
16
|
+
window.location.search = ActiveAdmin.toQueryString(params);
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
static _disableEmptyInputFields(event) {
|
21
|
+
const params = $(this)
|
22
|
+
.find(':input')
|
23
|
+
.filter((i, input) => input.value === '')
|
24
|
+
.prop({ disabled: true })
|
25
|
+
.end()
|
26
|
+
.serializeArray();
|
27
|
+
|
28
|
+
if (ActiveAdmin.turbolinks) {
|
29
|
+
event.preventDefault();
|
30
|
+
ActiveAdmin.turbolinksVisit(params);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
static _setSearchType() {
|
35
|
+
$(this).siblings('input').prop({name: `q[${this.value}]`});
|
36
|
+
}
|
37
|
+
|
38
|
+
}
|
39
|
+
|
40
|
+
$(document).
|
41
|
+
on('click', '.clear_filters_btn', Filters._clearForm).
|
42
|
+
on('submit', '.filter_form', Filters._disableEmptyInputFields).
|
43
|
+
on('change', '.filter_form_field.select_and_search select', Filters._setSearchType);
|
44
|
+
|
45
|
+
})(jQuery, window.activeadmin);
|
@@ -0,0 +1,41 @@
|
|
1
|
+
((window, $) => {
|
2
|
+
|
3
|
+
class ActiveAdmin {
|
4
|
+
|
5
|
+
static get turbolinks() {
|
6
|
+
return (typeof Turbolinks !== 'undefined' && Turbolinks.supported);
|
7
|
+
}
|
8
|
+
|
9
|
+
static turbolinksVisit(params) {
|
10
|
+
const path = [window.location.pathname, '?', this.toQueryString(params)].join('')
|
11
|
+
Turbolinks.visit(path);
|
12
|
+
}
|
13
|
+
|
14
|
+
static queryString() {
|
15
|
+
return (window.location.search || '').replace(/^\?/, '');
|
16
|
+
}
|
17
|
+
|
18
|
+
static queryStringToParams() {
|
19
|
+
const decode = (value) => decodeURIComponent((value || '').replace(/\+/g, '%20'));
|
20
|
+
|
21
|
+
return this.queryString()
|
22
|
+
.split("&")
|
23
|
+
.map(pair => pair.split("="))
|
24
|
+
.map(([key, value]) => {
|
25
|
+
return { name: decode(key), value: decode(value) }
|
26
|
+
});
|
27
|
+
}
|
28
|
+
|
29
|
+
static toQueryString(params) {
|
30
|
+
const encode = (value) => encodeURIComponent(value || '');
|
31
|
+
|
32
|
+
return params
|
33
|
+
.map(({name, value}) => [ encode(name), encode(value) ])
|
34
|
+
.map(pair => pair.join('='))
|
35
|
+
.join('&')
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
window.activeadmin = ActiveAdmin
|
40
|
+
|
41
|
+
})(window, jQuery);
|
@@ -0,0 +1,59 @@
|
|
1
|
+
const onDOMReady = function() {
|
2
|
+
// Detach any previously attached handlers before re-attaching them.
|
3
|
+
// This avoids double-registered handlers when Turbolinks is enabled
|
4
|
+
$('.batch_actions_selector li a').off('click confirm:complete');
|
5
|
+
|
6
|
+
//
|
7
|
+
// Use ActiveAdmin.modal_dialog to prompt user if
|
8
|
+
// confirmation is required for current Batch Action
|
9
|
+
//
|
10
|
+
$('.batch_actions_selector li a').on('click', function(event){
|
11
|
+
let message;
|
12
|
+
event.stopPropagation(); // prevent Rails UJS click event
|
13
|
+
event.preventDefault();
|
14
|
+
if ((message = $(this).data('confirm'))) {
|
15
|
+
ActiveAdmin.modal_dialog(message, $(this).data('inputs'), inputs => {
|
16
|
+
$(this).trigger('confirm:complete', inputs);
|
17
|
+
});
|
18
|
+
} else {
|
19
|
+
$(this).trigger('confirm:complete');
|
20
|
+
}
|
21
|
+
});
|
22
|
+
|
23
|
+
$('.batch_actions_selector li a').on('confirm:complete', function(event, inputs){
|
24
|
+
let val;
|
25
|
+
if ((val = JSON.stringify(inputs))) {
|
26
|
+
$('#batch_action_inputs').removeAttr('disabled').val(val);
|
27
|
+
} else {
|
28
|
+
$('#batch_action_inputs').attr('disabled', 'disabled');
|
29
|
+
}
|
30
|
+
|
31
|
+
$('#batch_action').val($(this).data('action'));
|
32
|
+
$('#collection_selection').submit();
|
33
|
+
});
|
34
|
+
|
35
|
+
//
|
36
|
+
// Add checkbox selection to resource tables and lists if batch actions are enabled
|
37
|
+
//
|
38
|
+
|
39
|
+
if ($(".batch_actions_selector").length && $(":checkbox.toggle_all").length) {
|
40
|
+
|
41
|
+
if ($(".paginated_collection table.index_table").length) {
|
42
|
+
$(".paginated_collection table.index_table").tableCheckboxToggler();
|
43
|
+
} else {
|
44
|
+
$(".paginated_collection").checkboxToggler();
|
45
|
+
}
|
46
|
+
|
47
|
+
$(document).on('change', '.paginated_collection :checkbox', function() {
|
48
|
+
if ($(".paginated_collection :checkbox:checked").length && $(".dropdown_menu_list").children().length) {
|
49
|
+
$(".batch_actions_selector").each(function() { $(this).aaDropdownMenu("enable"); });
|
50
|
+
} else {
|
51
|
+
$(".batch_actions_selector").each(function() { $(this).aaDropdownMenu("disable"); });
|
52
|
+
}
|
53
|
+
});
|
54
|
+
}
|
55
|
+
};
|
56
|
+
|
57
|
+
$(document).
|
58
|
+
ready(onDOMReady).
|
59
|
+
on('page:load turbolinks:load', onDOMReady);
|
@@ -0,0 +1,49 @@
|
|
1
|
+
ActiveAdmin.CheckboxToggler = class CheckboxToggler {
|
2
|
+
constructor(options, container){
|
3
|
+
this.options = options;
|
4
|
+
this.container = container;
|
5
|
+
this._init();
|
6
|
+
this._bind();
|
7
|
+
}
|
8
|
+
|
9
|
+
option(key, value) {
|
10
|
+
}
|
11
|
+
|
12
|
+
_init() {
|
13
|
+
if (!this.container) {
|
14
|
+
throw new Error('Container element not found');
|
15
|
+
} else {
|
16
|
+
this.$container = $(this.container);
|
17
|
+
}
|
18
|
+
|
19
|
+
if (!this.$container.find('.toggle_all').length) {
|
20
|
+
throw new Error('"toggle all" checkbox not found');
|
21
|
+
} else {
|
22
|
+
this.toggle_all_checkbox = this.$container.find('.toggle_all');
|
23
|
+
}
|
24
|
+
|
25
|
+
this.checkboxes = this.$container.find(':checkbox').not(this.toggle_all_checkbox);
|
26
|
+
}
|
27
|
+
|
28
|
+
_bind() {
|
29
|
+
this.checkboxes.change(event => this._didChangeCheckbox(event.target));
|
30
|
+
this.toggle_all_checkbox.change(() => this._didChangeToggleAllCheckbox());
|
31
|
+
}
|
32
|
+
|
33
|
+
_didChangeCheckbox(checkbox){
|
34
|
+
const numChecked = this.checkboxes.filter(':checked').length;
|
35
|
+
|
36
|
+
const allChecked = numChecked === this.checkboxes.length;
|
37
|
+
const someChecked = (numChecked > 0) && (numChecked < this.checkboxes.length);
|
38
|
+
|
39
|
+
this.toggle_all_checkbox.prop({ checked: allChecked, indeterminate: someChecked });
|
40
|
+
}
|
41
|
+
|
42
|
+
_didChangeToggleAllCheckbox() {
|
43
|
+
const setting = this.toggle_all_checkbox.prop('checked');
|
44
|
+
this.checkboxes.prop({ checked: setting });
|
45
|
+
return setting;
|
46
|
+
}
|
47
|
+
};
|
48
|
+
|
49
|
+
$.widget.bridge('checkboxToggler', ActiveAdmin.CheckboxToggler);
|