activeadmin 2.6.0 → 2.7.0

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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +38 -1
  3. data/CONTRIBUTING.md +4 -16
  4. data/README.md +1 -1
  5. data/app/assets/stylesheets/active_admin/_header.scss +37 -3
  6. data/app/assets/stylesheets/active_admin/mixins/_variables.scss +3 -0
  7. data/app/views/layouts/active_admin_logged_out.html.erb +15 -5
  8. data/config/locales/en-CA.yml +3 -3
  9. data/config/locales/en-GB.yml +3 -3
  10. data/config/locales/en.yml +3 -3
  11. data/config/locales/lv.yml +2 -2
  12. data/config/locales/vi.yml +6 -5
  13. data/docs/0-installation.md +26 -2
  14. data/docs/2-resource-customization.md +10 -1
  15. data/docs/Gemfile.lock +16 -15
  16. data/docs/_includes/top-menu.html +1 -1
  17. data/docs/documentation.md +1 -1
  18. data/docs/index.html +6 -6
  19. data/lib/active_admin/csv_builder.rb +7 -3
  20. data/lib/active_admin/localizers/resource_localizer.rb +1 -1
  21. data/lib/active_admin/menu.rb +5 -2
  22. data/lib/active_admin/namespace_settings.rb +3 -0
  23. data/lib/active_admin/resource/naming.rb +1 -1
  24. data/lib/active_admin/version.rb +1 -1
  25. data/lib/active_admin/views/components/scopes.rb +2 -0
  26. data/lib/active_admin/views/components/table_for.rb +1 -1
  27. data/lib/active_admin/views/pages/base.rb +4 -2
  28. data/lib/generators/active_admin/install/install_generator.rb +7 -1
  29. data/lib/generators/active_admin/install/templates/active_admin.rb.erb +7 -0
  30. data/lib/generators/active_admin/webpacker/plugins/jquery.js +7 -0
  31. data/lib/generators/active_admin/webpacker/templates/active_admin.js +5 -0
  32. data/lib/generators/active_admin/webpacker/templates/active_admin.scss +17 -0
  33. data/lib/generators/active_admin/webpacker/templates/print.scss +2 -0
  34. data/lib/generators/active_admin/webpacker/webpacker_generator.rb +26 -0
  35. metadata +8 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31e6adaf39f455cb8188d2982a201d9853a2976e9ae446dcc7958882a6f15422
4
- data.tar.gz: 58b45a79713a68cf75a9e0bb13b7cfe90bf5bf1c01e403375de2acdd4ad16881
3
+ metadata.gz: 6ab0e48981374c48c42109adc93edce137eed195218c8b7d26a8895f1a3e3e85
4
+ data.tar.gz: f4a1228efba99ed7d3bdcd93330fb7687fd321521e7ca521c1363ed1a72f3bf6
5
5
  SHA512:
6
- metadata.gz: 2c633c0f35fb6a9a90677e8f13d1c7194c8ff3ec3e267ca9249fd0343f09a319ac15148e8067be5b483fb5feab8d6cc9213208ffc24609b233b3b3335d2ba3ca
7
- data.tar.gz: 815d48181cbdcc9e36ea268217e320f3542a8791b659b931ca51a7a035d478e3cf00fb84f23e5e7021bc015bafd6c28b04add620a3414953ba32e65d8b7a9da3
6
+ metadata.gz: 3c98537ec2c59cfca738a38c5a0c905f15f55fa4aafb3bb9680880f628e89ad8226458b1a950a9ce717c01bc7a72dd6e6b906c77088a0096bf9b4397ae9475bd
7
+ data.tar.gz: 3af41a29c2c5602198b7f614360f223c53c2f0c47b931fca189f30d96decfc4211697dea7cfc364e1ea218015259622c2180a15b0164db86615255363ca983f5
data/CHANGELOG.md CHANGED
@@ -2,9 +2,31 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 2.7.0 [☰](https://github.com/activeadmin/activeadmin/compare/v2.6.1..v2.7.0)
6
+
7
+ ### Enhancements
8
+
9
+ * Extend menu to allow for nested submenus. [#5994] by [@taralbass]
10
+ * Add Webpacker compatibility with opt-in config switch and installation generator. [#5855] by [@sgara]
11
+
12
+ ### Bug Fixes
13
+
14
+ * Fix scopes renderer when resource has only optional scopes and their conditions are false. [#6149] by [@Looooong]
15
+ * Fix some missing wrapper markup in "logged out" layout. [#6086] by [@irmela]
16
+ * Fix some typos in Vietnamese translation. [#6099] by [@giapnhdev]
17
+
18
+ ## 2.6.1 [☰](https://github.com/activeadmin/activeadmin/compare/v2.6.0..v2.6.1)
19
+
20
+ ### Bug Fixes
21
+
22
+ * Fix some ruby 2.7 warnings about keyword args. [#6000] by [@vcsjones]
23
+ * Missing `create_another` translation in Vietnamese. [#6002] by [@imcvampire]
24
+ * Using "destroy" for user facing message is too robotic, prefer "delete". [#6047] by [@vfonic]
25
+ * Typo in confirmation message for comment deletion. [#6047] by [@vfonic]
26
+
5
27
  ## 2.6.0 [☰](https://github.com/activeadmin/activeadmin/compare/v2.5.0..v2.6.0)
6
28
 
7
- ### Enhacements
29
+ ### Enhancements
8
30
 
9
31
  * Display multiple flash messages in separate elements. [#5929] by [@mirelon]
10
32
  * Make delete confirmation messages in French & Spanish gender-neutral. [#5946] by [@cprodhomme]
@@ -527,10 +549,12 @@ Please check [0-6-stable] for previous changes.
527
549
  [#5548]: https://github.com/activeadmin/activeadmin/pull/5548
528
550
  [#5842]: https://github.com/activeadmin/activeadmin/pull/5842
529
551
  [#5854]: https://github.com/activeadmin/activeadmin/pull/5854
552
+ [#5855]: https://github.com/activeadmin/activeadmin/pull/5855
530
553
  [#5874]: https://github.com/activeadmin/activeadmin/pull/5874
531
554
  [#5877]: https://github.com/activeadmin/activeadmin/pull/5877
532
555
  [#5886]: https://github.com/activeadmin/activeadmin/pull/5886
533
556
  [#5870]: https://github.com/activeadmin/activeadmin/pull/5870
557
+ [#5894]: https://github.com/activeadmin/activeadmin/pull/5894
534
558
  [#5895]: https://github.com/activeadmin/activeadmin/pull/5895
535
559
  [#5867]: https://github.com/activeadmin/activeadmin/pull/5867
536
560
  [#5887]: https://github.com/activeadmin/activeadmin/pull/5887
@@ -541,6 +565,13 @@ Please check [0-6-stable] for previous changes.
541
565
  [#5946]: https://github.com/activeadmin/activeadmin/pull/5946
542
566
  [#5956]: https://github.com/activeadmin/activeadmin/pull/5956
543
567
  [#5957]: https://github.com/activeadmin/activeadmin/pull/5957
568
+ [#6000]: https://github.com/activeadmin/activeadmin/pull/6000
569
+ [#6002]: https://github.com/activeadmin/activeadmin/pull/6002
570
+ [#6047]: https://github.com/activeadmin/activeadmin/pull/6047
571
+ [#5994]: https://github.com/activeadmin/activeadmin/pull/5994
572
+ [#6149]: https://github.com/activeadmin/activeadmin/pull/6149
573
+ [#6086]: https://github.com/activeadmin/activeadmin/pull/6086
574
+ [#6099]: https://github.com/activeadmin/activeadmin/pull/6099
544
575
 
545
576
  [@5t111111]: https://github.com/5t111111
546
577
  [@aarek]: https://github.com/aarek
@@ -571,10 +602,12 @@ Please check [0-6-stable] for previous changes.
571
602
  [@FabioRos]: https://github.com/FabioRos
572
603
  [@faucct]: https://github.com/faucct
573
604
  [@Fivell]: https://github.com/Fivell
605
+ [@giapnhdev]: https://github.com/giapnhdev
574
606
  [@glebtv]: https://github.com/glebtv
575
607
  [@gonzedge]: https://github.com/gonzedge
576
608
  [@guigs]: https://github.com/guigs
577
609
  [@HappyKadaver]: https://github.com/HappyKadaver
610
+ [@imcvampire]: https://github.com/imcvampire
578
611
  [@innparusu95]: https://github.com/innparusu95
579
612
  [@ionut998]: https://github.com/ionut998
580
613
  [@irmela]: https://github.com/irmela
@@ -592,6 +625,7 @@ Please check [0-6-stable] for previous changes.
592
625
  [@Kris-LIBIS]: https://github.com/Kris-LIBIS
593
626
  [@kwent]: https://github.com/kwent
594
627
  [@leio10]: https://github.com/leio10
628
+ [@Looooong]: https://github.com/Looooong
595
629
  [@markstory]: https://github.com/markstory
596
630
  [@mauriciopasquier]: https://github.com/mauriciopasquier
597
631
  [@mconiglio]: https://github.com/mconiglio
@@ -614,10 +648,13 @@ Please check [0-6-stable] for previous changes.
614
648
  [@shouya]: https://github.com/shouya
615
649
  [@stefsava]: https://github.com/stefsava
616
650
  [@stereoscott]: https://github.com/stereoscott
651
+ [@taralbass]: https://github.com/taralbass
617
652
  [@tiagotex]: https://github.com/tiagotex
618
653
  [@timoschilling]: https://github.com/timoschilling
619
654
  [@TimPetricola]: https://github.com/TimPetricola
620
655
  [@varyonic]: https://github.com/varyonic
656
+ [@vcsjones]: https://github.com/vcsjones
657
+ [@vfonic]: https://github.com/vfonic
621
658
  [@violeta-p]: https://github.com/violeta-p
622
659
  [@WaKeMaTTa]: https://github.com/WaKeMaTTa
623
660
  [@wasifhossain]: https://github.com/wasifhossain
data/CONTRIBUTING.md CHANGED
@@ -191,24 +191,12 @@ met.
191
191
  Maintainers need to do the following to push out a release:
192
192
 
193
193
  * Make sure all pull requests are in and that changelog is current
194
- * Update `version.rb` file and changelog with new version number
195
- * If it's not a patch level release, create a stable branch for that release,
196
- otherwise switch to the stable branch corresponding to the patch release you
197
- want to ship:
198
-
199
- ```sh
200
- git checkout master
201
- git fetch activeadmin
202
- git rebase activeadmin/master
203
- # If the release is 2.1.x then this should be: 2-1-stable
204
- git checkout -b N-N-stable
205
- git push activeadmin N-N-stable:N-N-stable
206
- ```
207
-
194
+ * Switch to the master branch and make sure it's up to date.
208
195
  * Make sure you have [chandler] properly configured. Chandler is used to
209
196
  automatically submit github release notes from the changelog right after
210
197
  pushing the gem to rubygems.
211
- * `bin/rake release`
198
+ * Run one of `bin/rake release:prepare_{prerelease,prepatch,patch,preminor,minor,premajor,major}`, push the result and create a PR.
199
+ * Run `bin/rake release` from the target branch once the PR is merged.
212
200
 
213
201
  [chandler]: https://github.com/mattbrictson/chandler#2-configure-credentials
214
202
  [Stack Overflow]: http://stackoverflow.com/questions/tagged/activeadmin
@@ -216,7 +204,7 @@ Maintainers need to do the following to push out a release:
216
204
  [fork Active Admin]: https://help.github.com/articles/fork-a-repo
217
205
  [make a pull request]: https://help.github.com/articles/creating-a-pull-request
218
206
  [git rebasing]: http://git-scm.com/book/en/Git-Branching-Rebasing
219
- [interactive rebase]: https://help.github.com/articles/interactive-rebase
207
+ [interactive rebase]: https://help.github.com/en/github/using-git/about-git-rebase
220
208
  [shortcut reference links]: https://github.github.com/gfm/#shortcut-reference-link
221
209
  [Rollup]: https://rollupjs.org/guide/en/#quick-start
222
210
  [Yarn]: https://yarnpkg.com/en/docs/install
data/README.md CHANGED
@@ -101,7 +101,7 @@ Thanks to [Open Collective][opencollective contributors] and all our Open Collec
101
101
  [inch]: http://inch-ci.org/github/activeadmin/activeadmin
102
102
  [tidelift_badge]: https://tidelift.com/badges/github/activeadmin/activeadmin
103
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
104
+ [tidelift_enterprise]: https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=referral&utm_campaign=enterprise
105
105
  [tidelift_support]: https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=referral&utm_campaign=github&utm_content=support
106
106
 
107
107
  [docs]: http://activeadmin.info/0-installation.html
@@ -52,6 +52,11 @@
52
52
  margin: 0;
53
53
  padding: 0;
54
54
 
55
+ li {
56
+ /* Hover on li, display the ul */
57
+ &:hover > ul { display: block;}
58
+ }
59
+
55
60
  & > li {
56
61
  display: inline-block;
57
62
  margin-right: 4px;
@@ -95,8 +100,6 @@
95
100
  }
96
101
 
97
102
 
98
- /* Hover on li, display the ul */
99
- &:hover ul { display: block;}
100
103
  /* Drop down menus */
101
104
  ul {
102
105
  background: $hover-menu-item-background;
@@ -114,6 +117,7 @@
114
117
  z-index: 1010;
115
118
 
116
119
  li {
120
+ position: relative;
117
121
  margin: 0px;
118
122
  a {
119
123
  background: none;
@@ -124,10 +128,40 @@
124
128
  &.current {
125
129
  a { @include rounded(0) }
126
130
  }
131
+
132
+ &.has_nested > a {
133
+ background: url($menu-arrow-right-light-icon-url) no-repeat calc(100% - 7px) 55%;
134
+ padding-right: 20px;
135
+ }
136
+
137
+ &.has_nested:hover > a {
138
+ background: url($menu-arrow-right-dark-icon-url) no-repeat calc(100% - 7px) 55%;
139
+ color: #fff;
140
+ }
141
+
142
+ ul {
143
+ @include rounded-all(10px,10px,10px,10px);
144
+ margin-top: 0;
145
+ top: -3px;
146
+ left: 100%;
147
+
148
+ /* Create an invisible backdrop that adds 8px margin around the dropdown menu or submenu
149
+ that maintains the hover. This makes it much easier to navigate to submenus in
150
+ particular without losing hover accientally, especially near rounded corners. */
151
+ &:after {
152
+ content: "";
153
+ display: block;
154
+ position: absolute;
155
+ top: -8px;
156
+ left: -8px;
157
+ height: calc(100% + 16px);
158
+ width: calc(100% + 16px);
159
+ z-index: -2;
160
+ }
161
+ }
127
162
  }
128
163
  }
129
164
  }
130
-
131
165
  }
132
166
 
133
167
  #tabs {
@@ -5,6 +5,9 @@
5
5
  // Images
6
6
  $menu-arrow-light-icon-url: 'data:image/png;base64,R0lGODlhBwAEAKIAAL6+vry8vIiIiJWVlf///3t7ewAAAAAAACH5BAEAAAUALAAAAAAHAAQAAAMLWLol80MoF5mQKgEAOw==' !default;
7
7
  $menu-arrow-dark-icon-url: 'data:image/png;base64,R0lGODlhBwAEAKIAAG1tbWxsbElJSVBQUP///0JCQgAAAAAAACH5BAEAAAUALAAAAAAHAAQAAAMLWLol80MoF5mQKgEAOw==' !default;
8
+ $menu-arrow-right-light-icon-url: 'data:image/gif;base64,R0lGODlhBAAHAKECAKqqqszMzPkVFfkVFSH+EUNyZWF0ZWQgd2l0aCBHSU1QACH5BAEKAAIALAAAAAAEAAcAAAIJlA0XKbH9nmAFADs=' !default;
9
+ $menu-arrow-right-dark-icon-url: 'data:image/gif;base64,R0lGODlhBAAHAMIEAG1tbWxsbElJSVBQUPkVFfkVFfkVFfkVFSH+EUNyZWF0ZWQgd2l0aCBHSU1QACH5BAEKAAEALAAAAAAEAAcAAAMKGKqy02G8OGeACQA7' !default;
10
+
8
11
  $orderable-icon-url: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAABGCAYAAAAAVo4aAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAH5JREFUeNpi3LhlOwMU1AExGxDXwARYoHQLEFdD2cxAXAliMKFJgEAFEHfBJEHGMKLhMpgkTsAEdch/NNwCk2xCdiEQtML4LEgCf6EubUX3Cgh0oNvJ+P//f7wOGpUclRwYSZb41CyidNbB8giNM+9oXhmVHHm5bJjUSAABBgDKKiwMMUxPwgAAAABJRU5ErkJggg==' !default;
9
12
 
10
13
  // Colors
@@ -6,10 +6,18 @@
6
6
  <title><%= [@page_title, ActiveAdmin.application.site_title(self)].compact.join(" | ") %></title>
7
7
 
8
8
  <% ActiveAdmin.application.stylesheets.each do |style, options| %>
9
- <%= stylesheet_link_tag style, options %>
9
+ <% if ActiveAdmin.application.use_webpacker %>
10
+ <%= stylesheet_pack_tag style, options %>
11
+ <% else %>
12
+ <%= stylesheet_link_tag style, options %>
13
+ <% end %>
10
14
  <% end %>
11
15
  <% ActiveAdmin.application.javascripts.each do |path| %>
12
- <%= javascript_include_tag path %>
16
+ <% if ActiveAdmin.application.use_webpacker %>
17
+ <%= javascript_pack_tag path %>
18
+ <% else %>
19
+ <%= javascript_include_tag path %>
20
+ <% end %>
13
21
  <% end %>
14
22
 
15
23
  <%= favicon_link_tag ActiveAdmin.application.favicon if ActiveAdmin.application.favicon %>
@@ -24,9 +32,11 @@
24
32
  <div id="wrapper">
25
33
 
26
34
  <div id="content_wrapper">
27
- <% flash_messages.each do |type, message| %>
28
- <%= content_tag :div, message, class: "flash flash_#{type}" %>
29
- <% end %>
35
+ <div class="flashes">
36
+ <% flash_messages.each do |type, message| %>
37
+ <%= content_tag :div, message, class: "flash flash_#{type}" %>
38
+ <% end %>
39
+ </div>
30
40
  <div id="active_admin_content">
31
41
  <%= yield %>
32
42
  </div>
@@ -68,8 +68,8 @@
68
68
  default_confirmation: "Are you sure you want to do this?"
69
69
  delete_confirmation: "Are you sure you want to delete these %{plural_model}?"
70
70
  succesfully_destroyed:
71
- one: "Successfully destroyed 1 %{model}"
72
- other: "Successfully destroyed %{count} %{plural_model}"
71
+ one: "Successfully deleted 1 %{model}"
72
+ other: "Successfully deleted %{count} %{plural_model}"
73
73
  selection_toggle_explanation: "(Toggle Selection)"
74
74
  action_label: "%{title} Selected"
75
75
  labels:
@@ -82,7 +82,7 @@
82
82
  author: "Author"
83
83
  add: "Add Comment"
84
84
  delete: "Delete Comment"
85
- delete_confirmation: "Are you sure you want to delete these comment?"
85
+ delete_confirmation: "Are you sure you want to delete these comments?"
86
86
  resource: "Resource"
87
87
  no_comments_yet: "No comments yet."
88
88
  author_missing: "Anonymous"
@@ -68,8 +68,8 @@
68
68
  default_confirmation: "Are you sure you want to do this?"
69
69
  delete_confirmation: "Are you sure you want to delete these %{plural_model}?"
70
70
  succesfully_destroyed:
71
- one: "Successfully destroyed 1 %{model}"
72
- other: "Successfully destroyed %{count} %{plural_model}"
71
+ one: "Successfully deleted 1 %{model}"
72
+ other: "Successfully deleted %{count} %{plural_model}"
73
73
  selection_toggle_explanation: "(Toggle Selection)"
74
74
  action_label: "%{title} Selected"
75
75
  labels:
@@ -82,7 +82,7 @@
82
82
  author: "Author"
83
83
  add: "Add Comment"
84
84
  delete: "Delete Comment"
85
- delete_confirmation: "Are you sure you want to delete these comment?"
85
+ delete_confirmation: "Are you sure you want to delete these comments?"
86
86
  resource: "Resource"
87
87
  no_comments_yet: "No comments yet."
88
88
  author_missing: "Anonymous"
@@ -91,8 +91,8 @@ en:
91
91
  default_confirmation: "Are you sure you want to do this?"
92
92
  delete_confirmation: "Are you sure you want to delete these %{plural_model}?"
93
93
  succesfully_destroyed:
94
- one: "Successfully destroyed 1 %{model}"
95
- other: "Successfully destroyed %{count} %{plural_model}"
94
+ one: "Successfully deleted 1 %{model}"
95
+ other: "Successfully deleted %{count} %{plural_model}"
96
96
  selection_toggle_explanation: "(Toggle Selection)"
97
97
  action_label: "%{title} Selected"
98
98
  labels:
@@ -105,7 +105,7 @@ en:
105
105
  author: "Author"
106
106
  add: "Add Comment"
107
107
  delete: "Delete Comment"
108
- delete_confirmation: "Are you sure you want to delete these comment?"
108
+ delete_confirmation: "Are you sure you want to delete these comments?"
109
109
  resource: "Resource"
110
110
  no_comments_yet: "No comments yet."
111
111
  author_missing: "Anonymous"
@@ -60,8 +60,8 @@ lv:
60
60
  default_confirmation: "Vai tiešām vēlaties to darīt?"
61
61
  delete_confirmation: "Vai tiešām vēlaties dzēst šos %{plural_model}?"
62
62
  succesfully_destroyed:
63
- one: "Successfully destroyed 1 %{model}"
64
- other: "Successfully destroyed %{count} %{plural_model}"
63
+ one: "Successfully deleted 1 %{model}"
64
+ other: "Successfully deleted %{count} %{plural_model}"
65
65
  selection_toggle_explanation: "(Toggle Selection)"
66
66
  action_label: "%{title} Selected"
67
67
  labels:
@@ -3,20 +3,21 @@ vi:
3
3
  dashboard: Bảng điều khiển
4
4
  dashboard_welcome:
5
5
  welcome: "Chào mừng bạn đến với Active Admin. Đây là trang điều khiển mặc định."
6
- call_to_action: "Để thêm phần phần cho trang điều khiển hãy chỉnh sửa 'app/admin/dashboard.rb'"
6
+ call_to_action: "Để thêm thành phần cho trang điều khiển hãy chỉnh sửa 'app/admin/dashboard.rb'"
7
7
  view: "Xem"
8
8
  edit: "Chỉnh sửa"
9
9
  delete: "Xóa"
10
- delete_confirmation: "Bạn có chắc chắn rằng mình muốn xóa cái này?"
10
+ delete_confirmation: "Bạn có chắc chắn rằng mình muốn xóa không?"
11
11
  new_model: "Tạo mới %{model}"
12
12
  edit_model: "Chỉnh sửa %{model}"
13
13
  delete_model: "Xóa %{model}"
14
+ create_another: "Tạo thêm %{model}"
14
15
  details: "%{model} Chi tiết"
15
16
  cancel: "Hủy"
16
17
  empty: "Trống"
17
18
  previous: "Trước"
18
- next: "Tiếp"
19
- download: "Download:"
19
+ next: "Sau"
20
+ download: "Tải về:"
20
21
  has_many_new: "Thêm mới %{model}"
21
22
  has_many_delete: "Xóa"
22
23
  has_many_remove: "Hủy bỏ"
@@ -28,7 +29,7 @@ vi:
28
29
  contains: "Có chứa"
29
30
  equals: "Bằng"
30
31
  starts_with: "Bắt đầu với"
31
- ends_with: "Kết thúc với việc"
32
+ ends_with: "Kết thúc bởi"
32
33
  greater_than: "Lớn hơn"
33
34
  less_than: "Nhỏ hơn"
34
35
  gteq_datetime: "Lớn hơn hoặc bằng"
@@ -51,8 +51,8 @@ The generator adds these core files, among others:
51
51
  Now, migrate and seed your database before starting the server:
52
52
 
53
53
  ```sh
54
- rake db:migrate
55
- rake db:seed
54
+ rails db:migrate
55
+ rails db:seed
56
56
  rails server
57
57
  ```
58
58
 
@@ -112,6 +112,30 @@ Draper::CollectionDecorator.send :delegate, :per_page_kaminari
112
112
 
113
113
  If you're getting the error `wrong number of arguments (6 for 4..5)`, [read #2703].
114
114
 
115
+ ## webpacker
116
+
117
+ For new apps starting with Rails 6.0, Webpacker has become the default asset generator. You can **opt-in to using Webpacker for ActiveAdmin assets** as well by updating your configuration to turn on the `use_webpacker` option, either at installation time or manually.
118
+
119
+ * at active_admin installation:
120
+
121
+ ```sh
122
+ rails g active_admin:install --use_webpacker
123
+ ```
124
+
125
+ * manually:
126
+
127
+ ```ruby
128
+ ActiveAdmin.setup do |config|
129
+ config.use_webpacker = true
130
+ end
131
+ ```
132
+
133
+ And run the generator to get default Active Admin assets:
134
+
135
+ ```sh
136
+ rails g active_admin:webpacker
137
+ ```
138
+
115
139
  [CHANGELOG]: https://github.com/activeadmin/activeadmin/blob/master/CHANGELOG.md
116
140
  [dashboard.rb]: https://github.com/activeadmin/activeadmin/blob/master/lib/generators/active_admin/install/templates/dashboard.rb
117
141
  [active_admin.rb]: https://github.com/activeadmin/activeadmin/blob/master/lib/generators/active_admin/install/templates/active_admin.rb.erb
@@ -164,7 +164,8 @@ The menu method accepts a hash with the following options:
164
164
 
165
165
  * `:label` - The string or proc label to display in the menu. If it's a proc, it
166
166
  will be called each time the menu is rendered.
167
- * `:parent` - The string id (or label) of the parent used for this menu
167
+ * `:parent` - The string id (or label) of the parent used for this menu, or an array
168
+ of string ids (or labels) for a nested menu
168
169
  * `:if` - A block or a symbol of a method to call to decide if the menu item
169
170
  should be displayed
170
171
  * `:priority` - The integer value of the priority, which defaults to `10`
@@ -227,6 +228,14 @@ end
227
228
  Note that the "Blog" parent menu item doesn't even have to exist yet; it can be
228
229
  dynamically generated for you.
229
230
 
231
+ To further nest an item under a submenu, provide an array of parents.
232
+
233
+ ```ruby
234
+ ActiveAdmin.register Post do
235
+ menu parent: ["Admin", "Blog"]
236
+ end
237
+ ```
238
+
230
239
  ### Customizing Parent Menu Items
231
240
 
232
241
  All of the options given to a standard menu item are also available to
data/docs/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- activesupport (6.0.1)
4
+ activesupport (6.0.2.1)
5
5
  concurrent-ruby (~> 1.0, >= 1.0.2)
6
6
  i18n (>= 0.7, < 2)
7
7
  minitest (~> 5.1)
@@ -26,12 +26,12 @@ GEM
26
26
  ffi (>= 1.3.0)
27
27
  eventmachine (1.2.7)
28
28
  execjs (2.7.0)
29
- faraday (0.17.1)
29
+ faraday (1.0.0)
30
30
  multipart-post (>= 1.2, < 3)
31
- ffi (1.11.3)
31
+ ffi (1.12.1)
32
32
  forwardable-extended (2.6.0)
33
33
  gemoji (3.0.1)
34
- github-pages (203)
34
+ github-pages (204)
35
35
  github-pages-health-check (= 1.16.1)
36
36
  jekyll (= 3.8.5)
37
37
  jekyll-avatar (= 0.7.0)
@@ -40,7 +40,7 @@ GEM
40
40
  jekyll-default-layout (= 0.1.4)
41
41
  jekyll-feed (= 0.13.0)
42
42
  jekyll-gist (= 1.5.0)
43
- jekyll-github-metadata (= 2.12.1)
43
+ jekyll-github-metadata (= 2.13.0)
44
44
  jekyll-mentions (= 1.5.1)
45
45
  jekyll-optional-front-matter (= 0.3.2)
46
46
  jekyll-paginate (= 1.1.0)
@@ -80,7 +80,7 @@ GEM
80
80
  octokit (~> 4.0)
81
81
  public_suffix (~> 3.0)
82
82
  typhoeus (~> 1.3)
83
- html-pipeline (2.12.2)
83
+ html-pipeline (2.12.3)
84
84
  activesupport (>= 2)
85
85
  nokogiri (>= 1.4)
86
86
  http_parser.rb (0.6.0)
@@ -117,8 +117,8 @@ GEM
117
117
  jekyll (>= 3.7, < 5.0)
118
118
  jekyll-gist (1.5.0)
119
119
  octokit (~> 4.2)
120
- jekyll-github-metadata (2.12.1)
121
- jekyll (~> 3.4)
120
+ jekyll-github-metadata (2.13.0)
121
+ jekyll (>= 3.4, < 5.0)
122
122
  octokit (~> 4.0, != 4.4.0)
123
123
  jekyll-mentions (1.5.1)
124
124
  html-pipeline (~> 2.3)
@@ -193,7 +193,7 @@ GEM
193
193
  jekyll (>= 3.0, < 5.0)
194
194
  kramdown (1.17.0)
195
195
  liquid (4.0.3)
196
- listen (3.2.0)
196
+ listen (3.2.1)
197
197
  rb-fsevent (~> 0.10, >= 0.10.3)
198
198
  rb-inotify (~> 0.9, >= 0.9.10)
199
199
  mercenary (0.3.6)
@@ -202,17 +202,18 @@ GEM
202
202
  jekyll (>= 3.5, < 5.0)
203
203
  jekyll-feed (~> 0.9)
204
204
  jekyll-seo-tag (~> 2.1)
205
- minitest (5.13.0)
205
+ minitest (5.14.0)
206
206
  multipart-post (2.1.1)
207
- nokogiri (1.10.6)
207
+ nokogiri (1.10.8)
208
208
  mini_portile2 (~> 2.4.0)
209
- octokit (4.14.0)
209
+ octokit (4.15.0)
210
+ faraday (>= 0.9)
210
211
  sawyer (~> 0.8.0, >= 0.5.3)
211
212
  pathutil (0.16.2)
212
213
  forwardable-extended (~> 2.6)
213
214
  public_suffix (3.1.1)
214
215
  rb-fsevent (0.10.3)
215
- rb-inotify (0.10.0)
216
+ rb-inotify (0.10.1)
216
217
  ffi (~> 1.0)
217
218
  rouge (3.13.0)
218
219
  ruby-enum (0.7.2)
@@ -232,9 +233,9 @@ GEM
232
233
  thread_safe (0.3.6)
233
234
  typhoeus (1.3.1)
234
235
  ethon (>= 0.9.0)
235
- tzinfo (1.2.5)
236
+ tzinfo (1.2.6)
236
237
  thread_safe (~> 0.1)
237
- unicode-display_width (1.6.0)
238
+ unicode-display_width (1.6.1)
238
239
  zeitwerk (2.2.2)
239
240
 
240
241
  PLATFORMS
@@ -8,7 +8,7 @@
8
8
  </div>
9
9
 
10
10
  <div id="tidelift">
11
- <a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=homepage" target="_blank">
11
+ <a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=referral&utm_campaign=enterprise" target="_blank">
12
12
  <span class="cta">
13
13
  Active Admin for enterprise available via Tidelift
14
14
  </span>
@@ -29,7 +29,7 @@ configurations.
29
29
  Migrate your db and start the server:
30
30
 
31
31
  ```bash
32
- $> rake db:migrate
32
+ $> rails db:migrate
33
33
  $> rails server
34
34
  ```
35
35
 
data/docs/index.html CHANGED
@@ -50,7 +50,7 @@
50
50
  </h3>
51
51
 
52
52
  <p>
53
- Each resource that is registered wtih Active Admin becomes available as <span class="caps">JSON</span>, <span class="caps">XML</span> and <span class="caps">CSV</span> download. Customize the output to meet your requirements.
53
+ Each resource that is registered with Active Admin becomes available as <span class="caps">JSON</span>, <span class="caps">XML</span> and <span class="caps">CSV</span> download. Customize the output to meet your requirements.
54
54
  </p>
55
55
  </div>
56
56
 
@@ -133,7 +133,7 @@
133
133
  </h2>
134
134
 
135
135
  <p>
136
- <a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=homepage">
136
+ <a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=referral&utm_campaign=enterprise">
137
137
  Available as part of the Tidelift Subscription
138
138
  </a>
139
139
  </p>
@@ -150,11 +150,11 @@
150
150
  </p>
151
151
 
152
152
  <div class="tidelift-buttons">
153
- <a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=referral" target="_blank">
153
+ <a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=referral&utm_campaign=enterprise" target="_blank">
154
154
  <span>LEARN MORE</span>
155
155
  </a>
156
156
 
157
- <a href="https://tidelift.com/subscription/request-a-demo?utm_source=rubygems-activeadmin&utm_medium=referral" target="_blank">
157
+ <a href="https://tidelift.com/subscription/request-a-demo?utm_source=rubygems-activeadmin&utm_medium=referral&utm_campaign=enterprise" target="_blank">
158
158
  <span>REQUEST A DEMO</span>
159
159
  </a>
160
160
  </div>
@@ -202,11 +202,11 @@
202
202
  </p>
203
203
 
204
204
  <div class="tidelift-buttons">
205
- <a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=referral" target="_blank">
205
+ <a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=referral&utm_campaign=enterprise" target="_blank">
206
206
  <span>LEARN MORE</span>
207
207
  </a>
208
208
 
209
- <a href="https://tidelift.com/subscription/request-a-demo?utm_source=rubygems-activeadmin&utm_medium=referral" target="_blank">
209
+ <a href="https://tidelift.com/subscription/request-a-demo?utm_source=rubygems-activeadmin&utm_medium=referral&utm_campaign=enterprise" target="_blank">
210
210
  <span>REQUEST A DEMO</span>
211
211
  </a>
212
212
  </div>
@@ -51,14 +51,14 @@ module ActiveAdmin
51
51
  csv << bom if bom
52
52
 
53
53
  if column_names
54
- csv << CSV.generate_line(columns.map { |c| encode c.name, options }, csv_options)
54
+ csv << CSV.generate_line(columns.map { |c| encode c.name, options }, **csv_options)
55
55
  end
56
56
 
57
57
  ActiveRecord::Base.uncached do
58
58
  (1..paginated_collection.total_pages).each do |page|
59
59
  paginated_collection(page).each do |resource|
60
60
  resource = controller.send :apply_decorator, resource
61
- csv << CSV.generate_line(build_row(resource, columns, options), csv_options)
61
+ csv << CSV.generate_line(build_row(resource, columns, options), **csv_options)
62
62
  end
63
63
  end
64
64
  end
@@ -81,7 +81,11 @@ module ActiveAdmin
81
81
 
82
82
  def encode(content, options)
83
83
  if options[:encoding]
84
- content.to_s.encode options[:encoding], options[:encoding_options]
84
+ if options[:encoding_options]
85
+ content.to_s.encode options[:encoding], **options[:encoding_options]
86
+ else
87
+ content.to_s.encode options[:encoding]
88
+ end
85
89
  else
86
90
  content
87
91
  end
@@ -21,7 +21,7 @@ module ActiveAdmin
21
21
  scope = options.delete(:scope)
22
22
  specific_key = array_to_key('resources', @model_name, scope, key)
23
23
  defaults = [array_to_key(scope, key), key.to_s.titleize]
24
- ::I18n.t specific_key, options.reverse_merge(model: @model, default: defaults, scope: 'active_admin')
24
+ ::I18n.t specific_key, **options.reverse_merge(model: @model, default: defaults, scope: 'active_admin')
25
25
  end
26
26
  alias_method :t, :translate
27
27
 
@@ -47,7 +47,10 @@ module ActiveAdmin
47
47
  # menu.add parent: 'Dashboard', label: 'My Child Dashboard'
48
48
  #
49
49
  def add(options)
50
- item = if parent = options.delete(:parent)
50
+ parent_chain = Array.wrap(options.delete(:parent))
51
+
52
+ item = if parent = parent_chain.shift
53
+ options[:parent] = parent_chain if parent_chain.any?
51
54
  (self[parent] || add(label: parent)).add options
52
55
  else
53
56
  _add options.merge parent: self
@@ -60,7 +63,7 @@ module ActiveAdmin
60
63
 
61
64
  # Whether any children match the given item.
62
65
  def include?(item)
63
- @children.values.include? item
66
+ @children.values.include?(item) || @children.values.any? { |child| child.include?(item) }
64
67
  end
65
68
 
66
69
  # Used in the UI to visually distinguish which menu item is selected.
@@ -119,5 +119,8 @@ module ActiveAdmin
119
119
  :email,
120
120
  ]
121
121
  register :filter_method_for_large_association, '_starts_with'
122
+
123
+ # Switch between asset pipeline and webpacker assets
124
+ register :use_webpacker, false
122
125
  end
123
126
  end
@@ -46,7 +46,7 @@ module ActiveAdmin
46
46
  end
47
47
 
48
48
  def translate(options = {})
49
- I18n.t i18n_key, { scope: [:activerecord, :models] }.merge(options)
49
+ I18n.t i18n_key, **{ scope: [:activerecord, :models] }.merge(options)
50
50
  end
51
51
 
52
52
  def route_key
@@ -1,3 +1,3 @@
1
1
  module ActiveAdmin
2
- VERSION = '2.6.0'
2
+ VERSION = '2.7.0'
3
3
  end
@@ -26,6 +26,8 @@ module ActiveAdmin
26
26
  group_scopes.each do |scope|
27
27
  build_scope(scope, options) if call_method_or_exec_proc(scope.display_if_block)
28
28
  end
29
+
30
+ nil
29
31
  end
30
32
  end
31
33
  end
@@ -138,7 +138,7 @@ module ActiveAdmin
138
138
 
139
139
  class Column
140
140
 
141
- attr_accessor :title, :data , :html_class
141
+ attr_accessor :title, :data, :html_class
142
142
 
143
143
  def initialize(*args, &block)
144
144
  @options = args.extract_options!
@@ -29,7 +29,8 @@ module ActiveAdmin
29
29
  text_node(active_admin_namespace.head)
30
30
 
31
31
  active_admin_application.stylesheets.each do |style, options|
32
- text_node stylesheet_link_tag(style, options).html_safe
32
+ stylesheet_tag = active_admin_namespace.use_webpacker ? stylesheet_pack_tag(style, options) : stylesheet_link_tag(style, options)
33
+ text_node(stylesheet_tag.html_safe) if stylesheet_tag
33
34
  end
34
35
 
35
36
  active_admin_namespace.meta_tags.each do |name, content|
@@ -37,7 +38,8 @@ module ActiveAdmin
37
38
  end
38
39
 
39
40
  active_admin_application.javascripts.each do |path|
40
- text_node(javascript_include_tag(path))
41
+ javascript_tag = active_admin_namespace.use_webpacker ? javascript_pack_tag(path) : javascript_include_tag(path)
42
+ text_node(javascript_tag)
41
43
  end
42
44
 
43
45
  if active_admin_namespace.favicon
@@ -8,6 +8,7 @@ module ActiveAdmin
8
8
 
9
9
  hook_for :users, default: "devise", desc: "Admin user generator to run. Skip with --skip-users"
10
10
  class_option :skip_comments, type: :boolean, default: false, desc: "Skip installation of comments"
11
+ class_option :use_webpacker, type: :boolean, default: false, desc: "Use Webpacker assets instead of Sprockets"
11
12
 
12
13
  source_root File.expand_path('templates', __dir__)
13
14
 
@@ -15,6 +16,7 @@ module ActiveAdmin
15
16
  @underscored_user_name = name.underscore.gsub('/', '_')
16
17
  @use_authentication_method = options[:users].present?
17
18
  @skip_comments = options[:skip_comments]
19
+ @use_webpacker = options[:use_webpacker]
18
20
  template 'active_admin.rb.erb', 'config/initializers/active_admin.rb'
19
21
  end
20
22
 
@@ -36,7 +38,11 @@ module ActiveAdmin
36
38
  end
37
39
 
38
40
  def create_assets
39
- generate "active_admin:assets"
41
+ if options[:use_webpacker]
42
+ generate "active_admin:webpacker"
43
+ else
44
+ generate "active_admin:assets"
45
+ end
40
46
  end
41
47
 
42
48
  def create_migrations
@@ -325,4 +325,11 @@ ActiveAdmin.setup do |config|
325
325
  # You can inherit it with own class and inject it for all resources
326
326
  #
327
327
  # config.order_clause = MyOrderClause
328
+
329
+ # == Webpacker
330
+ #
331
+ # By default, Active Admin uses Sprocket's asset pipeline.
332
+ # You can switch to using Webpacker here.
333
+ #
334
+ <% unless @use_webpacker %># <% end %>config.use_webpacker = true
328
335
  end
@@ -0,0 +1,7 @@
1
+ const webpack = require('webpack')
2
+
3
+ module.exports = new webpack.ProvidePlugin({
4
+ "$":"jquery",
5
+ "jQuery":"jquery",
6
+ "window.jQuery":"jquery"
7
+ });
@@ -0,0 +1,5 @@
1
+ // Load Active Admin's styles into Webpacker,
2
+ // see `active_admin.scss` for customization.
3
+ import "../stylesheets/active_admin";
4
+
5
+ import "@activeadmin/activeadmin";
@@ -0,0 +1,17 @@
1
+ // SASS variable overrides must be declared before loading up Active Admin's styles.
2
+ //
3
+ // To view the variables that Active Admin provides, take a look at
4
+ // `app/assets/stylesheets/active_admin/mixins/_variables.scss` in the
5
+ // Active Admin source.
6
+ //
7
+ // For example, to change the sidebar width:
8
+ // $sidebar-width: 242px;
9
+
10
+ // Active Admin's got SASS!
11
+ @import "~@activeadmin/activeadmin/src/scss/mixins";
12
+ @import "~@activeadmin/activeadmin/src/scss/base";
13
+
14
+ // Overriding any non-variable SASS must be done after the fact.
15
+ // For example, to change the default status-tag color:
16
+ //
17
+ // .status_tag { background: #6090DB; }
@@ -0,0 +1,2 @@
1
+ /* Active Admin Print Stylesheet */
2
+ @import "~@activeadmin/activeadmin/src/scss/print";
@@ -0,0 +1,26 @@
1
+ module ActiveAdmin
2
+ module Generators
3
+ class WebpackerGenerator < Rails::Generators::Base
4
+
5
+ source_root File.expand_path('templates', __dir__)
6
+
7
+ def install_assets
8
+ template 'active_admin.js', 'app/javascript/packs/active_admin.js'
9
+ template "active_admin.scss", "app/javascript/stylesheets/active_admin.scss"
10
+ template 'print.scss', 'app/javascript/packs/active_admin/print.scss'
11
+
12
+ copy_file "#{__dir__}/plugins/jquery.js", Rails.root.join("config/webpack/plugins/jquery.js").to_s
13
+
14
+ insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
15
+ "const jquery = require('./plugins/jquery')\n",
16
+ after: /require\(('|")@rails\/webpacker\1\);?\n/
17
+
18
+ insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
19
+ "environment.plugins.prepend('jquery', jquery)\n",
20
+ before: "module.exports"
21
+
22
+ run "yarn add @activeadmin/activeadmin"
23
+ end
24
+ end
25
+ end
26
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.0
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Maresh
@@ -15,7 +15,7 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2019-12-16 00:00:00.000000000 Z
18
+ date: 2020-03-31 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: arbre
@@ -551,6 +551,11 @@ files:
551
551
  - lib/generators/active_admin/page/templates/page.rb
552
552
  - lib/generators/active_admin/resource/resource_generator.rb
553
553
  - lib/generators/active_admin/resource/templates/admin.rb.erb
554
+ - lib/generators/active_admin/webpacker/plugins/jquery.js
555
+ - lib/generators/active_admin/webpacker/templates/active_admin.js
556
+ - lib/generators/active_admin/webpacker/templates/active_admin.scss
557
+ - lib/generators/active_admin/webpacker/templates/print.scss
558
+ - lib/generators/active_admin/webpacker/webpacker_generator.rb
554
559
  - lib/ransack_ext.rb
555
560
  - vendor/assets/javascripts/jquery-ui/data.js
556
561
  - vendor/assets/javascripts/jquery-ui/disable-selection.js
@@ -599,7 +604,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
599
604
  - !ruby/object:Gem::Version
600
605
  version: '0'
601
606
  requirements: []
602
- rubygems_version: 3.1.1
607
+ rubygems_version: 3.2.0.pre1
603
608
  signing_key:
604
609
  specification_version: 4
605
610
  summary: Active Admin is a Ruby on Rails plugin for generating administration style