activeadmin-ajax_filter 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/main.yaml +1 -1
  3. data/Gemfile +1 -0
  4. data/Gemfile.lock +65 -59
  5. data/README.md +10 -13
  6. data/activeadmin-ajax_filter.gemspec +2 -2
  7. data/lib/active_admin/ajax_filter/version.rb +1 -1
  8. data/test_app/blog/.gitattributes +7 -0
  9. data/test_app/blog/.gitignore +35 -0
  10. data/test_app/blog/.ruby-version +1 -0
  11. data/test_app/blog/Gemfile +83 -0
  12. data/test_app/blog/Gemfile.lock +345 -0
  13. data/test_app/blog/README.md +24 -0
  14. data/test_app/blog/Rakefile +6 -0
  15. data/test_app/blog/app/admin/admin_users.rb +28 -0
  16. data/test_app/blog/app/admin/categories.rb +7 -0
  17. data/test_app/blog/app/admin/dashboard.rb +32 -0
  18. data/test_app/blog/app/admin/items.rb +38 -0
  19. data/test_app/blog/app/admin/subcategories.rb +8 -0
  20. data/test_app/blog/app/admin/tags.rb +22 -0
  21. data/test_app/blog/app/assets/config/manifest.js +2 -0
  22. data/test_app/blog/app/assets/images/.keep +0 -0
  23. data/test_app/blog/app/assets/javascripts/active_admin.js +4 -0
  24. data/test_app/blog/app/assets/stylesheets/active_admin.scss +21 -0
  25. data/test_app/blog/app/assets/stylesheets/application.css +15 -0
  26. data/test_app/blog/app/channels/application_cable/channel.rb +4 -0
  27. data/test_app/blog/app/channels/application_cable/connection.rb +4 -0
  28. data/test_app/blog/app/controllers/application_controller.rb +2 -0
  29. data/test_app/blog/app/controllers/concerns/.keep +0 -0
  30. data/test_app/blog/app/decorators/subcategory_decorator.rb +5 -0
  31. data/test_app/blog/app/helpers/application_helper.rb +2 -0
  32. data/test_app/blog/app/jobs/application_job.rb +7 -0
  33. data/test_app/blog/app/mailers/application_mailer.rb +4 -0
  34. data/test_app/blog/app/models/admin_user.rb +6 -0
  35. data/test_app/blog/app/models/application_record.rb +3 -0
  36. data/test_app/blog/app/models/category.rb +6 -0
  37. data/test_app/blog/app/models/concerns/.keep +0 -0
  38. data/test_app/blog/app/models/item.rb +6 -0
  39. data/test_app/blog/app/models/subcategory.rb +8 -0
  40. data/test_app/blog/app/models/tag.rb +6 -0
  41. data/test_app/blog/app/views/layouts/application.html.erb +15 -0
  42. data/test_app/blog/app/views/layouts/mailer.html.erb +13 -0
  43. data/test_app/blog/app/views/layouts/mailer.text.erb +1 -0
  44. data/test_app/blog/bin/bundle +114 -0
  45. data/test_app/blog/bin/rails +4 -0
  46. data/test_app/blog/bin/rake +4 -0
  47. data/test_app/blog/bin/setup +33 -0
  48. data/test_app/blog/config/application.rb +22 -0
  49. data/test_app/blog/config/boot.rb +4 -0
  50. data/test_app/blog/config/cable.yml +10 -0
  51. data/test_app/blog/config/credentials.yml.enc +1 -0
  52. data/test_app/blog/config/database.yml +25 -0
  53. data/test_app/blog/config/environment.rb +5 -0
  54. data/test_app/blog/config/environments/development.rb +70 -0
  55. data/test_app/blog/config/environments/production.rb +93 -0
  56. data/test_app/blog/config/environments/test.rb +60 -0
  57. data/test_app/blog/config/initializers/active_admin.rb +335 -0
  58. data/test_app/blog/config/initializers/assets.rb +12 -0
  59. data/test_app/blog/config/initializers/content_security_policy.rb +25 -0
  60. data/test_app/blog/config/initializers/devise.rb +313 -0
  61. data/test_app/blog/config/initializers/filter_parameter_logging.rb +8 -0
  62. data/test_app/blog/config/initializers/inflections.rb +16 -0
  63. data/test_app/blog/config/initializers/permissions_policy.rb +11 -0
  64. data/test_app/blog/config/locales/devise.en.yml +65 -0
  65. data/test_app/blog/config/locales/en.yml +33 -0
  66. data/test_app/blog/config/puma.rb +43 -0
  67. data/test_app/blog/config/routes.rb +8 -0
  68. data/test_app/blog/config/storage.yml +34 -0
  69. data/test_app/blog/config.ru +6 -0
  70. data/test_app/blog/db/migrate/20230425060437_devise_create_admin_users.rb +44 -0
  71. data/test_app/blog/db/migrate/20230425060439_create_active_admin_comments.rb +16 -0
  72. data/test_app/blog/db/migrate/20230425060707_initial_schema.rb +17 -0
  73. data/test_app/blog/db/migrate/20230425060708_create_tags.rb +13 -0
  74. data/test_app/blog/db/schema.rb +69 -0
  75. data/test_app/blog/db/seeds.rb +33 -0
  76. data/test_app/blog/lib/assets/.keep +0 -0
  77. data/test_app/blog/lib/tasks/.keep +0 -0
  78. data/test_app/blog/log/.keep +0 -0
  79. data/test_app/blog/public/404.html +67 -0
  80. data/test_app/blog/public/422.html +67 -0
  81. data/test_app/blog/public/500.html +66 -0
  82. data/test_app/blog/public/apple-touch-icon-precomposed.png +0 -0
  83. data/test_app/blog/public/apple-touch-icon.png +0 -0
  84. data/test_app/blog/public/favicon.ico +0 -0
  85. data/test_app/blog/public/robots.txt +1 -0
  86. data/test_app/blog/storage/.keep +0 -0
  87. data/test_app/blog/test/application_system_test_case.rb +5 -0
  88. data/test_app/blog/test/channels/application_cable/connection_test.rb +11 -0
  89. data/test_app/blog/test/controllers/.keep +0 -0
  90. data/test_app/blog/test/fixtures/admin_users.yml +11 -0
  91. data/test_app/blog/test/fixtures/files/.keep +0 -0
  92. data/test_app/blog/test/helpers/.keep +0 -0
  93. data/test_app/blog/test/integration/.keep +0 -0
  94. data/test_app/blog/test/mailers/.keep +0 -0
  95. data/test_app/blog/test/models/.keep +0 -0
  96. data/test_app/blog/test/models/admin_user_test.rb +7 -0
  97. data/test_app/blog/test/system/.keep +0 -0
  98. data/test_app/blog/test/test_helper.rb +13 -0
  99. data/test_app/blog/tmp/.keep +0 -0
  100. data/test_app/blog/tmp/pids/.keep +0 -0
  101. data/test_app/blog/tmp/storage/.keep +0 -0
  102. data/test_app/blog/vendor/.keep +0 -0
  103. metadata +101 -21
  104. data/.travis.yml +0 -26
@@ -0,0 +1,345 @@
1
+ GIT
2
+ remote: https://github.com/faker-ruby/faker.git
3
+ revision: cfdcdc06e953d05755f2455f4d412cdd71a3dba6
4
+ branch: main
5
+ specs:
6
+ faker (3.2.0)
7
+ i18n (>= 1.8.11, < 2)
8
+
9
+ PATH
10
+ remote: ../..
11
+ specs:
12
+ activeadmin-ajax_filter (0.6.0)
13
+ activeadmin (>= 1.0)
14
+ coffee-rails (>= 4.1.0)
15
+ rails (>= 7.0)
16
+ selectize-rails (>= 0.12.6)
17
+
18
+ GEM
19
+ remote: https://rubygems.org/
20
+ specs:
21
+ actioncable (7.0.4.3)
22
+ actionpack (= 7.0.4.3)
23
+ activesupport (= 7.0.4.3)
24
+ nio4r (~> 2.0)
25
+ websocket-driver (>= 0.6.1)
26
+ actionmailbox (7.0.4.3)
27
+ actionpack (= 7.0.4.3)
28
+ activejob (= 7.0.4.3)
29
+ activerecord (= 7.0.4.3)
30
+ activestorage (= 7.0.4.3)
31
+ activesupport (= 7.0.4.3)
32
+ mail (>= 2.7.1)
33
+ net-imap
34
+ net-pop
35
+ net-smtp
36
+ actionmailer (7.0.4.3)
37
+ actionpack (= 7.0.4.3)
38
+ actionview (= 7.0.4.3)
39
+ activejob (= 7.0.4.3)
40
+ activesupport (= 7.0.4.3)
41
+ mail (~> 2.5, >= 2.5.4)
42
+ net-imap
43
+ net-pop
44
+ net-smtp
45
+ rails-dom-testing (~> 2.0)
46
+ actionpack (7.0.4.3)
47
+ actionview (= 7.0.4.3)
48
+ activesupport (= 7.0.4.3)
49
+ rack (~> 2.0, >= 2.2.0)
50
+ rack-test (>= 0.6.3)
51
+ rails-dom-testing (~> 2.0)
52
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
53
+ actiontext (7.0.4.3)
54
+ actionpack (= 7.0.4.3)
55
+ activerecord (= 7.0.4.3)
56
+ activestorage (= 7.0.4.3)
57
+ activesupport (= 7.0.4.3)
58
+ globalid (>= 0.6.0)
59
+ nokogiri (>= 1.8.5)
60
+ actionview (7.0.4.3)
61
+ activesupport (= 7.0.4.3)
62
+ builder (~> 3.1)
63
+ erubi (~> 1.4)
64
+ rails-dom-testing (~> 2.0)
65
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
66
+ activeadmin (2.13.1)
67
+ arbre (~> 1.2, >= 1.2.1)
68
+ formtastic (>= 3.1, < 5.0)
69
+ formtastic_i18n (~> 0.4)
70
+ inherited_resources (~> 1.7)
71
+ jquery-rails (~> 4.2)
72
+ kaminari (~> 1.0, >= 1.2.1)
73
+ railties (>= 6.1, < 7.1)
74
+ ransack (>= 2.1.1, < 4)
75
+ activejob (7.0.4.3)
76
+ activesupport (= 7.0.4.3)
77
+ globalid (>= 0.3.6)
78
+ activemodel (7.0.4.3)
79
+ activesupport (= 7.0.4.3)
80
+ activemodel-serializers-xml (1.0.2)
81
+ activemodel (> 5.x)
82
+ activesupport (> 5.x)
83
+ builder (~> 3.1)
84
+ activerecord (7.0.4.3)
85
+ activemodel (= 7.0.4.3)
86
+ activesupport (= 7.0.4.3)
87
+ activestorage (7.0.4.3)
88
+ actionpack (= 7.0.4.3)
89
+ activejob (= 7.0.4.3)
90
+ activerecord (= 7.0.4.3)
91
+ activesupport (= 7.0.4.3)
92
+ marcel (~> 1.0)
93
+ mini_mime (>= 1.1.0)
94
+ activesupport (7.0.4.3)
95
+ concurrent-ruby (~> 1.0, >= 1.0.2)
96
+ i18n (>= 1.6, < 2)
97
+ minitest (>= 5.1)
98
+ tzinfo (~> 2.0)
99
+ addressable (2.8.4)
100
+ public_suffix (>= 2.0.2, < 6.0)
101
+ arbre (1.5.0)
102
+ activesupport (>= 3.0.0, < 7.1)
103
+ ruby2_keywords (>= 0.0.2, < 1.0)
104
+ bcrypt (3.1.18)
105
+ bindex (0.8.1)
106
+ bootsnap (1.16.0)
107
+ msgpack (~> 1.2)
108
+ builder (3.2.4)
109
+ cancancan (3.5.0)
110
+ capybara (3.39.0)
111
+ addressable
112
+ matrix
113
+ mini_mime (>= 0.1.3)
114
+ nokogiri (~> 1.8)
115
+ rack (>= 1.6.0)
116
+ rack-test (>= 0.6.3)
117
+ regexp_parser (>= 1.5, < 3.0)
118
+ xpath (~> 3.2)
119
+ coffee-rails (5.0.0)
120
+ coffee-script (>= 2.2.0)
121
+ railties (>= 5.2.0)
122
+ coffee-script (2.4.1)
123
+ coffee-script-source
124
+ execjs
125
+ coffee-script-source (1.12.2)
126
+ concurrent-ruby (1.2.2)
127
+ crass (1.0.6)
128
+ date (3.3.3)
129
+ debug (1.7.2)
130
+ irb (>= 1.5.0)
131
+ reline (>= 0.3.1)
132
+ devise (4.9.2)
133
+ bcrypt (~> 3.0)
134
+ orm_adapter (~> 0.1)
135
+ railties (>= 4.1.0)
136
+ responders
137
+ warden (~> 1.2.3)
138
+ draper (4.0.2)
139
+ actionpack (>= 5.0)
140
+ activemodel (>= 5.0)
141
+ activemodel-serializers-xml (>= 1.0)
142
+ activesupport (>= 5.0)
143
+ request_store (>= 1.0)
144
+ ruby2_keywords
145
+ erubi (1.12.0)
146
+ execjs (2.8.1)
147
+ ffi (1.15.5)
148
+ formtastic (4.0.0)
149
+ actionpack (>= 5.2.0)
150
+ formtastic_i18n (0.7.0)
151
+ globalid (1.1.0)
152
+ activesupport (>= 5.0)
153
+ has_scope (0.8.1)
154
+ actionpack (>= 5.2)
155
+ activesupport (>= 5.2)
156
+ i18n (1.12.0)
157
+ concurrent-ruby (~> 1.0)
158
+ importmap-rails (1.1.6)
159
+ actionpack (>= 6.0.0)
160
+ railties (>= 6.0.0)
161
+ inherited_resources (1.13.1)
162
+ actionpack (>= 5.2, < 7.1)
163
+ has_scope (~> 0.6)
164
+ railties (>= 5.2, < 7.1)
165
+ responders (>= 2, < 4)
166
+ io-console (0.6.0)
167
+ irb (1.6.4)
168
+ reline (>= 0.3.0)
169
+ jbuilder (2.11.5)
170
+ actionview (>= 5.0.0)
171
+ activesupport (>= 5.0.0)
172
+ jquery-rails (4.5.1)
173
+ rails-dom-testing (>= 1, < 3)
174
+ railties (>= 4.2.0)
175
+ thor (>= 0.14, < 2.0)
176
+ kaminari (1.2.2)
177
+ activesupport (>= 4.1.0)
178
+ kaminari-actionview (= 1.2.2)
179
+ kaminari-activerecord (= 1.2.2)
180
+ kaminari-core (= 1.2.2)
181
+ kaminari-actionview (1.2.2)
182
+ actionview
183
+ kaminari-core (= 1.2.2)
184
+ kaminari-activerecord (1.2.2)
185
+ activerecord
186
+ kaminari-core (= 1.2.2)
187
+ kaminari-core (1.2.2)
188
+ loofah (2.20.0)
189
+ crass (~> 1.0.2)
190
+ nokogiri (>= 1.5.9)
191
+ mail (2.8.1)
192
+ mini_mime (>= 0.1.1)
193
+ net-imap
194
+ net-pop
195
+ net-smtp
196
+ marcel (1.0.2)
197
+ matrix (0.4.2)
198
+ method_source (1.0.0)
199
+ mini_mime (1.1.2)
200
+ mini_portile2 (2.8.1)
201
+ minitest (5.18.0)
202
+ msgpack (1.7.0)
203
+ net-imap (0.3.4)
204
+ date
205
+ net-protocol
206
+ net-pop (0.1.2)
207
+ net-protocol
208
+ net-protocol (0.2.1)
209
+ timeout
210
+ net-smtp (0.3.3)
211
+ net-protocol
212
+ nio4r (2.5.9)
213
+ nokogiri (1.14.3)
214
+ mini_portile2 (~> 2.8.0)
215
+ racc (~> 1.4)
216
+ orm_adapter (0.5.0)
217
+ public_suffix (5.0.1)
218
+ puma (5.6.5)
219
+ nio4r (~> 2.0)
220
+ pundit (2.3.0)
221
+ activesupport (>= 3.0.0)
222
+ racc (1.6.2)
223
+ rack (2.2.7)
224
+ rack-test (2.1.0)
225
+ rack (>= 1.3)
226
+ rails (7.0.4.3)
227
+ actioncable (= 7.0.4.3)
228
+ actionmailbox (= 7.0.4.3)
229
+ actionmailer (= 7.0.4.3)
230
+ actionpack (= 7.0.4.3)
231
+ actiontext (= 7.0.4.3)
232
+ actionview (= 7.0.4.3)
233
+ activejob (= 7.0.4.3)
234
+ activemodel (= 7.0.4.3)
235
+ activerecord (= 7.0.4.3)
236
+ activestorage (= 7.0.4.3)
237
+ activesupport (= 7.0.4.3)
238
+ bundler (>= 1.15.0)
239
+ railties (= 7.0.4.3)
240
+ rails-dom-testing (2.0.3)
241
+ activesupport (>= 4.2.0)
242
+ nokogiri (>= 1.6)
243
+ rails-html-sanitizer (1.5.0)
244
+ loofah (~> 2.19, >= 2.19.1)
245
+ railties (7.0.4.3)
246
+ actionpack (= 7.0.4.3)
247
+ activesupport (= 7.0.4.3)
248
+ method_source
249
+ rake (>= 12.2)
250
+ thor (~> 1.0)
251
+ zeitwerk (~> 2.5)
252
+ rake (13.0.6)
253
+ ransack (3.2.1)
254
+ activerecord (>= 6.1.5)
255
+ activesupport (>= 6.1.5)
256
+ i18n
257
+ regexp_parser (2.8.0)
258
+ reline (0.3.3)
259
+ io-console (~> 0.5)
260
+ request_store (1.5.1)
261
+ rack (>= 1.4)
262
+ responders (3.1.0)
263
+ actionpack (>= 5.2)
264
+ railties (>= 5.2)
265
+ rexml (3.2.5)
266
+ ruby2_keywords (0.0.5)
267
+ rubyzip (2.3.2)
268
+ sassc (2.4.0)
269
+ ffi (~> 1.9)
270
+ selectize-rails (0.12.6)
271
+ selenium-webdriver (4.9.0)
272
+ rexml (~> 3.2, >= 3.2.5)
273
+ rubyzip (>= 1.2.2, < 3.0)
274
+ websocket (~> 1.0)
275
+ sprockets (4.2.0)
276
+ concurrent-ruby (~> 1.0)
277
+ rack (>= 2.2.4, < 4)
278
+ sprockets-rails (3.4.2)
279
+ actionpack (>= 5.2)
280
+ activesupport (>= 5.2)
281
+ sprockets (>= 3.0.0)
282
+ sqlite3 (1.6.2)
283
+ mini_portile2 (~> 2.8.0)
284
+ stimulus-rails (1.2.1)
285
+ railties (>= 6.0.0)
286
+ thor (1.2.1)
287
+ timeout (0.3.2)
288
+ turbo-rails (1.4.0)
289
+ actionpack (>= 6.0.0)
290
+ activejob (>= 6.0.0)
291
+ railties (>= 6.0.0)
292
+ tzinfo (2.0.6)
293
+ concurrent-ruby (~> 1.0)
294
+ warden (1.2.9)
295
+ rack (>= 2.0.9)
296
+ web-console (4.2.0)
297
+ actionview (>= 6.0.0)
298
+ activemodel (>= 6.0.0)
299
+ bindex (>= 0.4.0)
300
+ railties (>= 6.0.0)
301
+ webdrivers (5.2.0)
302
+ nokogiri (~> 1.6)
303
+ rubyzip (>= 1.3.0)
304
+ selenium-webdriver (~> 4.0)
305
+ websocket (1.2.9)
306
+ websocket-driver (0.7.5)
307
+ websocket-extensions (>= 0.1.0)
308
+ websocket-extensions (0.1.5)
309
+ xpath (3.2.0)
310
+ nokogiri (~> 1.8)
311
+ zeitwerk (2.6.7)
312
+
313
+ PLATFORMS
314
+ ruby
315
+
316
+ DEPENDENCIES
317
+ activeadmin
318
+ activeadmin-ajax_filter!
319
+ bootsnap
320
+ cancancan
321
+ capybara
322
+ debug
323
+ devise
324
+ draper
325
+ faker!
326
+ importmap-rails
327
+ jbuilder
328
+ puma (~> 5.0)
329
+ pundit
330
+ rails (~> 7.0.4, >= 7.0.4.3)
331
+ sassc
332
+ selenium-webdriver
333
+ sprockets-rails
334
+ sqlite3 (~> 1.4)
335
+ stimulus-rails
336
+ turbo-rails
337
+ tzinfo-data
338
+ web-console
339
+ webdrivers
340
+
341
+ RUBY VERSION
342
+ ruby 2.7.2p137
343
+
344
+ BUNDLED WITH
345
+ 2.1.4
@@ -0,0 +1,24 @@
1
+ # README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require_relative "config/application"
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,28 @@
1
+ ActiveAdmin.register AdminUser do
2
+ permit_params :email, :password, :password_confirmation
3
+
4
+ index do
5
+ selectable_column
6
+ id_column
7
+ column :email
8
+ column :current_sign_in_at
9
+ column :sign_in_count
10
+ column :created_at
11
+ actions
12
+ end
13
+
14
+ filter :email
15
+ filter :current_sign_in_at
16
+ filter :sign_in_count
17
+ filter :created_at
18
+
19
+ form do |f|
20
+ f.inputs do
21
+ f.input :email
22
+ f.input :password
23
+ f.input :password_confirmation
24
+ end
25
+ f.actions
26
+ end
27
+
28
+ end
@@ -0,0 +1,7 @@
1
+ ActiveAdmin.register Category do
2
+ include ActiveAdmin::AjaxFilter
3
+
4
+ permit_params :id, :name
5
+ config.sort_order = 'id_asc'
6
+ config.per_page = 3
7
+ end
@@ -0,0 +1,32 @@
1
+ ActiveAdmin.register_page 'Dashboard' do
2
+ menu priority: 1, label: proc { I18n.t('active_admin.dashboard') }
3
+
4
+ content title: proc { I18n.t('active_admin.dashboard') } do
5
+ div class: 'blank_slate_container', id: 'dashboard_default_message' do
6
+ span class: 'blank_slate' do
7
+ span I18n.t('active_admin.dashboard_welcome.welcome')
8
+ small I18n.t('active_admin.dashboard_welcome.call_to_action')
9
+ end
10
+ end
11
+
12
+ # Here is an example of a simple dashboard with columns and panels.
13
+ #
14
+ # columns do
15
+ # column do
16
+ # panel "Recent Posts" do
17
+ # ul do
18
+ # Post.recent(5).map do |post|
19
+ # li link_to(post.title, admin_post_path(post))
20
+ # end
21
+ # end
22
+ # end
23
+ # end
24
+
25
+ # column do
26
+ # panel "Info" do
27
+ # para "Welcome to ActiveAdmin."
28
+ # end
29
+ # end
30
+ # end
31
+ end # content
32
+ end
@@ -0,0 +1,38 @@
1
+ ActiveAdmin.register Item do
2
+ permit_params :id, :name, :subcategory_id, tag_ids: []
3
+ config.sort_order = 'id_asc'
4
+
5
+ filter :subcategory, as: :ajax_select, data: {
6
+ url: :filter_admin_subcategories_path,
7
+ search_fields: [:name],
8
+ limit: 7,
9
+ }
10
+
11
+ filter :tags, as: :ajax_select, data: {
12
+ url: :filter_admin_tags_path,
13
+ search_fields: [:name],
14
+ limit: 7,
15
+ }
16
+
17
+ form do |f|
18
+ f.semantic_errors(*f.object.errors.attribute_names)
19
+
20
+ f.inputs do
21
+ f.input :name
22
+
23
+ f.input :subcategory, as: :ajax_select, data: {
24
+ search_fields: [:name],
25
+ url: '/admin/subcategories/filter',
26
+ limit: Subcategory::AJAX_LIMIT
27
+ }
28
+
29
+ f.input :tags, as: :ajax_select, data: {
30
+ search_fields: ['name'],
31
+ url: '/admin/tags/filter'
32
+ }
33
+ end
34
+
35
+
36
+ f.actions
37
+ end
38
+ end
@@ -0,0 +1,8 @@
1
+ ActiveAdmin.register Subcategory do
2
+ include ActiveAdmin::AjaxFilter
3
+ decorate_with SubcategoryDecorator.name
4
+
5
+ permit_params :id, :name, :category_id
6
+ config.sort_order = 'id_asc'
7
+ config.per_page = 3
8
+ end
@@ -0,0 +1,22 @@
1
+ ActiveAdmin.register Tag do
2
+ include ActiveAdmin::AjaxFilter
3
+
4
+ permit_params :id, :name, :subcategory_id
5
+ config.sort_order = 'id_asc'
6
+
7
+ form do |f|
8
+ f.semantic_errors(*f.object.errors.attribute_names)
9
+
10
+ f.inputs do
11
+ f.input :name
12
+ f.input :subcategory, as: :ajax_select, data: {
13
+ search_fields: ['category.name'],
14
+ ordering: 'name ASC',
15
+ url: '/admin/subcategories/filter',
16
+ limit: Subcategory::AJAX_LIMIT
17
+ }
18
+ end
19
+
20
+ f.actions
21
+ end
22
+ end
@@ -0,0 +1,2 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../stylesheets .css
File without changes
@@ -0,0 +1,4 @@
1
+ //= require active_admin/base
2
+
3
+ //= require selectize
4
+ //= require activeadmin-ajax_filter
@@ -0,0 +1,21 @@
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 "active_admin/mixins";
12
+ @import "active_admin/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; }
18
+
19
+ @import "selectize";
20
+ @import "selectize.default";
21
+ @import "activeadmin-ajax_filter";
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
6
+ * vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Channel < ActionCable::Channel::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Connection < ActionCable::Connection::Base
3
+ end
4
+ end
@@ -0,0 +1,2 @@
1
+ class ApplicationController < ActionController::Base
2
+ end
File without changes
@@ -0,0 +1,5 @@
1
+ require 'draper'
2
+
3
+ class SubcategoryDecorator < Draper::Decorator
4
+ delegate_all
5
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,7 @@
1
+ class ApplicationJob < ActiveJob::Base
2
+ # Automatically retry jobs that encountered a deadlock
3
+ # retry_on ActiveRecord::Deadlocked
4
+
5
+ # Most jobs are safe to ignore if the underlying records are no longer available
6
+ # discard_on ActiveJob::DeserializationError
7
+ end
@@ -0,0 +1,4 @@
1
+ class ApplicationMailer < ActionMailer::Base
2
+ default from: "from@example.com"
3
+ layout "mailer"
4
+ end
@@ -0,0 +1,6 @@
1
+ class AdminUser < ApplicationRecord
2
+ # Include default devise modules. Others available are:
3
+ # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
4
+ devise :database_authenticatable,
5
+ :recoverable, :rememberable, :validatable
6
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ primary_abstract_class
3
+ end
@@ -0,0 +1,6 @@
1
+ class Category < ActiveRecord::Base
2
+ validates :name, presence: true
3
+
4
+ has_many :subcategories
5
+ has_many :items, through: :subcategories
6
+ end
File without changes
@@ -0,0 +1,6 @@
1
+ class Item < ActiveRecord::Base
2
+ validates :name, presence: true
3
+
4
+ belongs_to :subcategory
5
+ has_and_belongs_to_many :tags
6
+ end
@@ -0,0 +1,8 @@
1
+ class Subcategory < ActiveRecord::Base
2
+ AJAX_LIMIT = 3
3
+
4
+ validates :name, presence: true
5
+
6
+ belongs_to :category
7
+ has_many :items
8
+ end
@@ -0,0 +1,6 @@
1
+ class Tag < ActiveRecord::Base
2
+ validates :name, presence: true
3
+
4
+ belongs_to :subcategory
5
+ has_and_belongs_to_many :items
6
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Blog</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <%= csrf_meta_tags %>
7
+ <%= csp_meta_tag %>
8
+
9
+ <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
10
+ </head>
11
+
12
+ <body>
13
+ <%= yield %>
14
+ </body>
15
+ </html>