activeadmin 2.4.0 → 2.5.0

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

Potentially problematic release.


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

Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +43 -28
  3. data/CONTRIBUTING.md +47 -21
  4. data/app/assets/javascripts/active_admin/base.js +509 -0
  5. data/app/assets/stylesheets/active_admin/_base.scss +29 -29
  6. data/app/assets/stylesheets/active_admin/_header.scss +3 -5
  7. data/app/assets/stylesheets/active_admin/_mixins.scss +1 -1
  8. data/{vendor → app}/assets/stylesheets/active_admin/_normalize.scss +0 -0
  9. data/app/assets/stylesheets/active_admin/components/_tables.scss +1 -2
  10. data/app/assets/stylesheets/active_admin/mixins/_all.scss +8 -8
  11. data/app/assets/stylesheets/active_admin/mixins/_variables.scss +5 -0
  12. data/app/assets/stylesheets/active_admin/print.scss +2 -2
  13. data/app/assets/stylesheets/active_admin/structure/_main_structure.scss +1 -1
  14. data/app/javascript/active_admin/base.js +19 -0
  15. data/app/{assets/javascripts/active_admin/ext/jquery-ui.es6 → javascript/active_admin/ext/jquery-ui.js} +0 -0
  16. data/app/{assets/javascripts/active_admin/ext/jquery.es6 → javascript/active_admin/ext/jquery.js} +0 -0
  17. data/app/{assets/javascripts/active_admin/lib/batch_actions.es6 → javascript/active_admin/initializers/batch-actions.js} +4 -2
  18. data/app/javascript/active_admin/initializers/checkbox-toggler.js +3 -0
  19. data/app/{assets/javascripts/active_admin/initializers/datepicker.es6 → javascript/active_admin/initializers/datepicker.js} +0 -0
  20. data/app/javascript/active_admin/initializers/dropdown-menu.js +9 -0
  21. data/app/javascript/active_admin/initializers/filters.js +10 -0
  22. data/app/{assets/javascripts/active_admin/lib/has_many.es6 → javascript/active_admin/initializers/has-many.js} +0 -0
  23. data/app/javascript/active_admin/initializers/per-page.js +13 -0
  24. data/app/javascript/active_admin/initializers/table-checkbox-toggler.js +3 -0
  25. data/app/{assets/javascripts/active_admin/initializers/tabs.es6 → javascript/active_admin/initializers/tabs.js} +0 -0
  26. data/app/{assets/javascripts/active_admin/lib/checkbox-toggler.es6 → javascript/active_admin/lib/checkbox-toggler.js} +2 -2
  27. data/app/{assets/javascripts/active_admin/lib/dropdown-menu.es6 → javascript/active_admin/lib/dropdown-menu.js} +2 -9
  28. data/app/javascript/active_admin/lib/filters.js +39 -0
  29. data/app/{assets/javascripts/active_admin/lib/modal_dialog.es6 → javascript/active_admin/lib/modal-dialog.js} +3 -1
  30. data/app/javascript/active_admin/lib/per-page.js +38 -0
  31. data/app/{assets/javascripts/active_admin/lib/table-checkbox-toggler.es6 → javascript/active_admin/lib/table-checkbox-toggler.js} +4 -2
  32. data/app/javascript/active_admin/lib/utils.js +40 -0
  33. data/config/locales/az.yml +138 -0
  34. data/docs/1-general-configuration.md +20 -0
  35. data/docs/Gemfile.lock +55 -54
  36. data/lib/active_admin.rb +0 -1
  37. data/lib/active_admin/application.rb +1 -1
  38. data/lib/active_admin/filters/active_filter.rb +1 -1
  39. data/lib/active_admin/inputs/filters/date_range_input.rb +4 -4
  40. data/lib/active_admin/resource.rb +1 -1
  41. data/lib/active_admin/resource_controller/polymorphic_routes.rb +3 -2
  42. data/lib/active_admin/version.rb +1 -1
  43. data/lib/active_admin/views/components/paginated_collection.rb +1 -0
  44. data/lib/active_admin/views/components/table_for.rb +1 -0
  45. data/lib/active_admin/views/pages/base.rb +1 -1
  46. data/lib/active_admin/views/pages/index.rb +1 -0
  47. metadata +27 -43
  48. data/app/assets/images/active_admin/nested_menu_arrow.gif +0 -0
  49. data/app/assets/images/active_admin/nested_menu_arrow_dark.gif +0 -0
  50. data/app/assets/images/active_admin/orderable.png +0 -0
  51. data/app/assets/javascripts/active_admin/base.es6 +0 -23
  52. data/app/assets/javascripts/active_admin/initializers/filters.es6 +0 -45
  53. data/app/assets/javascripts/active_admin/lib/active_admin.es6 +0 -41
  54. data/app/assets/javascripts/active_admin/lib/per_page.es6 +0 -47
@@ -25,8 +25,9 @@ module ActiveAdmin
25
25
  return ActiveAdmin::Model.new(active_admin_config, record)
26
26
  end
27
27
 
28
- if record.is_a?(parent.class)
29
- return ActiveAdmin::Model.new(active_admin_config.belongs_to_config.resource, record)
28
+ belongs_to_resource = active_admin_config.belongs_to_config.try(:resource)
29
+ if belongs_to_resource && record.is_a?(belongs_to_resource.resource_class)
30
+ return ActiveAdmin::Model.new(belongs_to_resource, record)
30
31
  end
31
32
 
32
33
  record
@@ -1,3 +1,3 @@
1
1
  module ActiveAdmin
2
- VERSION = '2.4.0'
2
+ VERSION = '2.5.0'
3
3
  end
@@ -123,6 +123,7 @@ module ActiveAdmin
123
123
  entries_name = I18n.t "active_admin.pagination.entry", count: 2, default: 'entries'
124
124
  else
125
125
  key = "activerecord.models." + collection.first.class.model_name.i18n_key.to_s
126
+
126
127
  entry_name = I18n.translate key, count: 1, default: collection.first.class.name.underscore.sub('_', ' ')
127
128
  entries_name = I18n.translate key, count: collection.size, default: entry_name.pluralize
128
129
  end
@@ -13,6 +13,7 @@ module ActiveAdmin
13
13
  @collection = obj.respond_to?(:each) && !obj.is_a?(Hash) ? obj : [obj]
14
14
  @resource_class = options.delete(:i18n)
15
15
  @resource_class ||= @collection.klass if @collection.respond_to? :klass
16
+
16
17
  @columns = []
17
18
  @row_class = options.delete(:row_class)
18
19
 
@@ -33,7 +33,7 @@ module ActiveAdmin
33
33
  end
34
34
 
35
35
  active_admin_namespace.meta_tags.each do |name, content|
36
- text_node(tag(:meta, name: name, content: content))
36
+ text_node(meta(name: name, content: content))
37
37
  end
38
38
 
39
39
  active_admin_application.javascripts.each do |path|
@@ -124,6 +124,7 @@ module ActiveAdmin
124
124
 
125
125
  def render_index
126
126
  renderer_class = find_index_renderer_class(config[:as])
127
+
127
128
  paginator = config.fetch(:paginator, true)
128
129
  download_links = config.fetch(:download_links, active_admin_config.namespace.download_links)
129
130
  pagination_total = config.fetch(:pagination_total, true)
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.4.0
4
+ version: 2.5.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-10-03 00:00:00.000000000 Z
18
+ date: 2019-11-26 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: arbre
@@ -119,7 +119,7 @@ dependencies:
119
119
  requirements:
120
120
  - - ">="
121
121
  - !ruby/object:Gem::Version
122
- version: '5.0'
122
+ version: '5.2'
123
123
  - - "<"
124
124
  - !ruby/object:Gem::Version
125
125
  version: '6.1'
@@ -129,7 +129,7 @@ dependencies:
129
129
  requirements:
130
130
  - - ">="
131
131
  - !ruby/object:Gem::Version
132
- version: '5.0'
132
+ version: '5.2'
133
133
  - - "<"
134
134
  - !ruby/object:Gem::Version
135
135
  version: '6.1'
@@ -187,26 +187,6 @@ dependencies:
187
187
  - - "<"
188
188
  - !ruby/object:Gem::Version
189
189
  version: '4.1'
190
- - !ruby/object:Gem::Dependency
191
- name: sprockets-es6
192
- requirement: !ruby/object:Gem::Requirement
193
- requirements:
194
- - - "~>"
195
- - !ruby/object:Gem::Version
196
- version: '0.9'
197
- - - ">="
198
- - !ruby/object:Gem::Version
199
- version: 0.9.2
200
- type: :runtime
201
- prerelease: false
202
- version_requirements: !ruby/object:Gem::Requirement
203
- requirements:
204
- - - "~>"
205
- - !ruby/object:Gem::Version
206
- version: '0.9'
207
- - - ">="
208
- - !ruby/object:Gem::Version
209
- version: 0.9.2
210
190
  description: The administration framework for Ruby on Rails.
211
191
  email:
212
192
  - deivid.rodriguez@riseup.net
@@ -223,27 +203,12 @@ files:
223
203
  - CONTRIBUTING.md
224
204
  - LICENSE
225
205
  - README.md
226
- - app/assets/images/active_admin/nested_menu_arrow.gif
227
- - app/assets/images/active_admin/nested_menu_arrow_dark.gif
228
- - app/assets/images/active_admin/orderable.png
229
- - app/assets/javascripts/active_admin/base.es6
230
- - app/assets/javascripts/active_admin/ext/jquery-ui.es6
231
- - app/assets/javascripts/active_admin/ext/jquery.es6
232
- - app/assets/javascripts/active_admin/initializers/datepicker.es6
233
- - app/assets/javascripts/active_admin/initializers/filters.es6
234
- - app/assets/javascripts/active_admin/initializers/tabs.es6
235
- - app/assets/javascripts/active_admin/lib/active_admin.es6
236
- - app/assets/javascripts/active_admin/lib/batch_actions.es6
237
- - app/assets/javascripts/active_admin/lib/checkbox-toggler.es6
238
- - app/assets/javascripts/active_admin/lib/dropdown-menu.es6
239
- - app/assets/javascripts/active_admin/lib/has_many.es6
240
- - app/assets/javascripts/active_admin/lib/modal_dialog.es6
241
- - app/assets/javascripts/active_admin/lib/per_page.es6
242
- - app/assets/javascripts/active_admin/lib/table-checkbox-toggler.es6
206
+ - app/assets/javascripts/active_admin/base.js
243
207
  - app/assets/stylesheets/active_admin/_base.scss
244
208
  - app/assets/stylesheets/active_admin/_forms.scss
245
209
  - app/assets/stylesheets/active_admin/_header.scss
246
210
  - app/assets/stylesheets/active_admin/_mixins.scss
211
+ - app/assets/stylesheets/active_admin/_normalize.scss
247
212
  - app/assets/stylesheets/active_admin/_typography.scss
248
213
  - app/assets/stylesheets/active_admin/components/_batch_actions.scss
249
214
  - app/assets/stylesheets/active_admin/components/_blank_slates.scss
@@ -280,6 +245,25 @@ files:
280
245
  - app/assets/stylesheets/active_admin/structure/_footer.scss
281
246
  - app/assets/stylesheets/active_admin/structure/_main_structure.scss
282
247
  - app/assets/stylesheets/active_admin/structure/_title_bar.scss
248
+ - app/javascript/active_admin/base.js
249
+ - app/javascript/active_admin/ext/jquery-ui.js
250
+ - app/javascript/active_admin/ext/jquery.js
251
+ - app/javascript/active_admin/initializers/batch-actions.js
252
+ - app/javascript/active_admin/initializers/checkbox-toggler.js
253
+ - app/javascript/active_admin/initializers/datepicker.js
254
+ - app/javascript/active_admin/initializers/dropdown-menu.js
255
+ - app/javascript/active_admin/initializers/filters.js
256
+ - app/javascript/active_admin/initializers/has-many.js
257
+ - app/javascript/active_admin/initializers/per-page.js
258
+ - app/javascript/active_admin/initializers/table-checkbox-toggler.js
259
+ - app/javascript/active_admin/initializers/tabs.js
260
+ - app/javascript/active_admin/lib/checkbox-toggler.js
261
+ - app/javascript/active_admin/lib/dropdown-menu.js
262
+ - app/javascript/active_admin/lib/filters.js
263
+ - app/javascript/active_admin/lib/modal-dialog.js
264
+ - app/javascript/active_admin/lib/per-page.js
265
+ - app/javascript/active_admin/lib/table-checkbox-toggler.js
266
+ - app/javascript/active_admin/lib/utils.js
283
267
  - app/views/active_admin/devise/confirmations/new.html.erb
284
268
  - app/views/active_admin/devise/mailer/reset_password_instructions.html.erb
285
269
  - app/views/active_admin/devise/mailer/unlock_instructions.html.erb
@@ -311,6 +295,7 @@ files:
311
295
  - app/views/layouts/active_admin.html.arb
312
296
  - app/views/layouts/active_admin_logged_out.html.erb
313
297
  - config/locales/ar.yml
298
+ - config/locales/az.yml
314
299
  - config/locales/bg.yml
315
300
  - config/locales/bs.yml
316
301
  - config/locales/ca.yml
@@ -595,7 +580,6 @@ files:
595
580
  - vendor/assets/javascripts/jquery-ui/widgets/resizable.js
596
581
  - vendor/assets/javascripts/jquery-ui/widgets/sortable.js
597
582
  - vendor/assets/javascripts/jquery-ui/widgets/tabs.js
598
- - vendor/assets/stylesheets/active_admin/_normalize.scss
599
583
  homepage: https://activeadmin.info
600
584
  licenses:
601
585
  - MIT
@@ -615,7 +599,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
615
599
  - !ruby/object:Gem::Version
616
600
  version: '0'
617
601
  requirements: []
618
- rubygems_version: 3.0.3
602
+ rubygems_version: 3.0.6
619
603
  signing_key:
620
604
  specification_version: 4
621
605
  summary: Active Admin is a Ruby on Rails plugin for generating administration style
@@ -1,23 +0,0 @@
1
- //= require jquery3
2
- //= require jquery-ui/widgets/datepicker
3
- //= require jquery-ui/widgets/dialog
4
- //= require jquery-ui/widgets/sortable
5
- //= require jquery-ui/widgets/tabs
6
- //= require jquery-ui/widget
7
- //= require jquery_ujs
8
- //= require_self
9
- //= require ./ext/jquery
10
- //= require ./ext/jquery-ui
11
- //= require ./lib/active_admin
12
- //= require ./lib/batch_actions
13
- //= require ./lib/dropdown-menu
14
- //= require ./lib/has_many
15
- //= require ./lib/modal_dialog
16
- //= require ./lib/per_page
17
- //= require ./lib/checkbox-toggler
18
- //= require ./lib/table-checkbox-toggler
19
- //= require ./initializers/datepicker
20
- //= require ./initializers/filters
21
- //= require ./initializers/tabs
22
-
23
- window.ActiveAdmin = {}
@@ -1,45 +0,0 @@
1
- (($, ActiveAdmin) => {
2
-
3
- class Filters {
4
-
5
- static _clearForm(event) {
6
- const regex = /^(q\[|q%5B|q%5b|page|utf8|commit)/;
7
- const params = ActiveAdmin
8
- .queryStringToParams()
9
- .filter(({name}) => !name.match(regex));
10
-
11
- event.preventDefault();
12
-
13
- if (ActiveAdmin.turbolinks) {
14
- ActiveAdmin.turbolinksVisit(params);
15
- } else {
16
- window.location.search = ActiveAdmin.toQueryString(params);
17
- }
18
- }
19
-
20
- static _disableEmptyInputFields(event) {
21
- const params = $(this)
22
- .find(':input')
23
- .filter((i, input) => input.value === '')
24
- .prop({ disabled: true })
25
- .end()
26
- .serializeArray();
27
-
28
- if (ActiveAdmin.turbolinks) {
29
- event.preventDefault();
30
- ActiveAdmin.turbolinksVisit(params);
31
- }
32
- }
33
-
34
- static _setSearchType() {
35
- $(this).siblings('input').prop({name: `q[${this.value}]`});
36
- }
37
-
38
- }
39
-
40
- $(document).
41
- on('click', '.clear_filters_btn', Filters._clearForm).
42
- on('submit', '.filter_form', Filters._disableEmptyInputFields).
43
- on('change', '.filter_form_field.select_and_search select', Filters._setSearchType);
44
-
45
- })(jQuery, window.activeadmin);
@@ -1,41 +0,0 @@
1
- ((window, $) => {
2
-
3
- class ActiveAdmin {
4
-
5
- static get turbolinks() {
6
- return (typeof Turbolinks !== 'undefined' && Turbolinks.supported);
7
- }
8
-
9
- static turbolinksVisit(params) {
10
- const path = [window.location.pathname, '?', this.toQueryString(params)].join('')
11
- Turbolinks.visit(path);
12
- }
13
-
14
- static queryString() {
15
- return (window.location.search || '').replace(/^\?/, '');
16
- }
17
-
18
- static queryStringToParams() {
19
- const decode = (value) => decodeURIComponent((value || '').replace(/\+/g, '%20'));
20
-
21
- return this.queryString()
22
- .split("&")
23
- .map(pair => pair.split("="))
24
- .map(([key, value]) => {
25
- return { name: decode(key), value: decode(value) }
26
- });
27
- }
28
-
29
- static toQueryString(params) {
30
- const encode = (value) => encodeURIComponent(value || '');
31
-
32
- return params
33
- .map(({name, value}) => [ encode(name), encode(value) ])
34
- .map(pair => pair.join('='))
35
- .join('&')
36
- }
37
- }
38
-
39
- window.activeadmin = ActiveAdmin
40
-
41
- })(window, jQuery);
@@ -1,47 +0,0 @@
1
- (($, ActiveAdmin) => {
2
-
3
- class PerPage {
4
- constructor(element) {
5
- this.element = element;
6
- }
7
-
8
- update() {
9
- const params = ActiveAdmin
10
- .queryStringToParams()
11
- .filter(({name}) => name != 'per_page' || name != 'page')
12
-
13
- params.push({ name: 'per_page', value: this.element.value });
14
-
15
- if (ActiveAdmin.turbolinks) {
16
- ActiveAdmin.turbolinksVisit(params);
17
- } else {
18
- window.location.search = ActiveAdmin.toQueryString(params);
19
- }
20
- }
21
-
22
- static _jQueryInterface(config) {
23
- return this.each(function () {
24
- const $this = $(this)
25
- let data = $this.data('perPage')
26
-
27
- if (!data) {
28
- data = new PerPage(this)
29
- $this.data('perPage', data)
30
- }
31
-
32
- if (config === 'update') {
33
- data[config]()
34
- }
35
- })
36
- }
37
- };
38
-
39
- $(document).
40
- on('change', '.pagination_per_page > select', function(event) {
41
- PerPage._jQueryInterface.call($(this), 'update')
42
- });
43
-
44
- $.fn['perPage'] = PerPage._jQueryInterface
45
- $.fn['perPage'].Constructor = PerPage
46
-
47
- })(jQuery, window.activeadmin);