inline_forms_installer 8.1.2 → 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
|
|
@@ -67,6 +67,25 @@ module InlineFormsInstaller
|
|
|
67
67
|
exit 1
|
|
68
68
|
end
|
|
69
69
|
|
|
70
|
+
# The example app always generates Photo / Apartment / Owner; the
|
|
71
|
+
# installer always generates Locale / Role (and the Devise-backed user
|
|
72
|
+
# model with the chosen class name). Reject `-U <reserved>` early
|
|
73
|
+
# rather than letting `rails g inline_forms` collide with an
|
|
74
|
+
# already-generated app/models/<reserved>.rb at install time.
|
|
75
|
+
example_reserved = %w[Photo Apartment Owner].freeze
|
|
76
|
+
installer_reserved = %w[Locale Role].freeze
|
|
77
|
+
if installer_reserved.include?(user_model_cfg.class_name)
|
|
78
|
+
say "Error: -U #{user_model_cfg.class_name} conflicts with an installer-generated model " \
|
|
79
|
+
"(#{installer_reserved.join(', ')}); choose a different class name.", :red
|
|
80
|
+
exit 1
|
|
81
|
+
end
|
|
82
|
+
if install_example? && example_reserved.include?(user_model_cfg.class_name)
|
|
83
|
+
say "Error: -U #{user_model_cfg.class_name} conflicts with an --example model " \
|
|
84
|
+
"(#{example_reserved.join(', ')}); choose a different class name " \
|
|
85
|
+
"or drop --example.", :red
|
|
86
|
+
exit 1
|
|
87
|
+
end
|
|
88
|
+
|
|
70
89
|
inline_forms_version = InlineFormsInstaller.inline_forms_version
|
|
71
90
|
# The Gemfile pins `gem "inline_forms", "~> 8"`, so Bundler resolves the
|
|
72
91
|
# highest 8.x available on RubyGems at install time. The
|
|
@@ -106,7 +106,7 @@ gem 'jquery-ui-rails', '4.0.3'
|
|
|
106
106
|
# foundation-icons-sass-rails depended on sass-rails).
|
|
107
107
|
gem 'mini_magick'
|
|
108
108
|
gem 'mysql2'
|
|
109
|
-
gem 'paper_trail', '~>
|
|
109
|
+
gem 'paper_trail', '~> 17.0'
|
|
110
110
|
gem 'rails-i18n', '~> 8.1'
|
|
111
111
|
gem 'rails-jquery-autocomplete'
|
|
112
112
|
gem 'rails', '~> 8.1'
|
|
@@ -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
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: inline_forms_installer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 8.1.
|
|
4
|
+
version: 8.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ace Suares
|
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
133
133
|
- !ruby/object:Gem::Version
|
|
134
134
|
version: '0'
|
|
135
135
|
requirements: []
|
|
136
|
-
rubygems_version: 4.0.
|
|
136
|
+
rubygems_version: 4.0.12
|
|
137
137
|
specification_version: 4
|
|
138
138
|
summary: CLI and Rails app template for generating inline_forms applications.
|
|
139
139
|
test_files: []
|