activeadmin 2.2.0 → 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.

Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/CONTRIBUTING.md +3 -5
  4. data/README.md +8 -1
  5. data/app/assets/javascripts/active_admin/lib/batch_actions.es6 +5 -1
  6. data/app/views/kaminari/active_admin_countless/_first_page.html.erb +11 -0
  7. data/app/views/kaminari/active_admin_countless/_gap.html.erb +8 -0
  8. data/app/views/kaminari/active_admin_countless/_next_page.html.erb +11 -0
  9. data/app/views/kaminari/active_admin_countless/_page.html.erb +12 -0
  10. data/app/views/kaminari/active_admin_countless/_paginator.html.erb +24 -0
  11. data/app/views/kaminari/active_admin_countless/_prev_page.html.erb +11 -0
  12. data/config/locales/ca.yml +0 -1
  13. data/docs/2-resource-customization.md +1 -1
  14. data/docs/3-index-pages/index-as-table.md +7 -0
  15. data/docs/Gemfile +0 -1
  16. data/docs/Gemfile.lock +3 -4
  17. data/docs/_config.yml +2 -0
  18. data/docs/_includes/top-menu.html +2 -2
  19. data/docs/index.html +108 -7
  20. data/docs/stylesheets/main.css +29 -0
  21. data/lib/active_admin/csv_builder.rb +1 -2
  22. data/lib/active_admin/generators/boilerplate.rb +12 -4
  23. data/lib/active_admin/resource.rb +13 -0
  24. data/lib/active_admin/resource/belongs_to.rb +3 -0
  25. data/lib/active_admin/resource/model.rb +15 -0
  26. data/lib/active_admin/resource/routes.rb +11 -3
  27. data/lib/active_admin/resource_controller.rb +2 -0
  28. data/lib/active_admin/resource_controller/polymorphic_routes.rb +36 -0
  29. data/lib/active_admin/version.rb +1 -1
  30. data/lib/active_admin/views/components/paginated_collection.rb +1 -1
  31. data/lib/active_admin/views/index_as_table.rb +7 -0
  32. data/lib/generators/active_admin/resource/templates/admin.rb.erb +4 -2
  33. metadata +13 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e70a90d683c4af1876248495c8c055e9eb21669bac351b42dcdeb175f9003c62
4
- data.tar.gz: 9f8029a8686ff5dd00932a248f620b1481c1d493f4d10594dc4549de07d269a8
3
+ metadata.gz: 7c8782460aa60e1293d44be5e3b998002e34794150cebf3c4effc6ba409149d8
4
+ data.tar.gz: b5834e4dc64f9043142376093ace0ddf0af7119f1a4dbba257ed344a4ac7079a
5
5
  SHA512:
6
- metadata.gz: cdd5161de2dd77f1a01d4eae59f09c16c2f1aa356142a1add9fa7cfe8516bdff1676ebf98d0162c6ec736d0bdfaaba6a4f86b73664c734ac54b54a82d2808cd0
7
- data.tar.gz: 4da12f46a43f27af9d4301520dfd337f31efe340890c8b255a0f11e92015996395d9a1f135a7f8a0f34534de493570ff065bff339b5e621837a06dcaf8985064
6
+ metadata.gz: c55ad8c616ffee8776434ac4626351a4e789a9cb4d0771da2c548517d9854c5c3fa66f3e9b856831c625bc8f0f8c6afe85d3cf9f28101ec54467fce8d97b43cc
7
+ data.tar.gz: 336e001de67c48174e8611f20007dc2a762eac47f09a4d6b3ad4ee6deb090410d072c58d1e3f61e8fc4a4cf1615e4a633f8210abd93979dd07a2d55f2510d4ef
@@ -2,6 +2,22 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 2.3.0 [☰](https://github.com/activeadmin/activeadmin/compare/v2.2.0..v2.3.0)
6
+
7
+ ### Enhancements
8
+
9
+ #### Minor
10
+
11
+ * Bump minimum ransack requirement to make sure everyone gets a version that works ok with all supported versions of Rails. [#5831] by [@deivid-rodriguez]
12
+
13
+ ### Bug Fixes
14
+
15
+ * Fix CSVBuilder not respecting `ActiveAdmin.application.csv_options = { humanize_name: false }` setting. [#5800] by [@HappyKadaver]
16
+ * Fix crash when displaying current filters after filtering by a nested resource. [#5816] by [@deivid-rodriguez]
17
+ * Fix pagination when `pagination_total` is false to not show a "Last" link, since it's incorrect because we don't have the total pages information. [#5822] by [@deivid-rodriguez]
18
+ * Fix optional nested resources causing incorrect routes to be generated, when renamed resources (through `:as` option) are involved. [#5826] by [@ndbroadbent], [@Kris-LIBIS] and [@deivid-rodriguez]
19
+ * Fix double modal issue in applications using turbolinks 5. [#5842] by [@sgara]
20
+
5
21
  ## 2.2.0 [☰](https://github.com/activeadmin/activeadmin/compare/v2.1.0..v2.2.0)
6
22
 
7
23
  ### Enhancements
@@ -474,8 +490,14 @@ Please check [0-6-stable] for previous changes.
474
490
  [#5758]: https://github.com/activeadmin/activeadmin/pull/5758
475
491
  [#5777]: https://github.com/activeadmin/activeadmin/pull/5777
476
492
  [#5794]: https://github.com/activeadmin/activeadmin/pull/5794
493
+ [#5800]: https://github.com/activeadmin/activeadmin/pull/5800
477
494
  [#5801]: https://github.com/activeadmin/activeadmin/pull/5801
478
495
  [#5802]: https://github.com/activeadmin/activeadmin/pull/5802
496
+ [#5816]: https://github.com/activeadmin/activeadmin/pull/5816
497
+ [#5822]: https://github.com/activeadmin/activeadmin/pull/5822
498
+ [#5826]: https://github.com/activeadmin/activeadmin/pull/5826
499
+ [#5831]: https://github.com/activeadmin/activeadmin/pull/5831
500
+ [#5842]: https://github.com/activeadmin/activeadmin/pull/5842
479
501
 
480
502
  [@5t111111]: https://github.com/5t111111
481
503
  [@aarek]: https://github.com/aarek
@@ -503,6 +525,7 @@ Please check [0-6-stable] for previous changes.
503
525
  [@Fivell]: https://github.com/Fivell
504
526
  [@glebtv]: https://github.com/glebtv
505
527
  [@gonzedge]: https://github.com/gonzedge
528
+ [@HappyKadaver]: https://github.com/HappyKadaver
506
529
  [@innparusu95]: https://github.com/innparusu95
507
530
  [@ionut998]: https://github.com/ionut998
508
531
  [@jasl]: https://github.com/jasl
@@ -544,3 +567,6 @@ Please check [0-6-stable] for previous changes.
544
567
  [@panasyuk]: https://github.com/panasyuk
545
568
  [@jscheid]: https://github.com/jscheid
546
569
  [@violeta-p]: https://github.com/violeta-p
570
+ [@ndbroadbent]: https://github.com/ndbroadbent
571
+ [@Kris-LIBIS]: https://github.com/Kris-LIBIS
572
+ [@sgara]: https://github.com/sgara
@@ -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 and [chromedriver] installed in order to run cucumber
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
 
@@ -41,7 +40,7 @@ Now you should be able to run the entire suite using:
41
40
  bin/rake
42
41
  ```
43
42
 
44
- The test run will generate a sample Rails application in `tmp/rails` to run the
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
@@ -95,7 +94,7 @@ 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 `.test-rails-apps` folder.
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:
@@ -204,7 +203,6 @@ Maintainers need to do the following to push out a release:
204
203
  * `bin/rake release`
205
204
 
206
205
  [chandler]: https://github.com/mattbrictson/chandler#2-configure-credentials
207
- [chromedriver]: https://sites.google.com/a/chromium.org/chromedriver/getting-started
208
206
  [mailing list]: http://groups.google.com/group/activeadmin
209
207
  [Stack Overflow]: http://stackoverflow.com/questions/tagged/activeadmin
210
208
  [search the issue tracker]: https://github.com/activeadmin/activeadmin/issues?q=something
data/README.md CHANGED
@@ -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.
@@ -39,7 +44,7 @@ to ask.
39
44
  ## Want to support us?
40
45
 
41
46
  If you want to support us financially, you can [help fund the project
42
- through a Tidelift subscription][tidelift]. By buying a Tidelift subscription
47
+ through a Tidelift subscription][tidelift_support]. By buying a Tidelift subscription
43
48
  you make sure your whole dependency stack is properly maintained, while also
44
49
  getting a comprehensive view of outdated dependencies, new releases, security
45
50
  alerts, and licensing compatibility issues.
@@ -96,6 +101,8 @@ Thanks to [Open Collective][opencollective contributors] and all our Open Collec
96
101
  [inch]: http://inch-ci.org/github/activeadmin/activeadmin
97
102
  [tidelift_badge]: https://tidelift.com/badges/github/activeadmin/activeadmin
98
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
99
106
 
100
107
  [docs]: http://activeadmin.info/0-installation.html
101
108
  [demo]: http://demo.activeadmin.info/admin
@@ -1,9 +1,13 @@
1
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
+
2
6
  //
3
7
  // Use ActiveAdmin.modal_dialog to prompt user if
4
8
  // confirmation is required for current Batch Action
5
9
  //
6
- $('.batch_actions_selector li a').click(function(event){
10
+ $('.batch_actions_selector li a').on('click', function(event){
7
11
  let message;
8
12
  event.stopPropagation(); // prevent Rails UJS click event
9
13
  event.preventDefault();
@@ -0,0 +1,11 @@
1
+ <%# Link to the "First" page
2
+ - available local variables
3
+ url: url to the first page
4
+ current_page: a page object for the currently displayed page
5
+ total_pages: total number of pages
6
+ per_page: number of items to fetch per page
7
+ remote: data-remote
8
+ -%>
9
+ <span class="first">
10
+ <%= link_to_unless current_page.first?, t('views.pagination.first').html_safe, url, remote: remote %>
11
+ </span>
@@ -0,0 +1,8 @@
1
+ <%# Non-link tag that stands for skipped pages...
2
+ - available local variables
3
+ current_page: a page object for the currently displayed page
4
+ total_pages: total number of pages
5
+ per_page: number of items to fetch per page
6
+ remote: data-remote
7
+ -%>
8
+ <span class="page gap"><%= t('views.pagination.truncate').html_safe %></span>
@@ -0,0 +1,11 @@
1
+ <%# Link to the "Next" page
2
+ - available local variables
3
+ url: url to the next page
4
+ current_page: a page object for the currently displayed page
5
+ total_pages: total number of pages
6
+ per_page: number of items to fetch per page
7
+ remote: data-remote
8
+ -%>
9
+ <span class="next">
10
+ <%= link_to_unless current_page.last?, t('views.pagination.next').html_safe, url, rel: 'next', remote: remote %>
11
+ </span>
@@ -0,0 +1,12 @@
1
+ <%# Link showing page number
2
+ - available local variables
3
+ page: a page object for "this" page
4
+ url: url to this page
5
+ current_page: a page object for the currently displayed page
6
+ total_pages: total number of pages
7
+ per_page: number of items to fetch per page
8
+ remote: data-remote
9
+ -%>
10
+ <span class="page<%= ' current' if page.current? %>">
11
+ <%= link_to_unless page.current?, page, url, {remote: remote, rel: page.rel} %>
12
+ </span>
@@ -0,0 +1,24 @@
1
+ <%# The container tag
2
+ - available local variables
3
+ current_page: a page object for the currently displayed page
4
+ total_pages: total number of pages
5
+ per_page: number of items to fetch per page
6
+ remote: data-remote
7
+ paginator: the paginator that renders the pagination tags inside
8
+ -%>
9
+ <%= paginator.render do -%>
10
+ <nav class="pagination">
11
+ <%= first_page_tag unless current_page.first? %>
12
+ <%= prev_page_tag unless current_page.first? %>
13
+ <% each_page do |page| -%>
14
+ <% if page.display_tag? -%>
15
+ <%= page_tag page %>
16
+ <% elsif !page.was_truncated? -%>
17
+ <%= gap_tag %>
18
+ <% end -%>
19
+ <% end -%>
20
+ <% unless current_page.out_of_range? %>
21
+ <%= next_page_tag unless current_page.last? %>
22
+ <% end %>
23
+ </nav>
24
+ <% end -%>
@@ -0,0 +1,11 @@
1
+ <%# Link to the "Previous" page
2
+ - available local variables
3
+ url: url to the previous page
4
+ current_page: a page object for the currently displayed page
5
+ total_pages: total number of pages
6
+ per_page: number of items to fetch per page
7
+ remote: data-remote
8
+ -%>
9
+ <span class="prev">
10
+ <%= link_to_unless current_page.first?, t('views.pagination.previous').html_safe, url, rel: 'prev', remote: remote %>
11
+ </span>
@@ -1,4 +1,3 @@
1
- #encoding: utf-8
2
1
  ca:
3
2
  active_admin:
4
3
  dashboard: Tauler
@@ -355,7 +355,7 @@ end
355
355
  ```
356
356
 
357
357
  If you need to completely replace the record retrieving code (e.g., you have a
358
- custom `to_param` implementation in your models), override the `resource` method
358
+ custom `to_param` implementation in your models), override the `find_resource` method
359
359
  on the controller:
360
360
 
361
361
  ```ruby
@@ -193,6 +193,13 @@ controller do
193
193
  end
194
194
  ```
195
195
 
196
+ You can also define associated objects to include outside of the
197
+ `scoped_collection` method:
198
+
199
+ ```ruby
200
+ includes :publisher
201
+ ```
202
+
196
203
  Then it's simple to sort by any Publisher attribute from within the index table:
197
204
 
198
205
  ```ruby
@@ -1,4 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'github-pages'
4
- gem 'jekyll-redirect-from'
@@ -198,15 +198,15 @@ GEM
198
198
  rb-inotify (~> 0.9, >= 0.9.7)
199
199
  ruby_dep (~> 1.2)
200
200
  mercenary (0.3.6)
201
- mini_portile2 (2.3.0)
201
+ mini_portile2 (2.4.0)
202
202
  minima (2.5.0)
203
203
  jekyll (~> 3.5)
204
204
  jekyll-feed (~> 0.9)
205
205
  jekyll-seo-tag (~> 2.1)
206
206
  minitest (5.11.3)
207
207
  multipart-post (2.0.0)
208
- nokogiri (1.8.5)
209
- mini_portile2 (~> 2.3.0)
208
+ nokogiri (1.10.4)
209
+ mini_portile2 (~> 2.4.0)
210
210
  octokit (4.12.0)
211
211
  sawyer (~> 0.8.0, >= 0.5.3)
212
212
  pathutil (0.16.1)
@@ -243,7 +243,6 @@ PLATFORMS
243
243
 
244
244
  DEPENDENCIES
245
245
  github-pages
246
- jekyll-redirect-from
247
246
 
248
247
  BUNDLED WITH
249
248
  1.16.5
@@ -1,2 +1,4 @@
1
1
  plugins:
2
+ - jekyll-default-layout
2
3
  - jekyll-redirect-from
4
+ - jekyll-relative-links
@@ -8,9 +8,9 @@
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=readme" target="_blank">
11
+ <a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=homepage" target="_blank">
12
12
  <span class="cta">
13
- Get license assurances and timely security notifications
13
+ Active Admin for enterprise available via Tidelift
14
14
  </span>
15
15
  </a>
16
16
  </div>
@@ -10,81 +10,101 @@
10
10
  <p class="intro">
11
11
  The <strong>administration framework</strong> for business critical <strong>Ruby on Rails</strong> applications.
12
12
  </p>
13
+
13
14
  <p>
14
15
  Active Admin is a Ruby on Rails plugin for generating administration style interfaces. It abstracts common business application patterns to make it simple for developers to implement beautiful and elegant interfaces with very little effort.
15
16
  </p>
17
+
16
18
  <h2>
17
19
  A beautiful interface designed for real people.
18
20
  </h2>
21
+
19
22
  <div id="features">
20
23
  <div id="features-left">
21
24
  <h3 class="first">
22
25
  Global Navigation
23
26
  </h3>
27
+
24
28
  <p>
25
29
  Customizable global navigation allows you to create usable admin interfaces for your business.
26
30
  </p>
31
+
27
32
  <h3>
28
33
  Scopes
29
34
  </h3>
35
+
30
36
  <p>
31
37
  Use scopes to create sections of mutually exclusive resources for quick navigation and reporting.
32
38
  </p>
39
+
33
40
  <h3>
34
41
  Index Styles
35
42
  </h3>
43
+
36
44
  <p>
37
45
  Index screens are available in many styles. The default, shown here, is a table view, but Active Admin also supports Grids, Blocks and a Blog view.
38
46
  </p>
47
+
39
48
  <h3>
40
49
  <span class="caps">API</span> &amp; Downloads
41
50
  </h3>
51
+
42
52
  <p>
43
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.
44
54
  </p>
45
55
  </div>
56
+
46
57
  <div id="features-right">
47
58
  <h3 class="first">
48
59
  User Authentication
49
60
  </h3>
61
+
50
62
  <p>
51
63
  Use the bundled Devise configuration or implement your own authorization using the provided hooks.
52
64
  </p>
65
+
53
66
  <h3>
54
67
  Action Items
55
68
  </h3>
69
+
56
70
  <p>
57
71
  Add buttons, links or other content in the “Action Items” section on each screen.
58
72
  </p>
73
+
59
74
  <h3>
60
75
  Filters
61
76
  </h3>
77
+
62
78
  <p>
63
79
  Allow users to filter resources by searching strings, text fields, dates, and numeric values.
64
80
  </p>
81
+
65
82
  <h3>
66
83
  Sidebar Sections
67
84
  </h3>
85
+
68
86
  <p>
69
87
  Customize the sidebar sections with a simple <span class="caps">DSL</span> built in to Active Admin.
70
88
  </p>
71
89
  </div>
72
90
  </div>
91
+
73
92
  <p>
74
93
  Active Admin’s interface was designed from the ground up for non-technical users. It makes it easy for developers to build highly usable interfaces that customers will actually enjoy using.
75
94
  </p>
95
+
76
96
  <h2>
77
97
  An elegant <span class="caps">DSL</span> built for developer productivity.
78
98
  </h2>
99
+
79
100
  <p>
80
101
  Get started with one line of code or customize the entire interface with the provided <span class="caps">DSL</span>.
81
102
  </p>
103
+
82
104
  <div id="dsl">
83
105
  <div class="highlight">
84
- <pre>
85
- <code class="ruby"><span class="c1"># app/admin/products.rb</span>
106
+ <pre><code class="ruby"><span class="c1"># app/admin/products.rb</span>
86
107
  <span class="no">ActiveAdmin</span><span class="o">.</span><span class="n">register</span> <span class="no">Product</span> <span class="k">do</span>
87
-
88
108
  <span class="c1"># Create sections on the index screen</span>
89
109
  <span class="n">scope</span> <span class="ss">:all</span><span class="p">,</span> <span class="ss">default:</span> <span class="kp">true</span>
90
110
  <span class="n">scope</span> <span class="ss">:available</span>
@@ -104,12 +124,93 @@
104
124
  <span class="k">end</span>
105
125
  <span class="n">actions</span>
106
126
  <span class="k">end</span>
107
-
108
- <span class="k">end</span>
109
- </code>
110
- </pre>
127
+ <span class="k">end</span></code></pre>
111
128
  </div>
112
129
  </div>
130
+
131
+ <h2>
132
+ Active Admin for enterprise
133
+ </h2>
134
+
135
+ <p>
136
+ <a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=homepage">
137
+ Available as part of the Tidelift Subscription
138
+ </a>
139
+ </p>
140
+
141
+ <p>
142
+ Active Admin and the maintainers of thousands of other packages are
143
+ working with Tidelift to deliver one enterprise subscription that
144
+ covers all of the open source you use.
145
+ </p>
146
+
147
+ <p>
148
+ If you want the flexibility of open source and the confidence of
149
+ commercial-grade software, this is for you.
150
+ </p>
151
+
152
+ <div class="tidelift-buttons">
153
+ <a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=referral" target="_blank">
154
+ <span>LEARN MORE</span>
155
+ </a>
156
+
157
+ <a href="https://tidelift.com/subscription/request-a-demo?utm_source=rubygems-activeadmin&utm_medium=referral" target="_blank">
158
+ <span>REQUEST A DEMO</span>
159
+ </a>
160
+ </div>
161
+
162
+ <h3>
163
+ The Tidelift Subscription manages your dependencies for you.
164
+ </h3>
165
+
166
+ <ul>
167
+ <li>
168
+ Get the tools you need to continuously catalog and understand the open source software that your application depends on.
169
+ </li>
170
+
171
+ <li>
172
+ Your subscription helps pay the open source maintainers of the exact
173
+ packages you use to ensure they meet the standards you require.
174
+ </li>
175
+
176
+ <li>
177
+ Address issues proactively, with tools that scan for new security,
178
+ licensing, and maintenance issues, and alert our participating open
179
+ source maintainers so they can resolve them on your behalf.
180
+ </li>
181
+
182
+ <li>
183
+ Measure and improve your open source dependencies' health—which
184
+ improves your app’s health—and get a short list of high-impact steps
185
+ your team can take to improve them even more.
186
+ </li>
187
+
188
+ <li>
189
+ Get commercial assurances that don't come for free with open source
190
+ packages, like intellectual property indemnification and support
191
+ under a service level agreement. You expect these guarantees from
192
+ proprietary software, and you can have them when using open source
193
+ as well.
194
+ </li>
195
+ </ul>
196
+
197
+ <p>
198
+ The end result? All of the capabilities you expect from
199
+ commercial-grade software, for the full breadth of open source you
200
+ use. That means less time grappling with esoteric open source trivia,
201
+ and more time building your own applications—and your business.
202
+ </p>
203
+
204
+ <div class="tidelift-buttons">
205
+ <a href="https://tidelift.com/subscription/pkg/rubygems-activeadmin?utm_source=rubygems-activeadmin&utm_medium=referral" target="_blank">
206
+ <span>LEARN MORE</span>
207
+ </a>
208
+
209
+ <a href="https://tidelift.com/subscription/request-a-demo?utm_source=rubygems-activeadmin&utm_medium=referral" target="_blank">
210
+ <span>REQUEST A DEMO</span>
211
+ </a>
212
+ </div>
213
+
113
214
  <h2 class="getting-started-heading">
114
215
  3 Ways to Get Started:
115
216
  </h2>
@@ -615,6 +615,35 @@ body #tidelift a .cta {
615
615
  padding-left: 30px;
616
616
  }
617
617
 
618
+ body .tidelift-buttons a {
619
+ display: table;
620
+ width: 200px;
621
+ border: 2px solid #407985;
622
+ border-radius: 4px;
623
+ text-decoration: none;
624
+ font-family: 'Yanone Kaffeesatz', 'Helvetica Neue', Arial, Helvetica, sans-serif;
625
+ font-size: 18px;
626
+ letter-spacing: 1px;
627
+ margin: 0 10px;
628
+ }
629
+
630
+ body .tidelift-buttons a:first-child {
631
+ float: left;
632
+ color: #407985;
633
+ background: #FFF;
634
+ }
635
+
636
+ body .tidelift-buttons a:last-child {
637
+ color: #FFF;
638
+ background: #407985;
639
+ }
640
+
641
+ body .tidelift-buttons a span {
642
+ display: table-cell;
643
+ vertical-align: middle;
644
+ text-align: center;
645
+ }
646
+
618
647
  body .clear {
619
648
  clear: both;
620
649
  }
@@ -33,7 +33,7 @@ module ActiveAdmin
33
33
  def initialize(options = {}, &block)
34
34
  @resource = options.delete(:resource)
35
35
  @columns = []
36
- @options = options
36
+ @options = ActiveAdmin.application.csv_options.merge options
37
37
  @block = block
38
38
  end
39
39
 
@@ -44,7 +44,6 @@ module ActiveAdmin
44
44
  def build(controller, csv)
45
45
  @collection = controller.send :find_collection, except: :pagination
46
46
  columns = exec_columns controller.view_context
47
- options = ActiveAdmin.application.csv_options.merge self.options
48
47
  bom = options.delete :byte_order_mark
49
48
  column_names = options.delete(:column_names) { true }
50
49
  csv_options = options.except :encoding_options, :humanize_name
@@ -9,8 +9,16 @@ module ActiveAdmin
9
9
  @class_name.constantize.new.attributes.keys
10
10
  end
11
11
 
12
+ def assignable_attributes
13
+ attributes - %w(id created_at updated_at)
14
+ end
15
+
16
+ def permit_params
17
+ assignable_attributes.map { |a| a.to_sym.inspect }.join(', ')
18
+ end
19
+
12
20
  def rows
13
- attributes.map { |a| row(a) }.join("\n")
21
+ attributes.map { |a| row(a) }.join("\n ")
14
22
  end
15
23
 
16
24
  def row(name)
@@ -18,7 +26,7 @@ module ActiveAdmin
18
26
  end
19
27
 
20
28
  def columns
21
- attributes.map { |a| column(a) }.join("\n")
29
+ attributes.map { |a| column(a) }.join("\n ")
22
30
  end
23
31
 
24
32
  def column(name)
@@ -26,7 +34,7 @@ module ActiveAdmin
26
34
  end
27
35
 
28
36
  def filters
29
- attributes.map { |a| filter(a) }.join("\n")
37
+ attributes.map { |a| filter(a) }.join("\n ")
30
38
  end
31
39
 
32
40
  def filter(name)
@@ -34,7 +42,7 @@ module ActiveAdmin
34
42
  end
35
43
 
36
44
  def form_inputs
37
- attributes.reject { |a| %w(id created_at updated_at).include? a }.map { |a| form_input(a) }.join("\n")
45
+ assignable_attributes.map { |a| form_input(a) }.join("\n ")
38
46
  end
39
47
 
40
48
  def form_input(name)
@@ -12,6 +12,7 @@ require 'active_admin/resource/scope_to'
12
12
  require 'active_admin/resource/sidebars'
13
13
  require 'active_admin/resource/belongs_to'
14
14
  require 'active_admin/resource/ordering'
15
+ require 'active_admin/resource/model'
15
16
 
16
17
  module ActiveAdmin
17
18
 
@@ -104,6 +105,10 @@ module ActiveAdmin
104
105
  ActiveSupport::Dependencies.constantize(decorator_class_name) if decorator_class_name
105
106
  end
106
107
 
108
+ def resource_name_extension
109
+ @resource_name_extension ||= define_resource_name_extension(self)
110
+ end
111
+
107
112
  def resource_table_name
108
113
  resource_class.quoted_table_name
109
114
  end
@@ -133,6 +138,7 @@ module ActiveAdmin
133
138
  def belongs_to(target, options = {})
134
139
  @belongs_to = Resource::BelongsTo.new(self, target, options)
135
140
  self.menu_item_options = false if @belongs_to.required?
141
+ options[:class_name] ||= @belongs_to.resource.resource_class_name if @belongs_to.resource
136
142
  controller.send :belongs_to, target, options.dup
137
143
  end
138
144
 
@@ -203,5 +209,12 @@ module ActiveAdmin
203
209
  @default_csv_builder ||= CSVBuilder.default_for_resource(self)
204
210
  end
205
211
 
212
+ def define_resource_name_extension(resource)
213
+ Module.new do
214
+ define_method :model_name do
215
+ resource.resource_name
216
+ end
217
+ end
218
+ end
206
219
  end # class Resource
207
220
  end # module ActiveAdmin
@@ -14,6 +14,9 @@ module ActiveAdmin
14
14
  # The resource which initiated this relationship
15
15
  attr_reader :owner
16
16
 
17
+ # The name of the relation
18
+ attr_reader :target_name
19
+
17
20
  def initialize(owner, target_name, options = {})
18
21
  @owner = owner
19
22
  @target_name = target_name
@@ -0,0 +1,15 @@
1
+ module ActiveAdmin
2
+ class Model
3
+ def initialize(resource, record)
4
+ @record = record
5
+
6
+ if resource
7
+ @record.extend(resource.resource_name_extension)
8
+ end
9
+ end
10
+
11
+ def to_model
12
+ @record
13
+ end
14
+ end
15
+ end
@@ -110,7 +110,7 @@ module ActiveAdmin
110
110
  # @return params to pass to instance path
111
111
  def route_instance_params(instance)
112
112
  if nested?
113
- [instance.public_send(belongs_to_name).to_param, instance.to_param]
113
+ [instance.public_send(belongs_to_target_name).to_param, instance.to_param]
114
114
  else
115
115
  instance.to_param
116
116
  end
@@ -123,11 +123,19 @@ module ActiveAdmin
123
123
  end
124
124
 
125
125
  def nested?
126
- resource.belongs_to? && resource.belongs_to_config.required?
126
+ resource.belongs_to? && belongs_to_config.required?
127
+ end
128
+
129
+ def belongs_to_target_name
130
+ belongs_to_config.target_name
127
131
  end
128
132
 
129
133
  def belongs_to_name
130
- resource.belongs_to_config.target.resource_name.singular if nested?
134
+ belongs_to_config.target.resource_name.singular
135
+ end
136
+
137
+ def belongs_to_config
138
+ resource.belongs_to_config
131
139
  end
132
140
 
133
141
  def routes
@@ -1,6 +1,7 @@
1
1
  require 'active_admin/resource_controller/action_builder'
2
2
  require 'active_admin/resource_controller/data_access'
3
3
  require 'active_admin/resource_controller/decorators'
4
+ require 'active_admin/resource_controller/polymorphic_routes'
4
5
  require 'active_admin/resource_controller/scoping'
5
6
  require 'active_admin/resource_controller/streaming'
6
7
  require 'active_admin/resource_controller/sidebars'
@@ -18,6 +19,7 @@ module ActiveAdmin
18
19
  include ActionBuilder
19
20
  include Decorators
20
21
  include DataAccess
22
+ include PolymorphicRoutes
21
23
  include Scoping
22
24
  include Streaming
23
25
  include Sidebars
@@ -0,0 +1,36 @@
1
+ require "active_admin/resource"
2
+ require "active_admin/resource/model"
3
+
4
+ module ActiveAdmin
5
+ class ResourceController < BaseController
6
+ module PolymorphicRoutes
7
+ def polymorphic_url(record_or_hash_or_array, options = {})
8
+ super(map_named_resources_for(record_or_hash_or_array), options)
9
+ end
10
+
11
+ def polymorphic_path(record_or_hash_or_array, options = {})
12
+ super(map_named_resources_for(record_or_hash_or_array), options)
13
+ end
14
+
15
+ private
16
+
17
+ def map_named_resources_for(record_or_hash_or_array)
18
+ return record_or_hash_or_array unless record_or_hash_or_array.is_a?(Array)
19
+
20
+ record_or_hash_or_array.map { |record| to_named_resource(record) }
21
+ end
22
+
23
+ def to_named_resource(record)
24
+ if record.is_a?(resource_class)
25
+ return ActiveAdmin::Model.new(active_admin_config, record)
26
+ end
27
+
28
+ if record.is_a?(parent.class)
29
+ return ActiveAdmin::Model.new(active_admin_config.belongs_to_config.resource, record)
30
+ end
31
+
32
+ record
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,3 +1,3 @@
1
1
  module ActiveAdmin
2
- VERSION = '2.2.0'
2
+ VERSION = '2.3.0'
3
3
  end
@@ -92,7 +92,7 @@ module ActiveAdmin
92
92
  end
93
93
 
94
94
  def build_pagination
95
- options = { theme: 'active_admin' }
95
+ options = { theme: @display_total ? 'active_admin' : 'active_admin_countless' }
96
96
  options[:params] = @params if @params
97
97
  options[:param_name] = @param_name if @param_name
98
98
 
@@ -192,6 +192,13 @@ module ActiveAdmin
192
192
  # end
193
193
  # ```
194
194
  #
195
+ # You can also define associated objects to include outside of the
196
+ # `scoped_collection` method:
197
+ #
198
+ # ```ruby
199
+ # includes :publisher
200
+ # ```
201
+ #
195
202
  # Then it's simple to sort by any Publisher attribute from within the index table:
196
203
  #
197
204
  # ```ruby
@@ -3,12 +3,14 @@ ActiveAdmin.register <%= class_name %> do
3
3
  # See permitted parameters documentation:
4
4
  # https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
5
5
  #
6
- # permit_params :list, :of, :attributes, :on, :model
6
+ # Uncomment all parameters which should be permitted for assignment
7
+ #
8
+ # permit_params <%= @boilerplate.permit_params %>
7
9
  #
8
10
  # or
9
11
  #
10
12
  # permit_params do
11
- # permitted = [:permitted, :attributes]
13
+ # permitted = [<%= @boilerplate.permit_params %>]
12
14
  # permitted << :other if params[:action] == 'create' && current_user.admin?
13
15
  # permitted
14
16
  # 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.2.0
4
+ version: 2.3.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-07-15 00:00:00.000000000 Z
18
+ date: 2019-09-12 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: arbre
@@ -139,20 +139,14 @@ dependencies:
139
139
  requirements:
140
140
  - - "~>"
141
141
  - !ruby/object:Gem::Version
142
- version: '2.1'
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: 2.1.1
142
+ version: '2.3'
146
143
  type: :runtime
147
144
  prerelease: false
148
145
  version_requirements: !ruby/object:Gem::Requirement
149
146
  requirements:
150
147
  - - "~>"
151
148
  - !ruby/object:Gem::Version
152
- version: '2.1'
153
- - - ">="
154
- - !ruby/object:Gem::Version
155
- version: 2.1.1
149
+ version: '2.3'
156
150
  - !ruby/object:Gem::Dependency
157
151
  name: sassc-rails
158
152
  requirement: !ruby/object:Gem::Requirement
@@ -302,6 +296,12 @@ files:
302
296
  - app/views/kaminari/active_admin/_page.html.erb
303
297
  - app/views/kaminari/active_admin/_paginator.html.erb
304
298
  - app/views/kaminari/active_admin/_prev_page.html.erb
299
+ - app/views/kaminari/active_admin_countless/_first_page.html.erb
300
+ - app/views/kaminari/active_admin_countless/_gap.html.erb
301
+ - app/views/kaminari/active_admin_countless/_next_page.html.erb
302
+ - app/views/kaminari/active_admin_countless/_page.html.erb
303
+ - app/views/kaminari/active_admin_countless/_paginator.html.erb
304
+ - app/views/kaminari/active_admin_countless/_prev_page.html.erb
305
305
  - app/views/layouts/active_admin.html.arb
306
306
  - app/views/layouts/active_admin_logged_out.html.erb
307
307
  - config/locales/ar.yml
@@ -471,6 +471,7 @@ files:
471
471
  - lib/active_admin/resource/controllers.rb
472
472
  - lib/active_admin/resource/includes.rb
473
473
  - lib/active_admin/resource/menu.rb
474
+ - lib/active_admin/resource/model.rb
474
475
  - lib/active_admin/resource/naming.rb
475
476
  - lib/active_admin/resource/ordering.rb
476
477
  - lib/active_admin/resource/page_presenters.rb
@@ -484,6 +485,7 @@ files:
484
485
  - lib/active_admin/resource_controller/action_builder.rb
485
486
  - lib/active_admin/resource_controller/data_access.rb
486
487
  - lib/active_admin/resource_controller/decorators.rb
488
+ - lib/active_admin/resource_controller/polymorphic_routes.rb
487
489
  - lib/active_admin/resource_controller/resource_class_methods.rb
488
490
  - lib/active_admin/resource_controller/scoping.rb
489
491
  - lib/active_admin/resource_controller/sidebars.rb
@@ -607,7 +609,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
607
609
  - !ruby/object:Gem::Version
608
610
  version: '0'
609
611
  requirements: []
610
- rubygems_version: 3.0.4
612
+ rubygems_version: 3.0.6
611
613
  signing_key:
612
614
  specification_version: 4
613
615
  summary: Active Admin is a Ruby on Rails plugin for generating administration style