activeadmin 2.3.0 → 2.6.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activeadmin might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +106 -35
- data/CONTRIBUTING.md +50 -54
- data/README.md +1 -1
- data/app/assets/javascripts/active_admin/base.js +519 -0
- data/app/assets/stylesheets/active_admin/_base.scss +29 -29
- data/app/assets/stylesheets/active_admin/_header.scss +3 -5
- data/app/assets/stylesheets/active_admin/_mixins.scss +1 -1
- data/{vendor → app}/assets/stylesheets/active_admin/_normalize.scss +0 -0
- data/app/assets/stylesheets/active_admin/components/_tables.scss +1 -2
- data/app/assets/stylesheets/active_admin/mixins/_all.scss +8 -8
- data/app/assets/stylesheets/active_admin/mixins/_variables.scss +5 -0
- data/app/assets/stylesheets/active_admin/print.scss +2 -2
- data/app/assets/stylesheets/active_admin/structure/_main_structure.scss +1 -1
- data/app/javascript/active_admin/base.js +28 -0
- data/app/{assets/javascripts/active_admin/ext/jquery-ui.es6 → javascript/active_admin/ext/jquery-ui.js} +0 -0
- data/app/{assets/javascripts/active_admin/ext/jquery.es6 → javascript/active_admin/ext/jquery.js} +0 -0
- data/app/{assets/javascripts/active_admin/lib/batch_actions.es6 → javascript/active_admin/initializers/batch-actions.js} +4 -2
- data/app/javascript/active_admin/initializers/checkbox-toggler.js +3 -0
- data/app/{assets/javascripts/active_admin/initializers/datepicker.es6 → javascript/active_admin/initializers/datepicker.js} +0 -0
- data/app/javascript/active_admin/initializers/dropdown-menu.js +9 -0
- data/app/javascript/active_admin/initializers/filters.js +10 -0
- data/app/{assets/javascripts/active_admin/lib/has_many.es6 → javascript/active_admin/initializers/has-many.js} +0 -0
- data/app/javascript/active_admin/initializers/per-page.js +13 -0
- data/app/javascript/active_admin/initializers/table-checkbox-toggler.js +3 -0
- data/app/{assets/javascripts/active_admin/initializers/tabs.es6 → javascript/active_admin/initializers/tabs.js} +0 -0
- data/app/{assets/javascripts/active_admin/lib/checkbox-toggler.es6 → javascript/active_admin/lib/checkbox-toggler.js} +2 -2
- data/app/{assets/javascripts/active_admin/lib/dropdown-menu.es6 → javascript/active_admin/lib/dropdown-menu.js} +2 -9
- data/app/javascript/active_admin/lib/filters.js +39 -0
- data/app/{assets/javascripts/active_admin/lib/modal_dialog.es6 → javascript/active_admin/lib/modal-dialog.js} +3 -1
- data/app/javascript/active_admin/lib/per-page.js +38 -0
- data/app/{assets/javascripts/active_admin/lib/table-checkbox-toggler.es6 → javascript/active_admin/lib/table-checkbox-toggler.js} +4 -2
- data/app/javascript/active_admin/lib/utils.js +40 -0
- data/config/locales/az.yml +138 -0
- data/config/locales/de.yml +18 -0
- data/config/locales/en-CA.yml +3 -3
- data/config/locales/en-GB.yml +3 -3
- data/config/locales/en.yml +3 -3
- data/config/locales/es.yml +3 -3
- data/config/locales/fr.yml +4 -4
- data/config/locales/lv.yml +2 -2
- data/config/locales/sk.yml +59 -0
- data/config/locales/vi.yml +1 -0
- data/docs/1-general-configuration.md +20 -0
- data/docs/3-index-pages.md +1 -1
- data/docs/9-batch-actions.md +2 -2
- data/docs/Gemfile.lock +103 -103
- data/lib/active_admin.rb +0 -1
- data/lib/active_admin/application.rb +1 -1
- data/lib/active_admin/csv_builder.rb +7 -3
- data/lib/active_admin/filters/active_filter.rb +1 -1
- data/lib/active_admin/filters/resource_extension.rb +24 -0
- data/lib/active_admin/inputs/filters/date_range_input.rb +15 -12
- data/lib/active_admin/localizers/resource_localizer.rb +1 -1
- data/lib/active_admin/namespace_settings.rb +13 -0
- data/lib/active_admin/order_clause.rb +1 -1
- data/lib/active_admin/resource.rb +1 -1
- data/lib/active_admin/resource/naming.rb +1 -1
- data/lib/active_admin/resource_controller/decorators.rb +2 -2
- data/lib/active_admin/resource_controller/polymorphic_routes.rb +3 -2
- data/lib/active_admin/version.rb +1 -1
- data/lib/active_admin/views/components/paginated_collection.rb +2 -1
- data/lib/active_admin/views/components/table_for.rb +1 -0
- data/lib/active_admin/views/pages/base.rb +5 -3
- data/lib/active_admin/views/pages/index.rb +1 -0
- data/lib/generators/active_admin/install/templates/active_admin.rb.erb +14 -1
- metadata +35 -45
- data/app/assets/images/active_admin/nested_menu_arrow.gif +0 -0
- data/app/assets/images/active_admin/nested_menu_arrow_dark.gif +0 -0
- data/app/assets/images/active_admin/orderable.png +0 -0
- data/app/assets/javascripts/active_admin/base.es6 +0 -23
- data/app/assets/javascripts/active_admin/initializers/filters.es6 +0 -45
- data/app/assets/javascripts/active_admin/lib/active_admin.es6 +0 -41
- data/app/assets/javascripts/active_admin/lib/per_page.es6 +0 -47
@@ -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
|
|
@@ -106,5 +106,18 @@ module ActiveAdmin
|
|
106
106
|
|
107
107
|
# Include association filters by default
|
108
108
|
register :include_default_association_filters, true
|
109
|
+
|
110
|
+
register :maximum_association_filter_arity, :unlimited
|
111
|
+
|
112
|
+
register :filter_columns_for_large_association, [
|
113
|
+
:display_name,
|
114
|
+
:full_name,
|
115
|
+
:name,
|
116
|
+
:username,
|
117
|
+
:login,
|
118
|
+
:title,
|
119
|
+
:email,
|
120
|
+
]
|
121
|
+
register :filter_method_for_large_association, '_starts_with'
|
109
122
|
end
|
110
123
|
end
|
@@ -70,7 +70,7 @@ module ActiveAdmin
|
|
70
70
|
def initialize(namespace, resource_class, options = {})
|
71
71
|
@namespace = namespace
|
72
72
|
@resource_class_name = "::#{resource_class.name}"
|
73
|
-
@options
|
73
|
+
@options = options
|
74
74
|
@sort_order = options[:sort_order]
|
75
75
|
@member_actions = []
|
76
76
|
@collection_actions = []
|
@@ -67,8 +67,8 @@ module ActiveAdmin
|
|
67
67
|
def self.wrap!(parent, name)
|
68
68
|
::Class.new parent do
|
69
69
|
delegate :reorder, :page, :current_page, :total_pages, :limit_value,
|
70
|
-
:total_count, :total_pages, :
|
71
|
-
:find_each, :ransack
|
70
|
+
:total_count, :total_pages, :offset, :to_key, :group_values,
|
71
|
+
:except, :find_each, :ransack
|
72
72
|
|
73
73
|
define_singleton_method(:name) { name }
|
74
74
|
end
|
@@ -25,8 +25,9 @@ module ActiveAdmin
|
|
25
25
|
return ActiveAdmin::Model.new(active_admin_config, record)
|
26
26
|
end
|
27
27
|
|
28
|
-
|
29
|
-
|
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
|
data/lib/active_admin/version.rb
CHANGED
@@ -96,7 +96,7 @@ module ActiveAdmin
|
|
96
96
|
options[:params] = @params if @params
|
97
97
|
options[:param_name] = @param_name if @param_name
|
98
98
|
|
99
|
-
if !@display_total
|
99
|
+
if !@display_total
|
100
100
|
# The #paginate method in kaminari will query the resource with a
|
101
101
|
# count(*) to determine how many pages there should be unless
|
102
102
|
# you pass in the :total_pages option. We issue a query to determine
|
@@ -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(
|
36
|
+
text_node(meta(name: name, content: content))
|
37
37
|
end
|
38
38
|
|
39
39
|
active_admin_application.javascripts.each do |path|
|
@@ -85,8 +85,10 @@ module ActiveAdmin
|
|
85
85
|
|
86
86
|
def build_flash_messages
|
87
87
|
div class: 'flashes' do
|
88
|
-
flash_messages.each do |type,
|
89
|
-
|
88
|
+
flash_messages.each do |type, messages|
|
89
|
+
[*messages].each do |message|
|
90
|
+
div message, class: "flash flash_#{type}"
|
91
|
+
end
|
90
92
|
end
|
91
93
|
end
|
92
94
|
end
|
@@ -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)
|
@@ -286,12 +286,25 @@ ActiveAdmin.setup do |config|
|
|
286
286
|
# config.filters = true
|
287
287
|
#
|
288
288
|
# By default the filters include associations in a select, which means
|
289
|
-
# that every record will be loaded for each association
|
289
|
+
# that every record will be loaded for each association (up
|
290
|
+
# to the value of config.maximum_association_filter_arity).
|
290
291
|
# You can enabled or disable the inclusion
|
291
292
|
# of those filters by default here.
|
292
293
|
#
|
293
294
|
# config.include_default_association_filters = true
|
294
295
|
|
296
|
+
# config.maximum_association_filter_arity = 256 # default value of :unlimited will change to 256 in a future version
|
297
|
+
# config.filter_columns_for_large_association, [
|
298
|
+
# :display_name,
|
299
|
+
# :full_name,
|
300
|
+
# :name,
|
301
|
+
# :username,
|
302
|
+
# :login,
|
303
|
+
# :title,
|
304
|
+
# :email,
|
305
|
+
# ]
|
306
|
+
# config.filter_method_for_large_association, '_starts_with'
|
307
|
+
|
295
308
|
# == Head
|
296
309
|
#
|
297
310
|
# You can add your own content to the site head like analytics. Make sure
|
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
|
+
version: 2.6.1
|
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:
|
18
|
+
date: 2020-02-03 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.
|
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.
|
132
|
+
version: '5.2'
|
133
133
|
- - "<"
|
134
134
|
- !ruby/object:Gem::Version
|
135
135
|
version: '6.1'
|
@@ -139,14 +139,20 @@ dependencies:
|
|
139
139
|
requirements:
|
140
140
|
- - "~>"
|
141
141
|
- !ruby/object:Gem::Version
|
142
|
-
version: '2.
|
142
|
+
version: '2.1'
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 2.1.1
|
143
146
|
type: :runtime
|
144
147
|
prerelease: false
|
145
148
|
version_requirements: !ruby/object:Gem::Requirement
|
146
149
|
requirements:
|
147
150
|
- - "~>"
|
148
151
|
- !ruby/object:Gem::Version
|
149
|
-
version: '2.
|
152
|
+
version: '2.1'
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: 2.1.1
|
150
156
|
- !ruby/object:Gem::Dependency
|
151
157
|
name: sassc-rails
|
152
158
|
requirement: !ruby/object:Gem::Requirement
|
@@ -181,26 +187,6 @@ dependencies:
|
|
181
187
|
- - "<"
|
182
188
|
- !ruby/object:Gem::Version
|
183
189
|
version: '4.1'
|
184
|
-
- !ruby/object:Gem::Dependency
|
185
|
-
name: sprockets-es6
|
186
|
-
requirement: !ruby/object:Gem::Requirement
|
187
|
-
requirements:
|
188
|
-
- - "~>"
|
189
|
-
- !ruby/object:Gem::Version
|
190
|
-
version: '0.9'
|
191
|
-
- - ">="
|
192
|
-
- !ruby/object:Gem::Version
|
193
|
-
version: 0.9.2
|
194
|
-
type: :runtime
|
195
|
-
prerelease: false
|
196
|
-
version_requirements: !ruby/object:Gem::Requirement
|
197
|
-
requirements:
|
198
|
-
- - "~>"
|
199
|
-
- !ruby/object:Gem::Version
|
200
|
-
version: '0.9'
|
201
|
-
- - ">="
|
202
|
-
- !ruby/object:Gem::Version
|
203
|
-
version: 0.9.2
|
204
190
|
description: The administration framework for Ruby on Rails.
|
205
191
|
email:
|
206
192
|
- deivid.rodriguez@riseup.net
|
@@ -217,27 +203,12 @@ files:
|
|
217
203
|
- CONTRIBUTING.md
|
218
204
|
- LICENSE
|
219
205
|
- README.md
|
220
|
-
- app/assets/
|
221
|
-
- app/assets/images/active_admin/nested_menu_arrow_dark.gif
|
222
|
-
- app/assets/images/active_admin/orderable.png
|
223
|
-
- app/assets/javascripts/active_admin/base.es6
|
224
|
-
- app/assets/javascripts/active_admin/ext/jquery-ui.es6
|
225
|
-
- app/assets/javascripts/active_admin/ext/jquery.es6
|
226
|
-
- app/assets/javascripts/active_admin/initializers/datepicker.es6
|
227
|
-
- app/assets/javascripts/active_admin/initializers/filters.es6
|
228
|
-
- app/assets/javascripts/active_admin/initializers/tabs.es6
|
229
|
-
- app/assets/javascripts/active_admin/lib/active_admin.es6
|
230
|
-
- app/assets/javascripts/active_admin/lib/batch_actions.es6
|
231
|
-
- app/assets/javascripts/active_admin/lib/checkbox-toggler.es6
|
232
|
-
- app/assets/javascripts/active_admin/lib/dropdown-menu.es6
|
233
|
-
- app/assets/javascripts/active_admin/lib/has_many.es6
|
234
|
-
- app/assets/javascripts/active_admin/lib/modal_dialog.es6
|
235
|
-
- app/assets/javascripts/active_admin/lib/per_page.es6
|
236
|
-
- app/assets/javascripts/active_admin/lib/table-checkbox-toggler.es6
|
206
|
+
- app/assets/javascripts/active_admin/base.js
|
237
207
|
- app/assets/stylesheets/active_admin/_base.scss
|
238
208
|
- app/assets/stylesheets/active_admin/_forms.scss
|
239
209
|
- app/assets/stylesheets/active_admin/_header.scss
|
240
210
|
- app/assets/stylesheets/active_admin/_mixins.scss
|
211
|
+
- app/assets/stylesheets/active_admin/_normalize.scss
|
241
212
|
- app/assets/stylesheets/active_admin/_typography.scss
|
242
213
|
- app/assets/stylesheets/active_admin/components/_batch_actions.scss
|
243
214
|
- app/assets/stylesheets/active_admin/components/_blank_slates.scss
|
@@ -274,6 +245,25 @@ files:
|
|
274
245
|
- app/assets/stylesheets/active_admin/structure/_footer.scss
|
275
246
|
- app/assets/stylesheets/active_admin/structure/_main_structure.scss
|
276
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
|
277
267
|
- app/views/active_admin/devise/confirmations/new.html.erb
|
278
268
|
- app/views/active_admin/devise/mailer/reset_password_instructions.html.erb
|
279
269
|
- app/views/active_admin/devise/mailer/unlock_instructions.html.erb
|
@@ -305,6 +295,7 @@ files:
|
|
305
295
|
- app/views/layouts/active_admin.html.arb
|
306
296
|
- app/views/layouts/active_admin_logged_out.html.erb
|
307
297
|
- config/locales/ar.yml
|
298
|
+
- config/locales/az.yml
|
308
299
|
- config/locales/bg.yml
|
309
300
|
- config/locales/bs.yml
|
310
301
|
- config/locales/ca.yml
|
@@ -589,7 +580,6 @@ files:
|
|
589
580
|
- vendor/assets/javascripts/jquery-ui/widgets/resizable.js
|
590
581
|
- vendor/assets/javascripts/jquery-ui/widgets/sortable.js
|
591
582
|
- vendor/assets/javascripts/jquery-ui/widgets/tabs.js
|
592
|
-
- vendor/assets/stylesheets/active_admin/_normalize.scss
|
593
583
|
homepage: https://activeadmin.info
|
594
584
|
licenses:
|
595
585
|
- MIT
|
@@ -609,7 +599,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
609
599
|
- !ruby/object:Gem::Version
|
610
600
|
version: '0'
|
611
601
|
requirements: []
|
612
|
-
rubygems_version: 3.
|
602
|
+
rubygems_version: 3.1.2
|
613
603
|
signing_key:
|
614
604
|
specification_version: 4
|
615
605
|
summary: Active Admin is a Ruby on Rails plugin for generating administration style
|
Binary file
|
Binary file
|
Binary file
|
@@ -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);
|