hot-glue 0.5.4 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +12 -5
- data/README.md +50 -9
- data/app/helpers/hot_glue/controller_helper.rb +2 -2
- data/lib/generators/hot_glue/install_generator.rb +13 -13
- data/lib/generators/hot_glue/layout/builder.rb +11 -8
- data/lib/generators/hot_glue/layout_strategy/base.rb +31 -0
- data/lib/generators/hot_glue/layout_strategy/bootstrap.rb +41 -0
- data/lib/generators/hot_glue/layout_strategy/hot_glue.rb +82 -0
- data/lib/generators/hot_glue/layout_strategy/tailwind.rb +28 -0
- data/lib/generators/hot_glue/markup_templates/base.rb +3 -3
- data/lib/generators/hot_glue/markup_templates/erb.rb +88 -80
- data/lib/generators/hot_glue/scaffold_generator.rb +88 -114
- data/lib/generators/hot_glue/templates/controller.rb.erb +3 -0
- data/lib/generators/hot_glue/templates/erb/_form.erb +1 -1
- data/lib/generators/hot_glue/templates/erb/_line.erb +1 -1
- data/lib/generators/hot_glue/templates/erb/_list.erb +5 -10
- data/lib/generators/hot_glue/templates/erb/_show.erb +3 -3
- data/lib/generators/hot_glue/templates/erb/index.erb +3 -6
- data/lib/hot-glue.rb +0 -4
- data/lib/hotglue/engine.rb +1 -1
- data/lib/hotglue/version.rb +1 -1
- metadata +6 -3
- data/lib/generators/hot_glue/helpers.rb +0 -13
@@ -7,11 +7,18 @@ require_relative './markup_templates/erb'
|
|
7
7
|
# require_relative './markup_templates/slim'
|
8
8
|
|
9
9
|
require_relative './layout/builder'
|
10
|
+
require_relative './layout_strategy/base'
|
11
|
+
require_relative './layout_strategy/bootstrap'
|
12
|
+
require_relative './layout_strategy/hot_glue'
|
13
|
+
require_relative './layout_strategy/tailwind'
|
14
|
+
|
10
15
|
|
11
16
|
module HotGlue
|
12
17
|
class Error < StandardError
|
13
18
|
end
|
14
19
|
|
20
|
+
|
21
|
+
|
15
22
|
def self.construct_downnest_object(input)
|
16
23
|
res = input.split(",").map { |child|
|
17
24
|
child_name = child.gsub("+","")
|
@@ -21,18 +28,14 @@ module HotGlue
|
|
21
28
|
Hash[*res.collect{|hash| hash.collect{|key,value| [key,value].flatten}.flatten}.flatten]
|
22
29
|
end
|
23
30
|
|
24
|
-
def self.optionalized_ternary(
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
31
|
+
def self.optionalized_ternary(namespace: nil,
|
32
|
+
target:,
|
33
|
+
nested_set:,
|
34
|
+
modifier: "",
|
35
|
+
with_params: false,
|
36
|
+
top_level: false,
|
37
|
+
put_form: false)
|
32
38
|
instance_sym = top_level ? "@" : ""
|
33
|
-
|
34
|
-
put_form = params[:put_form] || false
|
35
|
-
|
36
39
|
if nested_set.nil? || nested_set.empty?
|
37
40
|
return modifier + "#{(namespace + '_') if namespace}#{target}_path" + (("(#{instance_sym}#{target})" if put_form) || "")
|
38
41
|
elsif nested_set[0][:optional] == false
|
@@ -50,17 +53,23 @@ module HotGlue
|
|
50
53
|
nonoptional[:optional] = false
|
51
54
|
rest_of_nest = nested_set[1..-1]
|
52
55
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
56
|
+
is_present_path = HotGlue.optionalized_ternary(
|
57
|
+
namespace: namespace,
|
58
|
+
target: target,
|
59
|
+
modifier: modifier,
|
60
|
+
top_level: top_level,
|
61
|
+
with_params: with_params,
|
62
|
+
put_form: put_form,
|
63
|
+
nested_set: [nonoptional, *rest_of_nest])
|
64
|
+
|
65
|
+
is_missing_path = HotGlue.optionalized_ternary(
|
66
|
+
namespace: namespace,
|
67
|
+
target: target,
|
68
|
+
modifier: modifier,
|
69
|
+
top_level: top_level,
|
70
|
+
with_params: with_params,
|
71
|
+
put_form: put_form,
|
72
|
+
nested_set: rest_of_nest )
|
64
73
|
return "defined?(#{instance_sym + nested_set[0][:singular]}) ? #{is_present_path} : #{is_missing_path}"
|
65
74
|
end
|
66
75
|
end
|
@@ -78,8 +87,6 @@ module HotGlue
|
|
78
87
|
display_column = "display_name"
|
79
88
|
elsif assoc_class.new.respond_to?("email")
|
80
89
|
display_column = "email"
|
81
|
-
# else # SHOULD BE UNREACHABLE
|
82
|
-
# raise("this should have been caught by the checker in the initializer")
|
83
90
|
end
|
84
91
|
display_column
|
85
92
|
end
|
@@ -89,6 +96,7 @@ module HotGlue
|
|
89
96
|
|
90
97
|
source_root File.expand_path('templates', __dir__)
|
91
98
|
attr_accessor :path, :singular, :plural, :singular_class, :nest_with
|
99
|
+
attr_accessor :columns, :downnest_children, :layout_object
|
92
100
|
|
93
101
|
class_option :singular, type: :string, default: nil
|
94
102
|
class_option :plural, type: :string, default: nil
|
@@ -150,6 +158,7 @@ module HotGlue
|
|
150
158
|
raise(HotGlue::Error, message)
|
151
159
|
end
|
152
160
|
|
161
|
+
@meta_args = meta_args
|
153
162
|
|
154
163
|
if options['specs_only'] && options['no_specs']
|
155
164
|
raise(HotGlue::Error, "*** Oops: You seem to have specified both the --specs-only flag and --no-specs flags. this doesn't make any sense, so I am aborting. Aborting.")
|
@@ -180,37 +189,43 @@ module HotGlue
|
|
180
189
|
yaml_from_config = YAML.load(File.read("config/hot_glue.yml"))
|
181
190
|
@markup = yaml_from_config[:markup]
|
182
191
|
|
183
|
-
if
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
elsif @markup == "haml"
|
188
|
-
raise(HotGlue::Error, "HAML IS NOT IMPLEMENTED")
|
192
|
+
if options['layout']
|
193
|
+
layout = options['layout']
|
194
|
+
else
|
195
|
+
layout = yaml_from_config[:layout]
|
189
196
|
|
197
|
+
if !['hotglue', 'bootstrap', 'tailwind'].include? layout
|
198
|
+
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'"
|
199
|
+
end
|
190
200
|
end
|
191
201
|
|
202
|
+
@layout_strategy =
|
203
|
+
case layout
|
204
|
+
when 'bootstrap'
|
205
|
+
LayoutStrategy::Bootstrap.new(self)
|
206
|
+
when 'tailwind'
|
207
|
+
LayoutStrategy::Tailwind.new(self)
|
208
|
+
when 'hotglue'
|
209
|
+
LayoutStrategy::HotGlue.new(self)
|
210
|
+
end
|
192
211
|
|
193
|
-
if !options['layout']
|
194
|
-
@layout = yaml_from_config[:layout]
|
195
212
|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
213
|
+
if @markup == "erb"
|
214
|
+
@template_builder = HotGlue::ErbTemplate.new(layout_strategy: @layout_strategy)
|
215
|
+
elsif @markup == "slim"
|
216
|
+
raise(HotGlue::Error, "SLIM IS NOT IMPLEMENTED")
|
217
|
+
elsif @markup == "haml"
|
218
|
+
raise(HotGlue::Error, "HAML IS NOT IMPLEMENTED")
|
201
219
|
end
|
202
220
|
|
203
221
|
args = meta_args[0]
|
204
|
-
|
205
|
-
|
206
222
|
@singular = args.first.tableize.singularize # should be in form hello_world
|
207
223
|
|
208
|
-
|
209
224
|
if @singular.include?("/")
|
210
225
|
@singular = @singular.split("/").last
|
211
226
|
end
|
212
227
|
|
213
|
-
@plural = options['plural'] || @singular
|
228
|
+
@plural = options['plural'] || @singular.pluralize # respects what you set in inflections.rb, to override, use plural option
|
214
229
|
@namespace = options['namespace'] || nil
|
215
230
|
|
216
231
|
|
@@ -220,9 +235,9 @@ module HotGlue
|
|
220
235
|
@controller_build_folder = use_controller_name.underscore
|
221
236
|
@controller_build_folder_singular = singular
|
222
237
|
|
223
|
-
if ! @controller_build_folder.ends_with?("s")
|
224
|
-
|
225
|
-
end
|
238
|
+
# if ! @controller_build_folder.ends_with?("s")
|
239
|
+
# raise HotGlue::Error, "can't build with controller name #{@controller_build_folder} because it doesn't end with an 's'"
|
240
|
+
# end
|
226
241
|
|
227
242
|
@auth = options['auth'] || "current_user"
|
228
243
|
@auth_identifier = options['auth_identifier'] || (! @god && @auth.gsub("current_", "")) || nil
|
@@ -292,8 +307,7 @@ module HotGlue
|
|
292
307
|
raise HotGlue::Error, "You specified both --smart-layout and also specified grouping mode (there is a : character in your field include list); you must remove the colon(s) from your --include tag or remove the --smart-layout option"
|
293
308
|
end
|
294
309
|
|
295
|
-
|
296
|
-
@container_name = @layout == "hotglue" ? "scaffold-container" : "container-fluid"
|
310
|
+
@container_name = @layout_strategy.container_name
|
297
311
|
@downnest = options['downnest'] || false
|
298
312
|
|
299
313
|
@downnest_children = [] # TODO: defactor @downnest_children in favor of downnest_object
|
@@ -353,7 +367,6 @@ module HotGlue
|
|
353
367
|
plural: arg.pluralize,
|
354
368
|
optional: is_optional
|
355
369
|
}
|
356
|
-
|
357
370
|
}
|
358
371
|
puts "NESTING: #{@nested_set}"
|
359
372
|
end
|
@@ -361,7 +374,6 @@ module HotGlue
|
|
361
374
|
# OBJECT OWNERSHIP & NESTING
|
362
375
|
@reference_name = HotGlue.derrive_reference_name(singular_class)
|
363
376
|
if @auth && @self_auth
|
364
|
-
# byebug
|
365
377
|
@object_owner_sym = @auth.gsub("current_", "").to_sym
|
366
378
|
@object_owner_eval = @auth
|
367
379
|
@object_owner_optional = false
|
@@ -369,18 +381,15 @@ module HotGlue
|
|
369
381
|
|
370
382
|
|
371
383
|
elsif @auth && ! @self_auth && @nested_set.none? && !@auth.include?(".")
|
372
|
-
# byebug
|
373
384
|
@object_owner_sym = @auth.gsub("current_", "").to_sym
|
374
385
|
@object_owner_eval = @auth
|
375
386
|
@object_owner_optional = false
|
376
387
|
@object_owner_name = @auth.gsub("current_", "").to_s
|
377
388
|
|
378
389
|
elsif @auth && @auth.include?(".")
|
379
|
-
# byebug
|
380
390
|
@object_owner_sym = nil
|
381
391
|
@object_owner_eval = @auth
|
382
392
|
else
|
383
|
-
# byebug
|
384
393
|
if @nested_set.any?
|
385
394
|
@object_owner_sym = @nested_set.last[:singular].to_sym
|
386
395
|
@object_owner_eval = "@#{@nested_set.last[:singular]}"
|
@@ -405,13 +414,11 @@ module HotGlue
|
|
405
414
|
|
406
415
|
buttons_width = ((!@no_edit && 1) || 0) + ((!@no_delete && 1) || 0) + @magic_buttons.count
|
407
416
|
|
408
|
-
builder = HotGlue::Layout::Builder.new(
|
409
|
-
include_setting: options['include'],
|
417
|
+
builder = HotGlue::Layout::Builder.new(include_setting: options['include'],
|
410
418
|
downnest_object: @downnest_object,
|
411
419
|
buttons_width: buttons_width,
|
412
420
|
columns: @columns,
|
413
|
-
smart_layout: @smart_layout
|
414
|
-
})
|
421
|
+
smart_layout: @smart_layout )
|
415
422
|
@layout_object = builder.construct
|
416
423
|
|
417
424
|
@menu_file_exists = true if @nested_set.none? && File.exists?("#{Rails.root}/app/views/#{namespace_with_trailing_dash}_menu.#{@markup}")
|
@@ -433,8 +440,12 @@ module HotGlue
|
|
433
440
|
key = hawk_entry
|
434
441
|
hawk_to = @auth
|
435
442
|
end
|
443
|
+
|
436
444
|
hawk_scope = key.gsub("_id", "").pluralize
|
437
|
-
@hawk_keys[key.to_sym] = [hawk_to
|
445
|
+
@hawk_keys[key.to_sym] = [hawk_to]
|
446
|
+
if @use_shorthand # only include the hawk scope if using the shorthand
|
447
|
+
@hawk_keys[key.to_sym] << hawk_scope
|
448
|
+
end
|
438
449
|
end
|
439
450
|
|
440
451
|
puts "HAWKING: #{@hawk_keys}"
|
@@ -447,7 +458,6 @@ module HotGlue
|
|
447
458
|
if @object_owner_sym && ! @self_auth
|
448
459
|
auth_assoc_field = auth_assoc + "_id" unless @god
|
449
460
|
assoc = eval("#{singular_class}.reflect_on_association(:#{@object_owner_sym})")
|
450
|
-
# byebug
|
451
461
|
if assoc
|
452
462
|
@ownership_field = assoc.name.to_s + "_id"
|
453
463
|
elsif ! @nested_set.any?
|
@@ -586,19 +596,10 @@ module HotGlue
|
|
586
596
|
end
|
587
597
|
|
588
598
|
def list_column_headings
|
589
|
-
if @layout == "bootstrap"
|
590
|
-
column_width = @layout_object[:columns][:size_each]
|
591
|
-
col_identifier = "col-md-#{column_width}"
|
592
|
-
elsif @layout == "hotglue"
|
593
|
-
column_width = each_col * @columns.count
|
594
|
-
col_identifier = "scaffold-cell"
|
595
|
-
end
|
596
|
-
|
597
599
|
@template_builder.list_column_headings(
|
598
600
|
columns: @layout_object[:columns][:container],
|
599
|
-
col_identifier:
|
600
|
-
|
601
|
-
column_width: column_width
|
601
|
+
col_identifier: @layout_strategy.column_classes_for_column_headings,
|
602
|
+
column_width: @layout_strategy.column_width
|
602
603
|
)
|
603
604
|
end
|
604
605
|
|
@@ -619,6 +620,11 @@ module HotGlue
|
|
619
620
|
}.join(", ")
|
620
621
|
end
|
621
622
|
|
623
|
+
|
624
|
+
def regenerate_me_code
|
625
|
+
"rails generate hot_glue:scaffold #{ @meta_args[0][0] } #{@meta_args[1].join(" ")}"
|
626
|
+
end
|
627
|
+
|
622
628
|
def object_parent_mapping_as_argument_for_specs
|
623
629
|
if @nested_set.any?
|
624
630
|
", " + @nested_set.last[:singular] + ": " + @nested_set.last[:singular]
|
@@ -899,6 +905,15 @@ module HotGlue
|
|
899
905
|
)
|
900
906
|
end
|
901
907
|
|
908
|
+
def nav_template
|
909
|
+
"#{namespace_with_trailing_dash}nav"
|
910
|
+
end
|
911
|
+
|
912
|
+
|
913
|
+
def include_nav_template
|
914
|
+
File.exists?("#{Rails.root}/app/views/#{namespace_with_trailing_dash}_nav.html.#{@markup}")
|
915
|
+
end
|
916
|
+
|
902
917
|
def copy_view_files
|
903
918
|
return if @specs_only
|
904
919
|
all_views.each do |view|
|
@@ -943,9 +958,10 @@ module HotGlue
|
|
943
958
|
|
944
959
|
def append_model_callbacks
|
945
960
|
# somehow the generator invokes this
|
961
|
+
|
946
962
|
if options['with_turbo_streams'] == true
|
947
963
|
dest_filename = cc_filename_with_extensions("#{singular_class.underscore}", "rb")
|
948
|
-
dest_filepath = File.join("#{'dummy/' if Rails.env.test?}app/models", dest_filename)
|
964
|
+
dest_filepath = File.join("#{'spec/dummy/' if Rails.env.test?}app/models", dest_filename)
|
949
965
|
|
950
966
|
|
951
967
|
puts "appending turbo callbacks to #{dest_filepath}"
|
@@ -1026,24 +1042,19 @@ module HotGlue
|
|
1026
1042
|
end
|
1027
1043
|
|
1028
1044
|
def all_form_fields
|
1029
|
-
col_identifier = (@layout == "hotglue") ? "scaffold-cell" : "col-md-#{@layout_object[:columns][:size_each]}"
|
1030
|
-
|
1031
1045
|
@template_builder.all_form_fields(
|
1032
1046
|
columns: @layout_object[:columns][:container],
|
1033
1047
|
show_only: @show_only,
|
1034
1048
|
singular_class: singular_class,
|
1035
1049
|
singular: singular,
|
1036
1050
|
hawk_keys: @hawk_keys,
|
1037
|
-
col_identifier:
|
1051
|
+
col_identifier: @layout_strategy.column_classes_for_form_fields,
|
1038
1052
|
ownership_field: @ownership_field,
|
1039
1053
|
form_labels_position: @form_labels_position,
|
1040
1054
|
form_placeholder_labels: @form_placeholder_labels
|
1041
1055
|
)
|
1042
1056
|
end
|
1043
1057
|
|
1044
|
-
def column_width
|
1045
|
-
@each_col ||= each_col
|
1046
|
-
end
|
1047
1058
|
|
1048
1059
|
def list_label
|
1049
1060
|
if(eval("#{class_name}.class_variable_defined?(:@@table_label_plural)"))
|
@@ -1061,39 +1072,15 @@ module HotGlue
|
|
1061
1072
|
end
|
1062
1073
|
end
|
1063
1074
|
|
1064
|
-
def each_col
|
1065
|
-
return col_width if @columns.count == 0
|
1066
|
-
(col_width/(@columns.count)).to_i
|
1067
|
-
end
|
1068
|
-
|
1069
|
-
def col_width
|
1070
|
-
downnest_size = case (@downnest_children.count)
|
1071
|
-
|
1072
|
-
when 0
|
1073
|
-
downnest_size = 0
|
1074
|
-
when 1
|
1075
|
-
downnest_size = 40
|
1076
|
-
|
1077
|
-
else
|
1078
|
-
downnest_size = 60
|
1079
|
-
|
1080
|
-
end
|
1081
|
-
100 - downnest_size - 5
|
1082
|
-
end
|
1083
|
-
|
1084
1075
|
def all_line_fields
|
1085
|
-
col_identifier = (@layout == "hotglue") ? "scaffold-cell" : "col-md-#{@layout_object[:columns][:size_each]}"
|
1086
|
-
|
1087
1076
|
@template_builder.all_line_fields(
|
1088
|
-
perc_width:
|
1077
|
+
perc_width: @layout_strategy.each_col, #undefined method `each_col'
|
1089
1078
|
columns: @layout_object[:columns][:container],
|
1090
1079
|
show_only: @show_only,
|
1091
1080
|
singular_class: singular_class,
|
1092
1081
|
singular: singular,
|
1093
|
-
|
1094
|
-
col_identifier: col_identifier,
|
1082
|
+
col_identifier: @layout_strategy.column_classes_for_line_fields,
|
1095
1083
|
inline_list_labels: @inline_list_labels
|
1096
|
-
|
1097
1084
|
)
|
1098
1085
|
end
|
1099
1086
|
|
@@ -1152,15 +1139,6 @@ module HotGlue
|
|
1152
1139
|
@template_builder.paginate(plural: plural)
|
1153
1140
|
end
|
1154
1141
|
|
1155
|
-
# def delete_confirmation_syntax
|
1156
|
-
# if !@stimulus_syntax
|
1157
|
-
# "{confirm: 'Are you sure?'}"
|
1158
|
-
# else
|
1159
|
-
# "{controller: 'confirmable', 'confirm-message': \"Are you sure you want to delete \#{ #{@singular}.#{ display_class } } \", 'action': 'confirmation#confirm'}"
|
1160
|
-
# end
|
1161
|
-
# end
|
1162
|
-
|
1163
|
-
|
1164
1142
|
def controller_magic_button_update_actions
|
1165
1143
|
@magic_buttons.collect{ |magic_button|
|
1166
1144
|
" if #{singular}_params[:#{magic_button}]
|
@@ -1192,7 +1170,6 @@ module HotGlue
|
|
1192
1170
|
end
|
1193
1171
|
end
|
1194
1172
|
|
1195
|
-
|
1196
1173
|
def n_plus_one_includes
|
1197
1174
|
if @associations.any?
|
1198
1175
|
".includes(" + @associations.map{|x| ":#{x.to_s}"}.join(", ") + ")"
|
@@ -1236,6 +1213,3 @@ module HotGlue
|
|
1236
1213
|
end
|
1237
1214
|
end
|
1238
1215
|
end
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<div class="row">
|
2
2
|
<%= all_form_fields %>
|
3
3
|
|
4
|
-
<div class="<%= @
|
4
|
+
<div class="<%= @layout_strategy.column_classes_for_form_fields %>">
|
5
5
|
<\%= link_to "Cancel", <%= path_helper_plural %>, {class: "btn btn-secondary"} %><% if @no_field_form %>
|
6
6
|
<\%= f.hidden_field "_________" %><% end %>
|
7
7
|
<\%= f.submit "Save", class: "btn btn-primary pull-right" %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% if @turbo_streams %><\%= turbo_stream_from <%= singular %> %>
|
2
2
|
<% end %><\%= turbo_frame_tag "<%= @namespace %>__#{ dom_id(<%= singular %>) }" do %>
|
3
|
-
<div class='
|
3
|
+
<div class='<%= @layout_strategy.row_classes %>' data-id='<\%= <%= singular %>.id %>' data-edit='false'>
|
4
4
|
<\%= render partial: '<%= show_path_partial %>', locals: { <%= singular %>: <%= singular %> }<% @nested_set.each do |nest_arg| %>.merge(defined?(<%= nest_arg[:singular] %>) ? {<%= nest_arg[:singular] %>: <%= nest_arg[:singular] %>, nested_for: "<%= nest_arg[:singular] %>-#{<%= nest_arg[:singular] %>.id}"} : {})<% end %> %>
|
5
5
|
|
6
6
|
</div>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<\%= turbo_frame_tag "<%= @namespace %>__<%= plural %>-list" <%= nested_for_turbo_id_list_constructor %> do %>
|
2
|
-
<div class="<%= @container_name %>
|
2
|
+
<div class="<%= @container_name %> <%= @layout_strategy.list_classes %>">
|
3
3
|
<% unless @no_list || @no_list_label || (@nested_set.any? && !@nested_set.collect{|x| x[:optional]}.any?) %>
|
4
4
|
<% unless list_label.nil? %><h4>
|
5
5
|
<%= list_label %>
|
@@ -10,14 +10,12 @@
|
|
10
10
|
|
11
11
|
<% unless @no_list %>
|
12
12
|
<% unless @no_list_heading %>
|
13
|
-
<div class="
|
13
|
+
<div class="<%= @layout_strategy.row_classes %> <%= @layout_strategy.row_heading_classes %>">
|
14
14
|
<%= list_column_headings %>
|
15
15
|
<% if @downnest_object.any? %>
|
16
|
-
|
17
|
-
<% downnest_column_style = @layout == "hotglue" ? 'style="flex-basis: ' + each_downnest_width.to_s + '%;' : "" %>
|
18
|
-
|
16
|
+
<%= @layout_strategy.downnest_column_style %>
|
19
17
|
<% @downnest_object.each do |downnest,i| %>
|
20
|
-
<div class=" scaffold-col-heading<%=
|
18
|
+
<div class=" scaffold-col-heading <%= @layout_strategy.downnest_portal_column_width(downnest) %> <%= @layout_strategy.downnest_column_style %>">
|
21
19
|
<strong>
|
22
20
|
<%= downnest.titleize %>
|
23
21
|
</strong>
|
@@ -25,10 +23,7 @@
|
|
25
23
|
<% end %>
|
26
24
|
<% end %>
|
27
25
|
|
28
|
-
|
29
|
-
|
30
|
-
<div class=' scaffold-col-heading scaffold-col-heading-buttons<%= " col-md-#{ @layout_object[:buttons][:size] }" if @layout=="bootstrap" %>' <%= button_column_style %>>
|
31
|
-
|
26
|
+
<div class=' scaffold-col-heading scaffold-col-heading-buttons <%= @layout_strategy.column_classes_for_column_headings %>' <%= @layout_strategy.button_column_style %>>
|
32
27
|
</div>
|
33
28
|
</div>
|
34
29
|
<% end %>
|
@@ -9,7 +9,7 @@
|
|
9
9
|
<% if downnest_object.nil?; raise "no relationship for downnested portal `#{downnest}` found on `#{singular_class}`; please check relationship for has_many :#{downnest}"; end; %>
|
10
10
|
<% downnest_class = downnest_object.class_name %>
|
11
11
|
<% downnest_object_name = eval("#{downnest_class}.table_name") %>
|
12
|
-
<% downnest_style =
|
12
|
+
<% downnest_style = @layout_strategy.downnest_style %>
|
13
13
|
<div class="<%= " col-md-#{@layout_object[:portals][downnest][:size]}" if @layout == "bootstrap" %> scaffold-downnest" <%= downnest_style %> >
|
14
14
|
<\%= render partial: "<%= namespace_with_trailing_dash %><%= downnest_object_name %>/list", locals: {
|
15
15
|
<%= @singular %>: <%= @singular %>,
|
@@ -22,8 +22,8 @@
|
|
22
22
|
<% end %>
|
23
23
|
<% end %>
|
24
24
|
|
25
|
-
|
26
|
-
<div class="<%= @col_identifier %> scaffold-line-buttons <%=
|
25
|
+
<%= @layout_strategy.button_style %>
|
26
|
+
<div class="<%= @col_identifier %> scaffold-line-buttons <%= @layout_strategy.button_classes %>" <%= @layout_strategy.button_style %>>
|
27
27
|
<%= magic_button_output %>
|
28
28
|
|
29
29
|
<% if destroy_action %>
|
@@ -1,14 +1,11 @@
|
|
1
1
|
<% if @menu_file_exists %><\%= render partial: "<%= namespace_with_trailing_dash %>menu", locals: {active: '<%= plural %>'} %><% end %>
|
2
2
|
|
3
3
|
<div class="<%= @container_name %>">
|
4
|
-
|
5
|
-
<%
|
6
|
-
<div class=' scaffold-index-<%= plural %>'>
|
7
|
-
<% end %>
|
4
|
+
<%= @layout_strategy.page_begin %>
|
5
|
+
<% if include_nav_template %><\%= render partial: "<%= nav_template %>", locals: {nav: "<%= @plural %>"} %><% end %>
|
8
6
|
|
9
|
-
<div class="clearfix"></div>
|
10
7
|
<\%= render partial: '<%= list_path_partial %>',
|
11
8
|
locals: {<%= plural %>: @<%= plural %>}<%= @nested_set.collect{|arg| ".merge(@" + arg[:singular] + " ? {nested_for: \"" + arg[:singular] + "-\#{@" + arg[:singular] + ".id}\"" + ", " + arg[:singular] + ": @" + arg[:singular] + "} : {})"}.join() %> \%>
|
12
9
|
|
13
|
-
|
10
|
+
<%= @layout_strategy.page_end %>
|
14
11
|
</div>
|
data/lib/hot-glue.rb
CHANGED
data/lib/hotglue/engine.rb
CHANGED
data/lib/hotglue/version.rb
CHANGED
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.5.
|
4
|
+
version: 0.5.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:
|
11
|
+
date: 2023-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -75,9 +75,12 @@ files:
|
|
75
75
|
- config/database.yml
|
76
76
|
- config/hot_glue.yml
|
77
77
|
- db/schema.rb
|
78
|
-
- lib/generators/hot_glue/helpers.rb
|
79
78
|
- lib/generators/hot_glue/install_generator.rb
|
80
79
|
- lib/generators/hot_glue/layout/builder.rb
|
80
|
+
- lib/generators/hot_glue/layout_strategy/base.rb
|
81
|
+
- lib/generators/hot_glue/layout_strategy/bootstrap.rb
|
82
|
+
- lib/generators/hot_glue/layout_strategy/hot_glue.rb
|
83
|
+
- lib/generators/hot_glue/layout_strategy/tailwind.rb
|
81
84
|
- lib/generators/hot_glue/markup_templates/base.rb
|
82
85
|
- lib/generators/hot_glue/markup_templates/erb.rb
|
83
86
|
- lib/generators/hot_glue/scaffold_generator.rb
|
@@ -1,13 +0,0 @@
|
|
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
|