bullet_train-super_scaffolding 1.7.17 → 1.7.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bullet_train/super_scaffolding/version.rb +1 -1
- data/lib/generators/super_scaffold/conversations/USAGE +17 -0
- data/lib/generators/super_scaffold/conversations/conversations_generator.rb +25 -0
- data/lib/scaffolding/attribute.rb +2 -2
- data/lib/scaffolding/script.rb +11 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e545ccf981ebe2c1bd0e61771a8aad5e14a1576eb96580bbe994e0ac3d027188
|
4
|
+
data.tar.gz: 4ff0fe275eadd14996208534092be11b6ad55a0d972e68af1a4a9d675e38bb0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c21b8c85be5c66c6d04b739cd556890536da55fbe20079651291db195a436de1164edb06c6effbea049557130c3bc21f0bc1552e3341bb753a86b1391d668113
|
7
|
+
data.tar.gz: ba94616e6d888e3d450f53eddab1d3fa13281cdbf1f2e148c767f8b639474bb89ba53ca50b7c850103d4ac74102e2e96f0d1fdd3366785f072d9a06084be447a
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Description:
|
2
|
+
Generate files needed to add conversations to a model.
|
3
|
+
|
4
|
+
Example:
|
5
|
+
E.g. Add conversations to Posts from a Team.
|
6
|
+
rails generate super_scaffold:conversations Post Team
|
7
|
+
|
8
|
+
This will create:
|
9
|
+
db/migrate/20240716162627_add_project_to_conversations.rb
|
10
|
+
And update:
|
11
|
+
app/models/ability.rb
|
12
|
+
app/models/conversation.rb
|
13
|
+
app/models/project.rb
|
14
|
+
app/views/account/projects/show.html.erb
|
15
|
+
|
16
|
+
🏆 Protip: Commit your other changes before running Super Scaffolding so it's easy to undo if you (or we) make any mistakes.
|
17
|
+
If you do that, you can reset to your last commit state by using `git checkout .` and `git clean -d -f`.
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative "../super_scaffold_base"
|
2
|
+
require "scaffolding/routes_file_manipulator"
|
3
|
+
|
4
|
+
class ConversationsGenerator < Rails::Generators::Base
|
5
|
+
include SuperScaffoldBase
|
6
|
+
|
7
|
+
source_root File.expand_path("templates", __dir__)
|
8
|
+
|
9
|
+
namespace "super_scaffold:conversations"
|
10
|
+
|
11
|
+
argument :target_model
|
12
|
+
argument :parent_model
|
13
|
+
|
14
|
+
def generate
|
15
|
+
if defined?(BulletTrain::Conversations)
|
16
|
+
# We add the name of the specific super_scaffolding command that we want to
|
17
|
+
# invoke to the beginning of the argument string.
|
18
|
+
ARGV.unshift "conversations"
|
19
|
+
BulletTrain::SuperScaffolding::Runner.new.run
|
20
|
+
else
|
21
|
+
puts "You must have Conversations installed if you want to use this generator.".red
|
22
|
+
puts "Please refer to the documentation for more information: https://bullettrain.co/docs/conversations"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -178,10 +178,10 @@ class Scaffolding::Attribute
|
|
178
178
|
# TODO: We're preserving cloudinary_image here for backwards compatibility.
|
179
179
|
# Remove it in a future major release.
|
180
180
|
options[:height] = 200
|
181
|
-
"image"
|
181
|
+
"image#{"s" if is_multiple?}"
|
182
182
|
when "image"
|
183
183
|
options[:height] = 200
|
184
|
-
"image"
|
184
|
+
"image#{"s" if is_multiple?}"
|
185
185
|
when "phone_field"
|
186
186
|
"phone_number"
|
187
187
|
when "date_field"
|
data/lib/scaffolding/script.rb
CHANGED
@@ -146,11 +146,21 @@ def check_required_options_for_attributes(scaffolding_type, attributes, child, p
|
|
146
146
|
{}
|
147
147
|
end
|
148
148
|
|
149
|
+
if type == "image" && cloudinary_enabled? && attribute_options[:multiple]
|
150
|
+
puts "You have Cloudinary enabled and tried to scaffold an image field with the `multiple` option. " \
|
151
|
+
"At this time we do not support multiple images in a single Cloudinary image attribute. " \
|
152
|
+
"We hope to add support for it in the future. " \
|
153
|
+
"For now you could use individual named image attributes, or you might try disabling Cloudinary and using ActiveStorage.".red
|
154
|
+
exit
|
155
|
+
end
|
156
|
+
|
149
157
|
data_type = if type == "image" && cloudinary_enabled?
|
150
158
|
"string"
|
151
159
|
elsif attribute_options[:multiple]
|
152
160
|
case type
|
153
|
-
when "
|
161
|
+
when "file_field"
|
162
|
+
"attachments"
|
163
|
+
when "image"
|
154
164
|
"attachments"
|
155
165
|
else
|
156
166
|
"jsonb"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet_train-super_scaffolding
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standard
|
@@ -174,6 +174,8 @@ files:
|
|
174
174
|
- lib/generators/super_scaffold/action_models/targets_one/targets_one_generator.rb
|
175
175
|
- lib/generators/super_scaffold/action_models/targets_one_parent/USAGE
|
176
176
|
- lib/generators/super_scaffold/action_models/targets_one_parent/targets_one_parent_generator.rb
|
177
|
+
- lib/generators/super_scaffold/conversations/USAGE
|
178
|
+
- lib/generators/super_scaffold/conversations/conversations_generator.rb
|
177
179
|
- lib/generators/super_scaffold/field/USAGE
|
178
180
|
- lib/generators/super_scaffold/field/field_generator.rb
|
179
181
|
- lib/generators/super_scaffold/incoming_webhooks/USAGE
|