hot-glue 0.4.2 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,13 @@
1
+ class HotGlue::Helpers
2
+
3
+
4
+ def self.open_page( link)
5
+ if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
6
+ system "start #{link}"
7
+ elsif RbConfig::CONFIG['host_os'] =~ /darwin/
8
+ system "open #{link}"
9
+ elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/
10
+ system "xdg-open #{link}"
11
+ end
12
+ end
13
+ end
@@ -1,4 +1,5 @@
1
1
  require 'rails/generators/erb/scaffold/scaffold_generator'
2
+ require_relative './helpers'
2
3
  require 'ffaker'
3
4
 
4
5
  module HotGlue
@@ -10,6 +11,8 @@ module HotGlue
10
11
 
11
12
  source_root File.expand_path('templates', __dir__)
12
13
 
14
+
15
+
13
16
  def initialize(*args) #:nodoc:
14
17
  super
15
18
  @layout = options['layout'] || "hotglue"
@@ -25,28 +28,58 @@ module HotGlue
25
28
  end
26
29
 
27
30
  ### INTERACTIVE LICENSING
28
- #
29
31
 
30
32
 
31
- if Socket.gethostname != "Rose21"
32
- print "(To purchase a license, please see https://heliosdev.shop/hot-glue-license) \n Please enter your license key: "
33
- license_activation_key = STDIN.gets.strip
33
+ print "Do you have a license key (y/N)? "
34
+ do_you_have_a_license = STDIN.gets.strip || "N"
34
35
 
35
- print "Please enter the EMAIL you used to purchase this license: "
36
+ if do_you_have_a_license.downcase == "y"
37
+ print "Please enter the EMAIL you used to purchase a Hot Glue license, \nTeachable tutorial, or Helios Merch Shop product: "
36
38
  license_email = STDIN.gets.strip
37
- app_name = Rails.application.class.module_parent_name
38
- license_should_be = Digest::SHA1.hexdigest("HOT-GLUE-LICENSE--#{app_name}--#{license_email}")
39
+ require 'open-uri'
39
40
 
41
+ # ask HeliosDev.shop if this email is good
42
+ stream = URI.open("https://heliosdev.shop/check_licenses/hot-glue-license?email=#{license_email}")
43
+ resp = JSON.parse(stream.read)
40
44
 
41
- if (license_should_be != license_activation_key)
42
- puts "Ooops... it seems that Hot Glue license is not valid. Please check 1) the email address you used for this license, 2) The app name you used to purchase this license, and 3) the activation key itself."
45
+ if resp['status'] == 'success'
46
+ if resp['redirect']
47
+ HotGlue::Helpers.open_page(resp['redirect'])
48
+ end
49
+ puts "\n" + " * " + resp['response'] + " * \n\n"
50
+ else
51
+ puts "\n" + " * " + resp['response'] + " * \n\n"
52
+
53
+ print "You can get a license in one of the follow ways: \n"
54
+ print "https://heliosdev.shop/hot-glue-license \n"
55
+ print "https://jfb.teachable.com/p/hot-glue-in-depth-tutorial \n"
56
+ print "https://shop.heliosdev.shop/ \n"
57
+ print "All purchases come with a Hot Glue lifetime license for individuals and hobbyists\n"
43
58
  return
44
59
  end
60
+ else
61
+ print "Please pick an option to get a Hot Glue license: \n"
62
+ print "1) Professional/Business with support (see heliosdev.shop/hot-glue-license for prices) \n"
63
+ print "2) Individual/hobbyist: Get the tutorial on Teachable ($60) \n"
64
+ print "3) Individual/hobbyist: Get some merchandise ($5 and up) \n"
65
+ print "Please type 1, 2, or 3: "
66
+ choice = STDIN.gets.strip
67
+
68
+ if choice == "1"
69
+ HotGlue::Helpers.open_page("https://heliosdev.shop/hot-glue-license?utm_campaing=hotglue-installer")
70
+ elsif choice == "2"
71
+ HotGlue::Helpers.open_page("https://jfb.teachable.com/p/hot-glue-in-depth-tutorial?utm_source=hotglue-installer")
72
+ print "All purchases come with a Hot Glue lifetime license for individuals and hobbyists\n"
73
+
74
+ else
75
+ HotGlue::Helpers.open_page("https://shop.heliosdev.shop/?utm_source=hotglue-installer")
76
+ print "ALSO check out the HOT GLUE TUTORIAL here: \n"
77
+ print "https://jfb.teachable.com/p/hot-glue-in-depth-tutorial \n"
78
+ print "All purchases come with a Hot Glue lifetime license for individuals and hobbyists\n"
79
+ end
80
+ return
45
81
  end
46
82
 
47
-
48
-
49
-
50
83
  @markup = options['markup']
51
84
  if @markup == "haml"
52
85
  copy_file "haml/_flash_notices.haml", "#{'spec/dummy/' if Rails.env.test?}app/views/layouts/_flash_notices.haml"
@@ -146,10 +179,8 @@ module HotGlue
146
179
  begin
147
180
 
148
181
  if !File.exists?("config/hot_glue.yml")
149
-
150
182
  yaml = {layout: @layout,
151
183
  markup: @markup,
152
- license_activation_key: license_activation_key,
153
184
  license_email: license_email}.to_yaml
154
185
  File.write("#{'spec/dummy/' if Rails.env.test?}config/hot_glue.yml", yaml)
155
186
 
@@ -3,13 +3,15 @@
3
3
  module HotGlue
4
4
  module Layout
5
5
  class Builder
6
- attr_reader :include_setting, :downnest_children, :no_edit, :no_delete, :columns, :smart_layout
6
+ attr_reader :include_setting, :downnest_children, :buttons_width, :columns, :smart_layout
7
7
 
8
8
  def initialize(params)
9
9
  @include_setting = params[:include_setting]
10
10
  @downnest_children = params[:downnest_children]
11
- @no_edit = params[:no_edit]
12
- @no_delete = params[:no_delete]
11
+
12
+ @buttons_width = params[:buttons_width]
13
+
14
+ @no_buttons = @buttons_width == 0
13
15
  @columns = params[:columns]
14
16
  @smart_layout = params[:smart_layout]
15
17
  end
@@ -23,7 +25,7 @@ module HotGlue
23
25
  portals: {
24
26
 
25
27
  },
26
- buttons: { size: ''}
28
+ buttons: { size: @buttons_width}
27
29
  }
28
30
 
29
31
  downnest_children.each do |child|
@@ -32,9 +34,8 @@ module HotGlue
32
34
 
33
35
  # smart layout: 2 columns per field; 4 column for EACH downnested portals, 2 column for buttons
34
36
  how_many_downnest = downnest_children.size
35
- button_column_size = (no_edit && no_delete) ? 0 : 2
36
37
 
37
- bootstrap_columns = (12-button_column_size)
38
+ bootstrap_columns = (12-@buttons_width )
38
39
  bootstrap_columns = bootstrap_columns - (how_many_downnest*4)
39
40
  available_columns = (bootstrap_columns / 2).floor # bascially turns the 12-column grid into a 6-column grid
40
41
 
@@ -55,7 +56,7 @@ module HotGlue
55
56
 
56
57
  if columns.size > available_columns
57
58
  each_col_can_have = (columns.size.to_f / available_columns.to_f).round
58
- # byebug
59
+
59
60
  layout_object[:columns][:container] = (0..available_columns-1).collect { |x|
60
61
  columns.slice(0+(x*each_col_can_have),each_col_can_have)
61
62
  }
@@ -71,15 +72,16 @@ module HotGlue
71
72
  layout_object[:columns][:container] = columns.collect{|col| [col]}
72
73
 
73
74
  else
75
+
74
76
  (0..available_columns-1).each do |int|
75
77
  layout_object[:columns][:container][int] = []
76
78
  end
77
79
 
78
80
  # input control
79
- user_layout_columns = options['include'].split(":")
81
+ user_layout_columns = @include_setting .split(":")
80
82
 
81
83
  if user_layout_columns.size > available_columns
82
- raise "Your include statement #{options['include']} has #{user_layout_columns.size} columns, but I can only construct up to #{available_columns}"
84
+ raise "Your include statement #{@include_setting } has #{user_layout_columns.size} columns, but I can only construct up to #{available_columns}"
83
85
  end
84
86
  user_layout_columns.each_with_index do |column,i|
85
87
  layout_object[:columns][:container][i] = column.split(",")
@@ -15,11 +15,12 @@ module HotGlue
15
15
  path_helper_args = args[0][:path_helper_args]
16
16
  singular = args[0][:singular]
17
17
  magic_buttons = args[0][:magic_buttons]
18
+ small_buttons = args[0][:small_buttons]
18
19
 
19
20
  magic_buttons.collect{ |button_name|
20
- "<%= form_with model: #{singular}, url: #{path_helper_singular}(#{path_helper_args}) do |f| %>
21
+ "<%= form_with model: #{singular}, url: #{path_helper_singular}(#{path_helper_args}), html: {style: 'display: inline', data: {\"turbo-confirm\": 'Are you sure you want to #{button_name} this #{singular}?'}} do |f| %>
21
22
  <%= f.hidden_field :#{button_name}, value: \"#{button_name}\" %>
22
- <%= f.submit '#{button_name.titleize}'.html_safe, disabled: (#{singular}.respond_to?(:#{button_name}able?) && ! #{singular}.#{button_name}able? ), data: {confirm: 'Are you sure you want to #{button_name} this #{singular}?'}, class: '#{singular}-button btn btn-primary ' %>
23
+ <%= f.submit '#{button_name.titleize}'.html_safe, disabled: (#{singular}.respond_to?(:#{button_name}able?) && ! #{singular}.#{button_name}able? ), class: '#{singular}-button btn btn-primary #{"btn-sm" if small_buttons}' %>
23
24
  <% end %>"
24
25
  }.join("\n")
25
26
  end
@@ -129,12 +130,9 @@ module HotGlue
129
130
  " <%= f.label(:#{col.to_s}, value: 'Yes', for: '#{singular}_#{col.to_s}_1') %>\n" +
130
131
  ""
131
132
  when :enum
132
- enum_name = "enum_name"
133
-
134
133
  enum_type = eval("#{singular_class}.columns.select{|x| x.name == '#{col.to_s}'}[0].sql_type")
135
- "<%= f.collection_select(:#{col.to_s}, enum_to_collection_select( #{singular_class}.defined_enums['#{enum_type}']), :key, :value, {prompt: true, selected: @#{singular}.#{col.to_s} }, class: 'form-control') %>
134
+ "<%= f.collection_select(:#{col.to_s}, enum_to_collection_select( #{singular_class}.defined_enums['#{enum_type}']), :key, :value, {selected: @#{singular}.#{col.to_s} }, class: 'form-control') %>
136
135
  <label class='small form-text text-muted'>#{col.to_s.humanize}</label>"
137
-
138
136
  end
139
137
  end
140
138
 
@@ -59,15 +59,18 @@ module HotGlue
59
59
  class_option :big_edit, type: :boolean, default: false
60
60
  class_option :show_only, type: :string, default: ""
61
61
 
62
- class_option :stimulus_syntax, type: :boolean, default: nil # TODO: rename to ujs_syntax and default to false
62
+ class_option :ujs_syntax, type: :boolean, default: nil
63
63
 
64
64
  class_option :downnest, type: :string, default: nil
65
65
  class_option :magic_buttons, type: :string, default: nil
66
+ class_option :small_buttons, type: :boolean, default: nil
67
+
66
68
  class_option :display_list_after_update, type: :boolean, default: false
67
69
  class_option :smart_layout, type: :boolean, default: false
68
70
  class_option :markup, type: :string, default: nil # deprecated -- use in app config instead
69
71
  class_option :layout, type: :string, default: nil # if used here it will override what is in the config
70
-
72
+ class_option :no_list_labels, type: :boolean, default: false
73
+ class_option :alt_controller_name, type: :string, default: nil
71
74
 
72
75
  def initialize(*meta_args)
73
76
  super
@@ -138,14 +141,34 @@ module HotGlue
138
141
  end
139
142
 
140
143
  args = meta_args[0]
144
+
145
+
141
146
  @singular = args.first.tableize.singularize # should be in form hello_world
142
147
  @plural = options['plural'] || @singular + "s" # supply to override; leave blank to use default
148
+ @namespace = options['namespace'] || nil
149
+
150
+
151
+ @alt_controller_name = options['alt_controller_name']
152
+ use_controller_name = @alt_controller_name || plural.titleize.gsub(" ", "")
153
+
154
+ @controller_build_name = (( @namespace.titleize + "::" if @namespace) || "") + use_controller_name + "Controller"
155
+ @controller_build_folder = use_controller_name.underscore
156
+
157
+ if ! @controller_build_folder.ends_with?("s")
158
+ raise "can't build with controller name #{@controller_build_folder} because it doesn't end with an 's'"
159
+ end
160
+
161
+ if @alt_controller_name
162
+ @controller_build_folder_singular = @controller_build_folder.gsub(/s$/,'')
163
+ else
164
+ @controller_build_folder_singular = singular
165
+ end
166
+
143
167
  @auth = options['auth'] || "current_user"
144
168
  @auth_identifier = options['auth_identifier'] || (! @god && @auth.gsub("current_", "")) || nil
145
169
 
146
170
 
147
171
  @nest = (!options['nest'].empty? && options['nest']) || nil
148
- @namespace = options['namespace'] || nil
149
172
 
150
173
  @singular_class = @singular.titleize.gsub(" ", "")
151
174
  @exclude_fields = []
@@ -164,7 +187,6 @@ module HotGlue
164
187
  @show_only += options['show_only'].split(",").collect(&:to_sym)
165
188
  end
166
189
 
167
-
168
190
  @god = options['god'] || options['gd'] || false
169
191
  @specs_only = options['specs_only'] || false
170
192
 
@@ -177,13 +199,13 @@ module HotGlue
177
199
 
178
200
  @no_edit = options['no_edit'] || false
179
201
  @no_list = options['no_list'] || false
180
-
202
+ @no_list_labels = options['no_list_labels'] || false
181
203
  @display_list_after_update = options['display_list_after_update'] || false
182
204
  @smart_layout = options['smart_layout']
183
205
 
184
206
 
185
- @container_name = @layout == "hotglue" ? "scaffold-container" : "container-fluid"
186
207
 
208
+ @container_name = @layout == "hotglue" ? "scaffold-container" : "container-fluid"
187
209
  @downnest = options['downnest'] || false
188
210
 
189
211
  @downnest_children = []
@@ -218,6 +240,9 @@ module HotGlue
218
240
  @magic_buttons = options['magic_buttons'].split(',')
219
241
  end
220
242
 
243
+
244
+ @small_buttons = options['small_buttons'] || false
245
+
221
246
  @build_update_action = !@no_edit || !@magic_buttons.empty?
222
247
  # if the magic buttons are present, build the update action anyway
223
248
 
@@ -236,16 +261,24 @@ module HotGlue
236
261
  end
237
262
  end
238
263
 
264
+
265
+ @ujs_syntax = options['ujs_syntax']
266
+
267
+ if !@ujs_syntax
268
+ @ujs_syntax = !defined?(Turbo::Engine)
269
+ puts "You did not specify ujs_syntax and so I default it to #{@ujs_syntax}"
270
+ end
239
271
  @reference_name = HotGlue.derrive_reference_name(singular_class)
240
272
 
241
273
  identify_object_owner
242
274
  setup_fields
243
275
 
276
+ buttons_width = ((!@no_edit && 1) || 0) + ((!@no_delete && 1) || 0) + @magic_buttons.count
277
+
244
278
  builder = HotGlue::Layout::Builder.new({
245
279
  include_setting: options['include'],
246
280
  downnest_children: @downnest_children,
247
- no_edit: @no_edit,
248
- no_delete: @no_delete,
281
+ buttons_width: buttons_width,
249
282
  columns: @columns,
250
283
  smart_layout: @smart_layout
251
284
  })
@@ -261,23 +294,33 @@ module HotGlue
261
294
  auth_assoc_field = auth_assoc + "_id" unless @god
262
295
  assoc = eval("#{singular_class}.reflect_on_association(:#{@object_owner_sym})")
263
296
 
297
+
264
298
  if assoc
265
299
  @ownership_field = assoc.name.to_s + "_id"
266
300
  elsif !@nest
267
301
  exit_message = "*** Oops: It looks like is no association from current_#{@object_owner_sym} to a class called #{@singular_class}. If your user is called something else, pass with flag auth=current_X where X is the model for your users as lowercase. Also, be sure to implement current_X as a method on your controller. (If you really don't want to implement a current_X on your controller and want me to check some other method for your current user, see the section in the docs for auth_identifier.) To make a controller that can read all records, specify with --god."
268
302
 
269
303
  else
304
+ exit_message = "*** Oops: Missing relationship from class #{singular_class} to :#{@object_owner_sym} \n
305
+ maybe add `belongs_to :#{@object_owner_sym}` to #{singular_class}\n
306
+ (If your user is called something else, pass with flag auth=current_X where X is the model for your auth object as lowercase.
307
+ Also, be sure to implement current_X as a method on your controller. If you really don't want to implement a current_X on your controller and want me to check some other method for your current user, see the section in the docs for --auth-identifier flag)
308
+
309
+ To make a controller that can read all records, specify with --god."
310
+
270
311
  if @god
271
- exit_message= "*** Oops: Gd mode could not find the association(#{@object_owner_sym}). Something is wrong."
312
+ exit_message << "does #{singular_class} have a relOops: Gd mode could not find the association(#{@object_owner_sym}). Something is wrong."
272
313
  else
314
+
273
315
  @auth_check = eval(@auth_identifier.titleize)
274
316
  @nested_args.each do |arg|
317
+
275
318
  if ! @auth_check.reflect_on_association("#{arg}s".to_sym)
276
- exit_message = "*** Oops: your nesting chain does not have a association for #{arg}s on #{@auth_check} something is wrong."
319
+ exit_message << "... your nesting chain does not have a association for #{arg}s on #{@auth_check} something is wrong."
277
320
  end
278
321
  end
279
322
  end
280
- puts exit_message
323
+ puts "\n" + exit_message
281
324
  raise(HotGlue::Error, exit_message)
282
325
  end
283
326
  end
@@ -357,7 +400,7 @@ module HotGlue
357
400
  def copy_controller_and_spec_files
358
401
  @default_colspan = @columns.size
359
402
  unless @specs_only
360
- template "controller.rb.erb", File.join("#{'spec/dummy/' if Rails.env.test?}app/controllers#{namespace_with_dash}", "#{plural}_controller.rb")
403
+ template "controller.rb.erb", File.join("#{'spec/dummy/' if Rails.env.test?}app/controllers#{namespace_with_dash}", "#{@controller_build_folder}_controller.rb")
361
404
  if @namespace
362
405
  begin
363
406
  eval(controller_descends_from)
@@ -370,7 +413,8 @@ module HotGlue
370
413
 
371
414
  unless @no_specs
372
415
  dest_file = File.join("#{'spec/dummy/' if Rails.env.test?}spec/system#{namespace_with_dash}", "#{plural}_behavior_spec.rb")
373
- if File.exists?(dest_file)
416
+
417
+ if File.exists?(dest_file)
374
418
  existing_file = File.open(dest_file)
375
419
  existing_content = existing_file.read
376
420
  if existing_content =~ /\#HOTGLUE-SAVESTART/
@@ -460,10 +504,7 @@ module HotGlue
460
504
 
461
505
 
462
506
  def controller_class_name
463
- res = ""
464
- res << @namespace.titleize + "::" if @namespace
465
- res << plural.titleize.gsub(" ", "") + "Controller"
466
- res
507
+ @controller_build_name
467
508
  end
468
509
 
469
510
  def singular_name
@@ -488,15 +529,15 @@ module HotGlue
488
529
 
489
530
  def path_helper_singular
490
531
  if @nest
491
- "#{@namespace+"_" if @namespace}#{(@nested_args.join("_") + "_" if @nested_args.any?)}#{singular}_path"
532
+ "#{@namespace+"_" if @namespace}#{(@nested_args.join("_") + "_" if @nested_args.any?)}#{@controller_build_folder_singular}_path"
492
533
  else
493
- "#{@namespace+"_" if @namespace}#{singular}_path"
534
+ "#{@namespace+"_" if @namespace}#{@controller_build_folder_singular}_path"
494
535
  end
495
536
  end
496
537
 
497
538
  def path_helper_plural
498
539
  if ! @nest
499
- "#{@namespace+"_" if @namespace}#{plural}_path"
540
+ "#{@namespace+"_" if @namespace}#{@controller_build_folder}_path"
500
541
  else
501
542
  "#{@namespace+"_" if @namespace}#{(@nested_args.join("_") + "_" if @nested_args.any?)}#{plural}_path"
502
543
  end
@@ -511,19 +552,19 @@ module HotGlue
511
552
  end
512
553
 
513
554
  def line_path_partial
514
- "#{@namespace+"/" if @namespace}#{plural}/line"
555
+ "#{@namespace+"/" if @namespace}#{@controller_build_folder}/line"
515
556
  end
516
557
 
517
558
  def show_path_partial
518
- "#{@namespace+"/" if @namespace}#{plural}/show"
559
+ "#{@namespace+"/" if @namespace}#{@controller_build_folder}/show"
519
560
  end
520
561
 
521
562
  def list_path_partial
522
- "#{@namespace+"/" if @namespace}#{plural}/list"
563
+ "#{@namespace+"/" if @namespace}#{@controller_build_folder}/list"
523
564
  end
524
565
 
525
566
  def new_path_name
526
- base = "new_#{@namespace+"_" if @namespace}#{(@nested_args.join("_") + "_") if @nested_args.any?}#{singular}_path"
567
+ base = "new_#{@namespace+"_" if @namespace}#{(@nested_args.join("_") + "_") if @nested_args.any?}#{@controller_build_folder_singular}_path"
527
568
  if @nested_args.any?
528
569
  base += "(" + @nested_args.collect { |arg|
529
570
  "#{arg}.id"
@@ -616,7 +657,8 @@ module HotGlue
616
657
  path_helper_singular: path_helper_singular,
617
658
  path_helper_args: path_helper_args,
618
659
  singular: singular,
619
- magic_buttons: @magic_buttons
660
+ magic_buttons: @magic_buttons,
661
+ small_buttons: @small_buttons
620
662
  )
621
663
  end
622
664
 
@@ -629,7 +671,7 @@ module HotGlue
629
671
 
630
672
 
631
673
  dest_filepath = File.join("#{'spec/dummy/' if Rails.env.test?}app/views#{namespace_with_dash}",
632
- plural, dest_filename)
674
+ @controller_build_folder, dest_filename)
633
675
 
634
676
 
635
677
  template source_filename, dest_filepath
@@ -643,7 +685,7 @@ module HotGlue
643
685
  source_filename = cc_filename_with_extensions( "#{@markup}/#{view}.turbo_stream.#{@markup}")
644
686
  dest_filename = cc_filename_with_extensions("#{view}", "turbo_stream.#{@markup}")
645
687
  dest_filepath = File.join("#{'spec/dummy/' if Rails.env.test?}app/views#{namespace_with_dash}",
646
- plural, dest_filename)
688
+ @controller_build_folder, dest_filename)
647
689
 
648
690
 
649
691
  template source_filename, dest_filepath
@@ -651,6 +693,15 @@ module HotGlue
651
693
 
652
694
  end
653
695
  end
696
+
697
+ # menu_file = "app/views#{namespace_with_dash}/menu.erb"
698
+ #
699
+ # if File.exists?(menu_file)
700
+ # # TODO: can I insert the new menu item into the menu programatically here?
701
+ # # not sure how i would acheive this without nokogiri
702
+ #
703
+ # end
704
+
654
705
  end
655
706
 
656
707
  def namespace_with_dash
@@ -824,13 +875,13 @@ module HotGlue
824
875
  @template_builder.paginate(plural: plural)
825
876
  end
826
877
 
827
- def delete_confirmation_syntax
828
- if !@stimulus_syntax
829
- "{confirm: 'Are you sure?'}"
830
- else
831
- "{controller: 'confirmable', 'confirm-message': \"Are you sure you want to delete \#{ #{@singular}.#{ display_class } } \", 'action': 'confirmation#confirm'}"
832
- end
833
- end
878
+ # def delete_confirmation_syntax
879
+ # if !@stimulus_syntax
880
+ # "{confirm: 'Are you sure?'}"
881
+ # else
882
+ # "{controller: 'confirmable', 'confirm-message': \"Are you sure you want to delete \#{ #{@singular}.#{ display_class } } \", 'action': 'confirmation#confirm'}"
883
+ # end
884
+ # end
834
885
 
835
886
 
836
887
  def controller_magic_button_update_actions
@@ -2,30 +2,33 @@
2
2
  <div class="<%= @container_name %> scaffold-list">
3
3
  <% unless @no_list || @nested_args.any? %><h4><%= plural.gsub("_", " ").upcase %></h4><% end %>
4
4
 
5
- <% unless @no_create %><%= '<%= render partial: "' + ((@namespace+"/" if @namespace) || "") + plural + '/new_button", locals: {' + nested_assignments + '}' + '%\>'.gsub('\\',"") %><br /><% end %>
5
+ <% unless @no_create %><%= '<%= render partial: "' + ((@namespace+"/" if @namespace) || "") + @controller_build_folder + '/new_button", locals: {' + nested_assignments + '}' + '%\>'.gsub('\\',"") %><br /><% end %>
6
6
 
7
- <% unless @no_list %>
8
- <div class="row scaffold-heading-row">
9
- <%= list_column_headings %>
10
- <% if @downnest_children.any? %>
11
- <% each_downnest_width = @downnest_children.count == 1 ? 40 : (60/@downnest_children.count).floor %>
12
- <% downnest_column_style = @layout == "hotglue" ? 'style="flex-basis: ' + each_downnest_width.to_s + '%;' : "" %>
7
+ <% unless @no_list %>
8
+ <% unless @no_list_labels %>
9
+ <div class="row scaffold-heading-row">
10
+ <%= list_column_headings %>
11
+ <% if @downnest_children.any? %>
12
+ <% each_downnest_width = @downnest_children.count == 1 ? 40 : (60/@downnest_children.count).floor %>
13
+ <% downnest_column_style = @layout == "hotglue" ? 'style="flex-basis: ' + each_downnest_width.to_s + '%;' : "" %>
13
14
 
14
- <% @downnest_children.each_with_index do |downnest,i| %>
15
- <div class=" scaffold-col-heading<%= " col-sm-#{ @layout_object[:portals][downnest][:size] }" if @layout=="bootstrap" %>" <%= downnest_column_style %>>
16
- <strong>
17
- <%= downnest.titleize %>
18
- </strong>
19
- </div>
20
- <% end %>
21
- <% end %>
15
+ <% @downnest_children.each_with_index do |downnest,i| %>
16
+ <div class=" scaffold-col-heading<%= " col-sm-#{ @layout_object[:portals][downnest][:size] }" if @layout=="bootstrap" %>" <%= downnest_column_style %>>
17
+ <strong>
18
+ <%= downnest.titleize %>
19
+ </strong>
20
+ </div>
21
+ <% end %>
22
+ <% end %>
22
23
 
23
- <% button_column_style = @layout == "hotglue" ? 'style="flex-basis: 150px' : "" %>
24
+ <% button_column_style = @layout == "hotglue" ? 'style="flex-basis: 150px' : "" %>
24
25
 
25
- <div class=' scaffold-col-heading scaffold-col-heading-buttons<%= ' col-md-2' if @layout=="bootstrap" %>' <%= button_column_style %>>
26
+ <div class=' scaffold-col-heading scaffold-col-heading-buttons<%= " col-md-#{ @layout_object[:buttons][:size] }" if @layout=="bootstrap" %>' <%= button_column_style %>>
27
+
28
+ </div>
29
+ </div>
30
+ <% end %>
26
31
 
27
- </div>
28
- </div>
29
32
  <\% if <%= plural %>.empty? %>
30
33
  <div>
31
34
  None
@@ -3,6 +3,6 @@
3
3
  New <%= singular.titlecase %>
4
4
  </h3>
5
5
  <\%= form_with model: <%= singular %>, url: <%= path_helper_plural %>(<%= nested_objects_arity %>), method: "post" do |f| %>
6
- <\%= render partial: "<%= namespace_with_slash + @plural %>/form", locals: { <%= singular %>: <%= singular %>, f: f} %>
6
+ <\%= render partial: "<%= namespace_with_slash + @controller_build_folder %>/form", locals: { <%= singular %>: <%= singular %>, f: f} %>
7
7
  <\% end %>
8
8
  <\% end %>
@@ -19,12 +19,12 @@
19
19
  <% end %>
20
20
 
21
21
  <% button_style = @layout == "hotglue" ? 'style="flex-basis: ' + (100 - (column_width * @columns.count)).floor.to_s + '%;"' : "" %>
22
- <div class="<%= @col_identifier %> scaffold-line-buttons <%= ' col-md-2' if @layout == "bootstrap" %>" <%= button_style %>>
22
+ <div class="<%= @col_identifier %> scaffold-line-buttons <%= " col-md-#{ @layout_object[:buttons][:size] }" if @layout == "bootstrap" %>" <%= button_style %>>
23
23
  <%= magic_button_output %>
24
24
 
25
25
  <% if destroy_action %>
26
- <\%= form_with url: <%= path_helper_singular %>(<%= path_helper_args %>), html: {style: "display: inline-block;"}, method: :delete do |f| %>
27
- <\%= f.submit "Delete".html_safe, data: <%= delete_confirmation_syntax %>, class: "delete-<%= singular %>-button btn btn-primary btn-sm" %>
26
+ <\%= form_with url: <%= path_helper_singular %>(<%= path_helper_args %>), html: {data: {'<%= @ujs_syntax ? 'confirm' : 'turbo-confirm' %>': "Are you sure you want to delete #{ <%= @singular + "." + display_class %> }?"}, style: "display: inline-block;"}, method: :delete do |f| %>
27
+ <\%= f.submit "Delete".html_safe, class: "delete-<%= singular %>-button btn btn-primary btn-sm" %>
28
28
  <\% end %>
29
29
  <% end %>
30
30
 
@@ -1,3 +1,3 @@
1
1
  module HotGlue
2
- VERSION = '0.4.2'
2
+ VERSION = '0.4.6'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hot-glue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Fleetwood-Boldt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-30 00:00:00.000000000 Z
11
+ date: 2022-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -17,9 +17,6 @@ dependencies:
17
17
  - - ">"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '5.1'
20
- - - "<="
21
- - !ruby/object:Gem::Version
22
- version: '7'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,9 +24,6 @@ dependencies:
27
24
  - - ">"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '5.1'
30
- - - "<="
31
- - !ruby/object:Gem::Version
32
- version: '7'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: kaminari
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -84,7 +78,7 @@ files:
84
78
  - ".travis.yml"
85
79
  - Gemfile
86
80
  - Gemfile.lock
87
- - LICENCE
81
+ - LICENSE
88
82
  - README.md
89
83
  - Rakefile
90
84
  - app/assets/config/manifest.js
@@ -95,6 +89,7 @@ files:
95
89
  - config/database.yml
96
90
  - config/hot_glue.yml
97
91
  - db/schema.rb
92
+ - lib/generators/hot_glue/helpers.rb
98
93
  - lib/generators/hot_glue/install_generator.rb
99
94
  - lib/generators/hot_glue/layout/builder.rb
100
95
  - lib/generators/hot_glue/markup_templates/base.rb
@@ -144,19 +139,15 @@ files:
144
139
  - lib/hot-glue.rb
145
140
  - lib/hotglue/engine.rb
146
141
  - lib/hotglue/version.rb
147
- homepage: https://jasonfleetwoodboldt.com/hot-glue/
142
+ homepage: https://jfb.teachable.com/p/hot-glue-in-depth-tutorial?utm_source=rubygems.org&utm_campaign=rubygems_link
148
143
  licenses:
149
- - Nonstandard
144
+ - Commercial with free option
150
145
  metadata:
151
146
  source_code_uri: https://github.com/jasonfb/hot-glue
152
- tutorial: https://jfbcodes.com/hot-glue-tutorial
153
- buy_license: https://heliosdev.shop/hot-glue-licens
154
- get_merch: https://shop.heliosdev.shop/?utm_source=rubygems&utm_campaign=hot_glue_gem_metadata
155
147
  post_install_message: |
156
148
  ---------------------------------------------
157
149
  Welcome to Hot Glue - A Scaffold Building Companion for Hotwire + Turbo-Rails
158
-
159
- To purchase a license, please visit https://heliosdev.shop/hot-glue-license
150
+ For license options visit https://heliosdev.shop/hot-glue-license
160
151
  ---------------------------------------------
161
152
  rdoc_options: []
162
153
  require_paths: