activeadmin 2.6.1 → 2.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ce87c19dbaccfc28fd5c36d12f1ef679772a70bd1ae8a131182d277d3de4cb3
4
- data.tar.gz: d0b56716796cb013d8d874280366d8fb424366ee3979bf6549585ef505836d79
3
+ metadata.gz: 6ab0e48981374c48c42109adc93edce137eed195218c8b7d26a8895f1a3e3e85
4
+ data.tar.gz: f4a1228efba99ed7d3bdcd93330fb7687fd321521e7ca521c1363ed1a72f3bf6
5
5
  SHA512:
6
- metadata.gz: fcda92e560081295c175f08b876594a5bc3ea38cfcb523a15e803a086c97306574801d279ffc2f553902a4aaf2e77eece4b4e065bb26a11f12e031b2d0a94257
7
- data.tar.gz: ca2e295171c638b40f376bf8fd56a7027c79d08a063b534a666b9761e5f4102b436bfc34cc99b3cf8bab7a12a586fe7c702f62661a885f1291974efb73b14490
6
+ metadata.gz: 3c98537ec2c59cfca738a38c5a0c905f15f55fa4aafb3bb9680880f628e89ad8226458b1a950a9ce717c01bc7a72dd6e6b906c77088a0096bf9b4397ae9475bd
7
+ data.tar.gz: 3af41a29c2c5602198b7f614360f223c53c2f0c47b931fca189f30d96decfc4211697dea7cfc364e1ea218015259622c2180a15b0164db86615255363ca983f5
@@ -2,7 +2,20 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
- ## 2.6.1 [☰](https://github.com/activeadmin/activeadmin/compare/v2.6.0..2.6.1)
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)
6
19
 
7
20
  ### Bug Fixes
8
21
 
@@ -13,7 +26,7 @@
13
26
 
14
27
  ## 2.6.0 [☰](https://github.com/activeadmin/activeadmin/compare/v2.5.0..v2.6.0)
15
28
 
16
- ### Enhacements
29
+ ### Enhancements
17
30
 
18
31
  * Display multiple flash messages in separate elements. [#5929] by [@mirelon]
19
32
  * Make delete confirmation messages in French & Spanish gender-neutral. [#5946] by [@cprodhomme]
@@ -536,6 +549,7 @@ Please check [0-6-stable] for previous changes.
536
549
  [#5548]: https://github.com/activeadmin/activeadmin/pull/5548
537
550
  [#5842]: https://github.com/activeadmin/activeadmin/pull/5842
538
551
  [#5854]: https://github.com/activeadmin/activeadmin/pull/5854
552
+ [#5855]: https://github.com/activeadmin/activeadmin/pull/5855
539
553
  [#5874]: https://github.com/activeadmin/activeadmin/pull/5874
540
554
  [#5877]: https://github.com/activeadmin/activeadmin/pull/5877
541
555
  [#5886]: https://github.com/activeadmin/activeadmin/pull/5886
@@ -554,6 +568,10 @@ Please check [0-6-stable] for previous changes.
554
568
  [#6000]: https://github.com/activeadmin/activeadmin/pull/6000
555
569
  [#6002]: https://github.com/activeadmin/activeadmin/pull/6002
556
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
557
575
 
558
576
  [@5t111111]: https://github.com/5t111111
559
577
  [@aarek]: https://github.com/aarek
@@ -584,6 +602,7 @@ Please check [0-6-stable] for previous changes.
584
602
  [@FabioRos]: https://github.com/FabioRos
585
603
  [@faucct]: https://github.com/faucct
586
604
  [@Fivell]: https://github.com/Fivell
605
+ [@giapnhdev]: https://github.com/giapnhdev
587
606
  [@glebtv]: https://github.com/glebtv
588
607
  [@gonzedge]: https://github.com/gonzedge
589
608
  [@guigs]: https://github.com/guigs
@@ -606,6 +625,7 @@ Please check [0-6-stable] for previous changes.
606
625
  [@Kris-LIBIS]: https://github.com/Kris-LIBIS
607
626
  [@kwent]: https://github.com/kwent
608
627
  [@leio10]: https://github.com/leio10
628
+ [@Looooong]: https://github.com/Looooong
609
629
  [@markstory]: https://github.com/markstory
610
630
  [@mauriciopasquier]: https://github.com/mauriciopasquier
611
631
  [@mconiglio]: https://github.com/mconiglio
@@ -628,6 +648,7 @@ Please check [0-6-stable] for previous changes.
628
648
  [@shouya]: https://github.com/shouya
629
649
  [@stefsava]: https://github.com/stefsava
630
650
  [@stereoscott]: https://github.com/stereoscott
651
+ [@taralbass]: https://github.com/taralbass
631
652
  [@tiagotex]: https://github.com/tiagotex
632
653
  [@timoschilling]: https://github.com/timoschilling
633
654
  [@TimPetricola]: https://github.com/TimPetricola
@@ -204,7 +204,7 @@ Maintainers need to do the following to push out a release:
204
204
  [fork Active Admin]: https://help.github.com/articles/fork-a-repo
205
205
  [make a pull request]: https://help.github.com/articles/creating-a-pull-request
206
206
  [git rebasing]: http://git-scm.com/book/en/Git-Branching-Rebasing
207
- [interactive rebase]: https://help.github.com/articles/interactive-rebase
207
+ [interactive rebase]: https://help.github.com/en/github/using-git/about-git-rebase
208
208
  [shortcut reference links]: https://github.github.com/gfm/#shortcut-reference-link
209
209
  [Rollup]: https://rollupjs.org/guide/en/#quick-start
210
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>
@@ -3,11 +3,11 @@ 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}"
@@ -16,8 +16,8 @@ vi:
16
16
  cancel: "Hủy"
17
17
  empty: "Trống"
18
18
  previous: "Trước"
19
- next: "Tiếp"
20
- download: "Download:"
19
+ next: "Sau"
20
+ download: "Tải về:"
21
21
  has_many_new: "Thêm mới %{model}"
22
22
  has_many_delete: "Xóa"
23
23
  has_many_remove: "Hủy bỏ"
@@ -29,7 +29,7 @@ vi:
29
29
  contains: "Có chứa"
30
30
  equals: "Bằng"
31
31
  starts_with: "Bắt đầu với"
32
- ends_with: "Kết thúc với việc"
32
+ ends_with: "Kết thúc bởi"
33
33
  greater_than: "Lớn hơn"
34
34
  less_than: "Nhỏ hơn"
35
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
@@ -204,7 +204,7 @@ GEM
204
204
  jekyll-seo-tag (~> 2.1)
205
205
  minitest (5.14.0)
206
206
  multipart-post (2.1.1)
207
- nokogiri (1.10.7)
207
+ nokogiri (1.10.8)
208
208
  mini_portile2 (~> 2.4.0)
209
209
  octokit (4.15.0)
210
210
  faraday (>= 0.9)
@@ -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
 
@@ -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>
@@ -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
@@ -1,3 +1,3 @@
1
1
  module ActiveAdmin
2
- VERSION = '2.6.1'
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.1
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: 2020-02-03 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.2
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