inline_forms_installer 8.1.3 → 8.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8aab65c5a20c0e070c304623d7498286d6cb8c06d883863d309c8005a230aaa5
|
|
4
|
+
data.tar.gz: 6a241f0384dc7f8bbee8aa1d61cc08c2226ee1ce93ea6ae584f8f455906e8a77
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 46b0762a885fcb3e9a56f47e8b91f6f26f4b6a2091548813923b1f9bb902fc604d3c4769dd7b561d80d0bc4b80a18b28abec4cdb515aa3c62b7b7317628f615c
|
|
7
|
+
data.tar.gz: ae5781053e3daf55d8336b533e76ed3e696032cbb62d3e0d74ed5e004a19faf2ca426b4cf4a56f3cc983b0761b0ca18fd0b62f3217d4276d35491acd53e4c949
|
|
@@ -368,6 +368,11 @@ create_file user_cfg.model_path, <<-USER_MODEL.strip_heredoc
|
|
|
368
368
|
# via `#{user_cfg.class_name}.inline_forms_list`). Avoids `default_scope`
|
|
369
369
|
# so callers can `unscope`/`reorder` cleanly when needed.
|
|
370
370
|
scope :inline_forms_list, -> { order(:name, :id) }
|
|
371
|
+
# Search box on /#{user_cfg.plural_route} filters by name OR email. Without this
|
|
372
|
+
# the controller would `merge(ApplicationRecord.inline_forms_search(q))`,
|
|
373
|
+
# which is the no-op `all` fallback, and the query string would be silently
|
|
374
|
+
# ignored.
|
|
375
|
+
scope :inline_forms_search, ->(q) { where("name LIKE :q OR email LIKE :q", q: "%\#{q}%") }
|
|
371
376
|
|
|
372
377
|
def _presentation
|
|
373
378
|
"\#{name}"
|
|
@@ -404,6 +409,18 @@ create_file user_cfg.model_path, <<-USER_MODEL.strip_heredoc
|
|
|
404
409
|
end
|
|
405
410
|
USER_MODEL
|
|
406
411
|
|
|
412
|
+
# inline_forms initializer (must exist before subsequent `rails g inline_forms`
|
|
413
|
+
# runs so the generator's `add_tab` step can inject each generated model's
|
|
414
|
+
# route token into `MODEL_TABS`). Pre-seeded with the user-model route
|
|
415
|
+
# (the user model is hand-written above, not generated, so the generator
|
|
416
|
+
# never sees it).
|
|
417
|
+
say "- Creating inline_forms initializer (MODEL_TABS seeded with #{user_cfg.plural_route})"
|
|
418
|
+
create_file "config/initializers/inline_forms.rb", <<-END_INITIALIZER.strip_heredoc
|
|
419
|
+
Rails.application.reloader.to_prepare do
|
|
420
|
+
MODEL_TABS = %w(#{user_cfg.plural_route} )
|
|
421
|
+
end
|
|
422
|
+
END_INITIALIZER
|
|
423
|
+
|
|
407
424
|
# Create Locales
|
|
408
425
|
say "- Create locales"
|
|
409
426
|
generate "inline_forms", "Locale name:string title:string #{user_cfg.table_name}:has_many _enabled:yes _list_order:title _presentation:\#{title}"
|
|
@@ -545,13 +562,6 @@ create_file "app/helpers/application_helper.rb", <<-END_APPHELPER.strip_heredoc
|
|
|
545
562
|
end
|
|
546
563
|
END_APPHELPER
|
|
547
564
|
|
|
548
|
-
say "- Creating inline_forms initializer"
|
|
549
|
-
create_file "config/initializers/inline_forms.rb", <<-END_INITIALIZER.strip_heredoc
|
|
550
|
-
Rails.application.reloader.to_prepare do
|
|
551
|
-
MODEL_TABS = %w()
|
|
552
|
-
end
|
|
553
|
-
END_INITIALIZER
|
|
554
|
-
|
|
555
565
|
say "- Recreating ApplicationController to add devise, cancan, I18n stuff..."
|
|
556
566
|
remove_file "app/controllers/application_controller.rb" # the one that 'rails new' created
|
|
557
567
|
create_file "app/controllers/application_controller.rb", <<-END_APPCONTROLLER.strip_heredoc
|