hot-glue 0.4.1 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,6 +6,8 @@ require_relative './markup_templates/erb'
6
6
  require_relative './markup_templates/haml'
7
7
  require_relative './markup_templates/slim'
8
8
 
9
+ require_relative './layout/builder'
10
+
9
11
  module HotGlue
10
12
  class Error < StandardError
11
13
  end
@@ -56,26 +58,29 @@ module HotGlue
56
58
  class_option :no_paginate, type: :boolean, default: false
57
59
  class_option :big_edit, type: :boolean, default: false
58
60
  class_option :show_only, type: :string, default: ""
59
- class_option :stimulus_syntax, type: :boolean, default: nil
61
+
62
+ class_option :ujs_syntax, type: :boolean, default: nil
63
+
60
64
  class_option :downnest, type: :string, default: nil
61
- class_option :nestable, type: :boolean, default: false
62
65
  class_option :magic_buttons, type: :string, default: nil
63
- class_option :display_list_after_update, type: :boolean, default: false
66
+ class_option :small_buttons, type: :boolean, default: nil
64
67
 
68
+ class_option :display_list_after_update, type: :boolean, default: false
69
+ class_option :smart_layout, type: :boolean, default: false
65
70
  class_option :markup, type: :string, default: nil # deprecated -- use in app config instead
66
- class_option :layout, type: :string, default: nil # deprecated -- use in app config instead
71
+ class_option :layout, type: :string, default: nil # if used here it will override what is in the config
67
72
 
68
73
 
69
74
  def initialize(*meta_args)
70
75
  super
71
76
 
77
+
72
78
  begin
73
79
  @the_object = eval(class_name)
74
80
  rescue StandardError => e
75
81
  message = "*** Oops: It looks like there is no object for #{class_name}. Please define the object + database table first."
76
82
  puts message
77
- exit
78
- # raise(HotGlue::Error, message)
83
+ raise(HotGlue::Error, message)
79
84
  end
80
85
 
81
86
  if !options['spec_only'].nil? && !options['no_spec'].nil?
@@ -83,10 +88,13 @@ module HotGlue
83
88
  end
84
89
 
85
90
  if !options['exclude'].empty? && !options['include'].empty?
86
- puts "*** Oops: You seem to have specified both --include and --exclude. Please use one or the other. Aborting."
87
- exit
91
+ exit_message = "*** Oops: You seem to have specified both --include and --exclude. Please use one or the other. Aborting."
92
+ puts exit_message
93
+
94
+ raise(HotGlue::Error, exit_message)
88
95
  end
89
96
 
97
+
90
98
  if @stimulus_syntax.nil?
91
99
  if Rails.version.split(".")[0].to_i >= 7
92
100
  @stimulus_syntax = true
@@ -96,13 +104,14 @@ module HotGlue
96
104
  end
97
105
 
98
106
  if !options['markup'].nil?
99
- puts "Using --markup flag in the generator is deprecated; instead, use a file at config/hot_glue.yml with a key markup set to `erb` or `haml`"
100
- exit
107
+ message = "Using --markup flag in the generator is deprecated; instead, use a file at config/hot_glue.yml with a key markup set to `erb` or `haml`"
108
+ raise(HotGlue::Error, message)
109
+
101
110
  end
102
111
 
103
112
  if !options['markup'].nil?
104
- puts "Using --layout flag in the generator is deprecated; instead, use a file at config/hot_glue.yml with a key markup set to `erb` or `haml`"
105
- exit
113
+ message = "Using --layout flag in the generator is deprecated; instead, use a file at config/hot_glue.yml with a key markup set to `erb` or `haml`"
114
+ raise(HotGlue::Error, message)
106
115
  end
107
116
 
108
117
  yaml_from_config = YAML.load(File.read("config/hot_glue.yml"))
@@ -111,8 +120,8 @@ module HotGlue
111
120
  if @markup == "erb"
112
121
  @template_builder = HotGlue::ErbTemplate.new
113
122
  elsif @markup == "slim"
114
- puts "SLIM IS NOT IMPLEMENTED; please see https://github.com/jasonfb/hot-glue/issues/3"
115
- abort
123
+ message = "SLIM IS NOT IMPLEMENTED; please see https://github.com/jasonfb/hot-glue/issues/3"
124
+ raise(HotGlue::Error, message)
116
125
  @template_builder = HotGlue::SlimTemplate.new
117
126
 
118
127
  elsif @markup == "haml"
@@ -120,13 +129,16 @@ module HotGlue
120
129
  end
121
130
 
122
131
 
123
- @layout = yaml_from_config[:layout]
132
+ if !options['layout']
133
+ @layout = yaml_from_config[:layout]
124
134
 
125
- if !['hotglue', 'bootstrap'].include? @layout
126
- raise "Invalid option #{@layout} in Hot glue config (config/hot_glue.yml). You must pass either hotglue (default) or bootstrap to config"
135
+ if !['hotglue', 'bootstrap'].include? @layout
136
+ raise "Invalid option #{@layout} in Hot glue config (config/hot_glue.yml). You must either use --layout= when generating or have a file config/hotglue.yml; specify layout as either 'hotglue' or 'bootstrap'"
137
+ end
138
+ else
139
+ @layout = options['layout']
127
140
  end
128
141
 
129
-
130
142
  args = meta_args[0]
131
143
  @singular = args.first.tableize.singularize # should be in form hello_world
132
144
  @plural = options['plural'] || @singular + "s" # supply to override; leave blank to use default
@@ -144,7 +156,8 @@ module HotGlue
144
156
 
145
157
  if !options['include'].empty?
146
158
  @include_fields = []
147
- @include_fields += options['include'].split(",").collect(&:to_sym)
159
+ # semicolon to denote layout columns; commas separate fields
160
+ @include_fields += options['include'].gsub(":","").split(",").collect(&:to_sym)
148
161
  end
149
162
 
150
163
 
@@ -168,10 +181,9 @@ module HotGlue
168
181
  @no_list = options['no_list'] || false
169
182
 
170
183
  @display_list_after_update = options['display_list_after_update'] || false
184
+ @smart_layout = options['smart_layout']
171
185
 
172
186
 
173
-
174
- @col_identifier = @layout == "hotglue" ? "scaffold-cell" : "col"
175
187
  @container_name = @layout == "hotglue" ? "scaffold-container" : "container-fluid"
176
188
 
177
189
  @downnest = options['downnest'] || false
@@ -208,10 +220,12 @@ module HotGlue
208
220
  @magic_buttons = options['magic_buttons'].split(',')
209
221
  end
210
222
 
223
+
224
+ @small_buttons = options['small_buttons'] || false
225
+
211
226
  @build_update_action = !@no_edit || !@magic_buttons.empty?
212
227
  # if the magic buttons are present, build the update action anyway
213
228
 
214
- # @nestable = options['nestable'] || false
215
229
 
216
230
  if @auth && ! @self_auth && @nested_args.none?
217
231
  @object_owner_sym = @auth.gsub("current_", "").to_sym
@@ -228,16 +242,28 @@ module HotGlue
228
242
  end
229
243
 
230
244
 
231
-
245
+ @ujs_syntax = options['ujs_syntax']
246
+ if !@ujs_syntax
247
+ @ujs_syntax = !defined?(Turbo::Engine)
248
+ puts "You did not specify ujs_syntax and so I default it to #{@ujs_syntax}"
249
+ end
232
250
  @reference_name = HotGlue.derrive_reference_name(singular_class)
233
251
 
234
252
  identify_object_owner
235
253
  setup_fields
236
254
 
255
+ buttons_width = ((!@no_edit && 1) || 0) + ((!@no_delete && 1) || 0) + @magic_buttons.count
237
256
 
238
- if @nested_args.none? && File.exists?("#{Rails.root}/app/views/#{namespace_with_trailing_dash}_menu.#{@markup}")
239
- @menu_file_exists = true
240
- end
257
+ builder = HotGlue::Layout::Builder.new({
258
+ include_setting: options['include'],
259
+ downnest_children: @downnest_children,
260
+ buttons_width: buttons_width,
261
+ columns: @columns,
262
+ smart_layout: @smart_layout
263
+ })
264
+ @layout_object = builder.construct
265
+
266
+ @menu_file_exists = true if @nested_args.none? && File.exists?("#{Rails.root}/app/views/#{namespace_with_trailing_dash}_menu.#{@markup}")
241
267
  end
242
268
 
243
269
  def identify_object_owner
@@ -256,17 +282,15 @@ module HotGlue
256
282
  if @god
257
283
  exit_message= "*** Oops: Gd mode could not find the association(#{@object_owner_sym}). Something is wrong."
258
284
  else
259
- @auth_check = "current_user"
285
+ @auth_check = eval(@auth_identifier.titleize)
260
286
  @nested_args.each do |arg|
261
-
262
- if !@auth_check.method("#{arg}s")
287
+ if ! @auth_check.reflect_on_association("#{arg}s".to_sym)
263
288
  exit_message = "*** Oops: your nesting chain does not have a association for #{arg}s on #{@auth_check} something is wrong."
264
289
  end
265
290
  end
266
291
  end
267
292
  puts exit_message
268
- exit
269
-
293
+ raise(HotGlue::Error, exit_message)
270
294
  end
271
295
  end
272
296
  end
@@ -307,26 +331,20 @@ module HotGlue
307
331
  begin
308
332
  eval(assoc.class_name)
309
333
  rescue NameError => e
310
- exit_message = "*** Oops: The model #{singular_class} is missing an association for #{assoc_name} or the model doesn't exist. TODO: Please implement a model for #{assoc_name.titlecase}; your model #{singular_class.titlecase} should have_many :#{assoc_name}s. To make a controller that can read all records, specify with --god."
334
+ exit_message = "*** Oops: The model #{singular_class} is missing an association for :#{assoc_name} or the model #{assoc_name.titlecase} doesn't exist. TODO: Please implement a model for #{assoc_name.titlecase}; your model #{singular_class.titlecase} should belong_to :#{assoc_name}. To make a controller that can read all records, specify with --god."
311
335
  puts exit_message
312
- exit
313
- # raise(HotGlue::Error, exit_message)
314
-
336
+ raise(HotGlue::Error, exit_message)
315
337
  end
316
338
 
317
339
 
318
340
  if assoc.nil?
319
341
  exit_message = "*** Oops. on the #{singular_class} object, there doesn't seem to be an association called '#{assoc_name}'"
320
342
  puts exit_message
321
- exit
322
- # raise(HotGlue::Error,exit_message)
343
+ raise(HotGlue::Error,exit_message)
323
344
  end
324
345
 
325
346
  assoc_class = eval(assoc.class_name)
326
-
327
347
  name_list = [:name, :to_label, :full_name, :display_name, :email]
328
-
329
-
330
348
  if name_list.collect{ |field|
331
349
  assoc_class.column_names.include?(field.to_s) || assoc_class.instance_methods.include?(field)
332
350
  }.any?
@@ -340,7 +358,6 @@ module HotGlue
340
358
  end
341
359
  end
342
360
 
343
- #
344
361
  def formats
345
362
  [format]
346
363
  end
@@ -365,17 +382,22 @@ module HotGlue
365
382
 
366
383
  unless @no_specs
367
384
  dest_file = File.join("#{'spec/dummy/' if Rails.env.test?}spec/system#{namespace_with_dash}", "#{plural}_behavior_spec.rb")
368
- existing_file = File.open(dest_file)
369
- existing_content = existing_file.read
370
- if existing_content =~ /\#HOTGLUE-SAVESTART/
371
- if existing_content !~ /\#HOTGLUE-END/
372
- raise "Your file at #{dest_file} contains a #HOTGLUE-SAVESTART marker without #HOTGLUE-END"
373
- end
374
- @existing_content = existing_content[(existing_content =~ /\#HOTGLUE-SAVESTART/) .. (existing_content =~ /\#HOTGLUE-END/)-1]
375
- @existing_content << "#HOTGLUE-END"
376
385
 
386
+ if File.exists?(dest_file)
387
+ existing_file = File.open(dest_file)
388
+ existing_content = existing_file.read
389
+ if existing_content =~ /\#HOTGLUE-SAVESTART/
390
+ if existing_content !~ /\#HOTGLUE-END/
391
+ raise "Your file at #{dest_file} contains a #HOTGLUE-SAVESTART marker without #HOTGLUE-END"
392
+ end
393
+ @existing_content = existing_content[(existing_content =~ /\#HOTGLUE-SAVESTART/) .. (existing_content =~ /\#HOTGLUE-END/)-1]
394
+ @existing_content << "#HOTGLUE-END"
395
+
396
+ end
397
+ existing_file.rewind
398
+ else
399
+ @existing_content = " #HOTGLUE-SAVESTART\n #HOTGLUE-END"
377
400
  end
378
- existing_file.rewind
379
401
 
380
402
  template "system_spec.rb.erb", dest_file
381
403
  end
@@ -386,24 +408,26 @@ module HotGlue
386
408
  def list_column_headings
387
409
  if @nested_args.any?
388
410
  column_width = each_col * @columns.count
389
-
390
- "<div class='#{@col_identifier}' style='flex-basis: #{column_width}%'>"
391
411
  else
392
- @template_builder.list_column_headings(
393
- column_width: each_col,
394
- columns: @columns,
395
- col_identifier: @col_identifier
396
- )
412
+ column_width = 0
397
413
  end
398
414
 
415
+ if !@smart_layout
416
+ col_identifier = @layout == "hotglue" ? "scaffold-cell" : "col-md-1"
417
+ else
418
+ col_identifier = @layout == "hotglue" ? "scaffold-cell" : "col-md-2"
419
+ end
399
420
 
421
+ @template_builder.list_column_headings(
422
+ columns: @layout_object[:columns][:container],
423
+ col_identifier: col_identifier,
424
+ layout: @layout,
425
+ column_width: column_width
426
+ )
400
427
  end
401
428
 
402
429
  def columns_spec_with_sample_data
403
430
  @columns.map { |c|
404
- if eval("#{singular_class}.columns_hash['#{c}']").nil?
405
- byebug
406
- end
407
431
  type = eval("#{singular_class}.columns_hash['#{c}']").type
408
432
  random_data = case type
409
433
  when :integer
@@ -605,24 +629,10 @@ module HotGlue
605
629
  path_helper_singular: path_helper_singular,
606
630
  path_helper_args: path_helper_args,
607
631
  singular: singular,
608
- magic_buttons: @magic_buttons
632
+ magic_buttons: @magic_buttons,
633
+ small_buttons: @small_buttons
609
634
  )
610
635
  end
611
- # def erb_replace_ampersands!(filename = nil)
612
- #
613
- # return if filename.nil?
614
- # file = File.open(filename, "r")
615
- # contents = file.read
616
- # file.close
617
- #
618
- # file = File.open(filename, "w")
619
- # file.write( contents.gsub('\%', '%'))
620
- # file.close
621
- # end
622
-
623
-
624
-
625
-
626
636
 
627
637
  def copy_view_files
628
638
  return if @specs_only
@@ -674,20 +684,35 @@ module HotGlue
674
684
  end
675
685
 
676
686
  def all_views
677
- res = %w(index edit _form _line _list _show _errors)
687
+ res = %w(index _line _list _show _errors)
678
688
 
679
689
  unless @no_create
680
690
  res += %w(new _new_form _new_button)
681
691
  end
682
692
 
693
+ unless @no_edit
694
+ res << 'edit'
695
+ res << '_form'
696
+ end
697
+
683
698
  res
684
699
  end
685
700
 
686
701
  def turbo_stream_views
687
- res = %w(create edit update)
702
+ res = []
688
703
  unless @no_delete
689
704
  res << 'destroy'
690
705
  end
706
+
707
+ unless @no_create
708
+ res << 'create'
709
+ end
710
+
711
+ unless @no_edit
712
+ res << 'edit'
713
+ res << 'update'
714
+ end
715
+
691
716
  res
692
717
  end
693
718
 
@@ -705,13 +730,19 @@ module HotGlue
705
730
  end
706
731
 
707
732
  def all_form_fields
733
+ # TODO: DRY THIS
734
+ if !@smart_layout
735
+ col_identifier = @layout == "hotglue" ? "scaffold-cell" : "col-md-1"
736
+ else
737
+ col_identifier = @layout == "hotglue" ? "scaffold-cell" : "col-md-2"
738
+ end
708
739
 
709
740
  @template_builder.all_form_fields(
710
- columns: @columns,
741
+ columns: @layout_object[:columns][:container],
711
742
  show_only: @show_only,
712
743
  singular_class: singular_class,
713
744
  singular: singular,
714
- col_identifier: @col_identifier
745
+ col_identifier: col_identifier
715
746
  )
716
747
  end
717
748
 
@@ -743,7 +774,7 @@ module HotGlue
743
774
 
744
775
  @template_builder.all_line_fields(
745
776
  perc_width: column_width,
746
- columns: @columns,
777
+ columns: @layout_object[:columns][:container],
747
778
  show_only: @show_only,
748
779
  singular_class: singular_class,
749
780
  singular: singular,
@@ -807,13 +838,13 @@ module HotGlue
807
838
  @template_builder.paginate(plural: plural)
808
839
  end
809
840
 
810
- def delete_confirmation_syntax
811
- if !@stimulus_syntax
812
- "{confirm: 'Are you sure?'}"
813
- else
814
- "{controller: 'confirmable', 'confirm-message': \"Are you sure you want to delete \#{ #{@singular}.#{ display_class } } \", 'action': 'confirmation#confirm'}"
815
- end
816
- end
841
+ # def delete_confirmation_syntax
842
+ # if !@stimulus_syntax
843
+ # "{confirm: 'Are you sure?'}"
844
+ # else
845
+ # "{controller: 'confirmable', 'confirm-message': \"Are you sure you want to delete \#{ #{@singular}.#{ display_class } } \", 'action': 'confirmation#confirm'}"
846
+ # end
847
+ # end
817
848
 
818
849
 
819
850
  def controller_magic_button_update_actions
@@ -38,7 +38,7 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
38
38
 
39
39
  <% if any_nested? %><% nest_chain = [@nested_args[0]]; this_scope = @nested_args[0] + 's'; %> <% @nested_args[1..-1].each { |arg|
40
40
  this_scope = "#{nest_chain.last}.#{arg}s"
41
- nest_chain << argscaffold_generator.rb
41
+ nest_chain << arg
42
42
  %>
43
43
  def <%= arg %>
44
44
  @<%= arg %> ||= <%= this_scope %>.find(params[:<%= arg %>_id])
@@ -1,7 +1,7 @@
1
1
  <div class="row">
2
2
  <%= all_form_fields %>
3
3
 
4
- <div class="<% @layout == "hotglue" ? 'scaffold-cell' : 'col' %>">
4
+ <div class="<%= @layout == "hotglue" ? 'scaffold-cell' : 'col-md-2' %>">
5
5
  <\%= link_to "Cancel", <%= path_helper_plural %>, {class: "btn btn-secondary"} %>
6
6
  <\%= f.submit "Save", class: "btn btn-primary pull-right" %>
7
7
  </div>
@@ -2,31 +2,30 @@
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('\\',"") %><% end %>
5
+ <% unless @no_create %><%= '<%= render partial: "' + ((@namespace+"/" if @namespace) || "") + plural + '/new_button", locals: {' + nested_assignments + '}' + '%\>'.gsub('\\',"") %><br /><% end %>
6
6
 
7
7
  <% unless @no_list %>
8
- <div class="row scaffold-row">
8
+ <div class="row scaffold-heading-row">
9
9
  <%= list_column_headings %>
10
10
  <% if @downnest_children.any? %>
11
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 + '%;' : "" %>
12
+ <% downnest_column_style = @layout == "hotglue" ? 'style="flex-basis: ' + each_downnest_width.to_s + '%;' : "" %>
13
13
 
14
- <% @downnest_children.each do |downnest| %>
15
- <div class="<%= @col_identifer %> scaffold-col-heading<%= ' col-md-3' if @layout=="bootstrap" %>" <%= downnest_column_style %>>
16
- <h4>
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
17
  <%= downnest.titleize %>
18
- </h4>
18
+ </strong>
19
19
  </div>
20
20
  <% end %>
21
21
  <% end %>
22
22
 
23
23
  <% button_column_style = @layout == "hotglue" ? 'style="flex-basis: 150px' : "" %>
24
24
 
25
- <div class='<%= @col_identifer %> scaffold-col-heading scaffold-col-heading-buttons<%= ' col-md-2' if @layout=="bootstrap" %>' <%= button_column_style %>>
25
+ <div class=' scaffold-col-heading scaffold-col-heading-buttons<%= " col-md-#{ @layout_object[:buttons][:size] }" if @layout=="bootstrap" %>' <%= button_column_style %>>
26
26
 
27
27
  </div>
28
28
  </div>
29
-
30
29
  <\% if <%= plural %>.empty? %>
31
30
  <div>
32
31
  None
@@ -36,8 +35,6 @@
36
35
  <\%= render partial: '<%= line_path_partial %>', locals: {<%= singular %>: <%= singular %><%= nested_assignments_with_leading_comma if @nestable %><%= ", nested_for: nested_for" if @nestable %> } %>
37
36
  <\% end %>
38
37
  <%= @no_paginate ? "" : paginate %>
39
-
40
- </div>
41
- <% end %>
38
+ <% end %>
42
39
  </div>
43
40
  <\% end %>
@@ -3,12 +3,13 @@
3
3
  <% if @downnest_children.any? %>
4
4
  <% each_downnest_width = @downnest_children.count == 1 ? 33 : (53/@downnest_children.count).floor %>
5
5
 
6
- <% @downnest_children.each do |downnest| %>
6
+ <% @downnest_children.each_with_index do |downnest,i| %>
7
7
 
8
8
  <% downnest_object = eval("#{singular_class}.reflect_on_association(:#{downnest})") %>
9
- <% downnest_object_name = downnest_object.options[:class_name].tableize %>
10
- <% downnest_style = @layout == "hotglue" ? 'style="flex-basis: ' + each_downnest_width + '%"' : "" %>
11
- <div class="<%= @col_identifier %><%= ' col-md-3' if @layout == "bootstrap" %> scaffold-downnest" <%= downnest_style %> >
9
+ <% downnest_class = downnest_object.class_name %>
10
+ <% downnest_object_name = eval("#{downnest_class}.table_name") %>
11
+ <% downnest_style = @layout == "hotglue" ? 'style="flex-basis: ' + each_downnest_width.to_s + '%"' : "" %>
12
+ <div class="<%= " col-md-#{@layout_object[:portals][downnest][:size]}" if @layout == "bootstrap" %> scaffold-downnest" <%= downnest_style %> >
12
13
  <\%= render partial: "<%= namespace_with_trailing_dash %><%= downnest_object_name %>/list", locals: {
13
14
  nested_for: "<% if @nested_args.any? %>#{nested_for + "__" if nested_for}<% end %><%= @singular %>-#{<%= @singular %>.id}",
14
15
  <%= @singular %>: <%= @singular %><%= nest_assignments_operator(false, true) %>,
@@ -18,16 +19,15 @@
18
19
  <% end %>
19
20
 
20
21
  <% button_style = @layout == "hotglue" ? 'style="flex-basis: ' + (100 - (column_width * @columns.count)).floor.to_s + '%;"' : "" %>
21
- <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
+ <%= magic_button_output %>
24
+
22
25
  <% if destroy_action %>
23
- <\%= form_with url: <%= path_helper_singular %>(<%= path_helper_args %>), html: {style: "display: inline-block;"}, method: :delete do |f| %>
24
- <\%= 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" %>
25
28
  <\% end %>
26
29
  <% end %>
27
30
 
28
-
29
- <%= magic_button_output %>
30
-
31
31
  <% unless @no_edit %>
32
32
  <\%= link_to "Edit <i class='fa fa-1x fa-list-alt'></i>".html_safe, edit_<%= path_helper_singular %>(<%= path_helper_args %>), <% if @big_edit %>'data-turbo' => 'false', <% end %>disable_with: "Loading...", class: "edit-<%= singular %>-button btn btn-primary btn-sm" %>
33
33
  <% end %>