hot-glue 0.3.5 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2fe831af428ff123db3490a3a376cadb40c1acd01f10f8926213dced0b78abaa
4
- data.tar.gz: 5091fd12e7ca86865891e6f4fbaa5ad36b78951f2dd99d1819eb5eab8e32a2a7
3
+ metadata.gz: c3f0bea54517d12d4518615c1807c783ec6cdbf1ea5c40eb8860771262929d82
4
+ data.tar.gz: 3e7aa8a54329f8d7601b7597477ec5010f2e7af8dd034173ab8ac7adff5e8aa1
5
5
  SHA512:
6
- metadata.gz: 35ecea29e077ad022c227ad994f0dd98fea31e849eef0158e578aa6be8d1b3cd212d124285193169f3fd23f7643a24ee327f5b2edb47837069f6db44de122d5a
7
- data.tar.gz: 7fa9b3bc28743cf2c0989a47705335b9270d42c208c6b8317a9efac6d7a7de4c6d1a873c9550c7d056e9a2f85003f2c521ce7c0d5a30b6f3535e1057299e2119
6
+ metadata.gz: fb01610edb92fae69b0db9eab7e25eb4595abc6952789c1f816b6b9e8910f86a37bf713e394a73676e691f9c7fdfb5b3488ba05bdae21bb8cbe01e5008086a87
7
+ data.tar.gz: 2d932ad6bda29b971ab7252b6fecbf120f05089a65b5bbcdca588aa24fd459b2b727d310a81735008c26a17beedd449d7d58258701f43a3be305edd26373f577
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hot-glue (0.2.9E)
4
+ hot-glue (0.3.9)
5
5
  ffaker (~> 2.16)
6
6
  kaminari (~> 1.2)
7
7
  rails (> 5.1, <= 7.0.0)
@@ -29,17 +29,22 @@ module HotGlue
29
29
 
30
30
 
31
31
  print "(To purchase a license, please see https://heliosdev.shop/hot-glue-license) \n Please enter your license key: "
32
- license_activation_key = STDIN.gets
32
+ license_activation_key = STDIN.gets.strip
33
33
 
34
34
  print "Please enter the EMAIL you used to purchase this license: "
35
- license_email = STDIN.gets
35
+ license_email = STDIN.gets.strip
36
36
  app_name = Rails.application.class.module_parent_name
37
- license_should_be = Digest::SHA1.hexdigest("HotGlueLicense--#{app_name}--#{license_email}")
37
+ license_should_be = Digest::SHA1.hexdigest("HOT-GLUE-LICENSE--#{app_name}--#{license_email}")
38
+
39
+
38
40
  if (license_should_be != license_activation_key)
39
41
  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."
40
42
  exit
41
43
  end
42
44
 
45
+
46
+
47
+
43
48
  @markup = options['markup']
44
49
  if @markup == "haml"
45
50
  copy_file "haml/_flash_notices.haml", "#{'spec/dummy/' if Rails.env.test?}app/views/layouts/_flash_notices.haml"
@@ -52,85 +57,112 @@ module HotGlue
52
57
  copy_file "confirmable.js", "#{'spec/dummy/' if Rails.env.test?}app/javascript/controllers/confirmable.js"
53
58
  end
54
59
 
55
- if Rails.version.split(".")[0].to_i == 6
56
- app_js_contents = File.read("app/javascript/packs/application.js")
57
- if app_js_contents.include?("import Turbolinks from \"turbolinks\"")
58
- app_js_contents.gsub!("import Turbolinks from \"turbolinks\"", "import { Turbo } from \"@hotwired/turbo-rails\"")
59
- puts " HOTGLUE --> fixed packs/application.js: swapping old Turbolinks syntas for new Turbo-Rails syntax [ import { Turbo } from \"@hotwired/turbo-rails\" ] "
60
- end
61
60
 
62
- if app_js_contents.include?("Turbolinks.start()")
63
- app_js_contents.gsub!("Turbolinks.start()", "Turbo.start()")
64
- puts " HOTGLUE --> fixed packs/application.js: swapping old Turbolinks syntas for new Turbo-Rails syntax[ Turbolinks.start() ] "
65
- end
66
- File.write("app/javascript/packs/application.js", app_js_contents)
61
+ begin
62
+ if Rails.version.split(".")[0].to_i == 6
63
+ app_js_contents = File.read("app/javascript/packs/application.js")
64
+ if app_js_contents.include?("import Turbolinks from \"turbolinks\"")
65
+ app_js_contents.gsub!("import Turbolinks from \"turbolinks\"", "import { Turbo } from \"@hotwired/turbo-rails\"")
66
+ puts " HOTGLUE --> fixed packs/application.js: swapping old Turbolinks syntas for new Turbo-Rails syntax [ import { Turbo } from \"@hotwired/turbo-rails\" ] "
67
+ end
67
68
 
69
+ if app_js_contents.include?("Turbolinks.start()")
70
+ app_js_contents.gsub!("Turbolinks.start()", "Turbo.start()")
71
+ puts " HOTGLUE --> fixed packs/application.js: swapping old Turbolinks syntas for new Turbo-Rails syntax[ Turbolinks.start() ] "
72
+ end
73
+ File.write("app/javascript/packs/application.js", app_js_contents)
74
+ end
75
+ rescue StandardError => e
76
+ puts "WARNING: error writing to app/javascript/packs/application.js --- #{e.message}"
68
77
  end
69
78
 
70
79
 
71
- rails_helper_contents = File.read("spec/rails_helper.rb")
72
- if !rails_helper_contents.include?("Capybara.default_driver =")
73
- rails_helper_contents << "\nCapybara.default_driver = :selenium_chrome_headless "
74
- puts " HOTGLUE --> added to spec/rails_helper.rb: `Capybara.default_driver = :selenium_chrome_headless` "
75
- end
76
80
 
77
- if !rails_helper_contents.include?("include FactoryBot::Syntax::Methods")
78
- rails_helper_contents.gsub!("RSpec.configure do |config|", "RSpec.configure do |config| \n
79
- config.include FactoryBot::Syntax::Methods
80
- ")
81
- puts " HOTGLUE --> added to spec/rails_helper.rb: `config.include FactoryBot::Syntax::Methods` "
82
- end
81
+ begin
82
+ rails_helper_contents = File.read("spec/rails_helper.rb")
83
+ if !rails_helper_contents.include?("Capybara.default_driver =")
84
+ rails_helper_contents << "\nCapybara.default_driver = :selenium_chrome_headless "
85
+ puts " HOTGLUE --> added to spec/rails_helper.rb: `Capybara.default_driver = :selenium_chrome_headless` "
86
+ end
87
+
88
+ if !rails_helper_contents.include?("include FactoryBot::Syntax::Methods")
89
+ rails_helper_contents.gsub!("RSpec.configure do |config|", "RSpec.configure do |config| \n
90
+ config.include FactoryBot::Syntax::Methods
91
+ ")
92
+ puts " HOTGLUE --> added to spec/rails_helper.rb: `config.include FactoryBot::Syntax::Methods` "
93
+ end
94
+
95
+ if ! rails_helper_contents.include?("require 'support/capybara_login.rb'")
96
+ rails_helper_contents.gsub!("require 'rspec/rails'","require 'rspec/rails' \nrequire 'support/capybara_login.rb'")
97
+ puts " HOTGLUE --> added to spec/rails_helper.rb: `require 'support/capybara_login.rb'` "
98
+ end
99
+ File.write("spec/rails_helper.rb", rails_helper_contents)
83
100
 
84
- if ! rails_helper_contents.include?("require 'support/capybara_login.rb'")
85
- rails_helper_contents.gsub!("require 'rspec/rails'","require 'rspec/rails' \nrequire 'support/capybara_login.rb'")
86
- puts " HOTGLUE --> added to spec/rails_helper.rb: `require 'support/capybara_login.rb'` "
101
+ rescue StandardError => e
102
+ puts "WARNING: error writing to spec/rails_helper --- #{e.message}"
87
103
  end
88
- File.write("spec/rails_helper.rb", rails_helper_contents)
89
104
 
90
105
 
91
- application_layout_contents = File.read("app/views/layouts/application.html.erb")
106
+ begin
107
+ application_layout_contents = File.read("app/views/layouts/application.html.erb")
92
108
 
93
- if !application_layout_contents.include?("render partial: 'layouts/flash_notices'")
94
- application_layout_contents.gsub!("<body>", "<body>\n
95
- <%= render partial: 'layouts/flash_notices' %>
96
- ")
97
- File.write("app/views/layouts/application.html.erb", application_layout_contents)
98
- puts " HOTGLUE --> added to app/views/layouts/application.html.erb: `<%= render partial: 'layouts/flash_notices' %>` "
109
+ if !application_layout_contents.include?("render partial: 'layouts/flash_notices'")
110
+ application_layout_contents.gsub!("<body>", "<body>\n
111
+ <%= render partial: 'layouts/flash_notices' %>
112
+ ")
113
+ File.write("app/views/layouts/application.html.erb", application_layout_contents)
114
+ puts " HOTGLUE --> added to app/views/layouts/application.html.erb: `<%= render partial: 'layouts/flash_notices' %>` "
115
+ end
116
+ rescue StandardError => e
117
+ puts "WARNING: error writing to app/views/layouts/application.html.erb --- #{e.message}"
99
118
  end
100
119
 
101
120
 
102
- if @layout == "hotglue"
103
- theme_location = "themes/hotglue_scaffold_#{@theme}.scss"
104
- theme_file = "hotglue_scaffold_#{@theme}.scss"
121
+ begin
122
+ if @layout == "hotglue"
123
+ theme_location = "themes/hotglue_scaffold_#{@theme}.scss"
124
+ theme_file = "hotglue_scaffold_#{@theme}.scss"
105
125
 
106
- copy_file theme_location, "#{'spec/dummy/' if Rails.env.test?}app/assets/stylesheets/#{theme_file}"
126
+ copy_file theme_location, "#{'spec/dummy/' if Rails.env.test?}app/assets/stylesheets/#{theme_file}"
107
127
 
108
- application_scss = File.read("app/assets/stylesheets/application.scss")
128
+ application_scss = File.read("app/assets/stylesheets/application.scss")
109
129
 
110
- if !application_scss.include?("@import '#{theme_file}';")
111
- application_scss << ( "\n @import '#{theme_file}'; ")
112
- File.write("app/assets/stylesheets/application.scss", application_scss)
113
- puts " HOTGLUE --> added to app/assets/stylesheets/application.scss: @import '#{theme_file}' "
114
- else
115
- puts " HOTGLUE --> already found theme in app/assets/stylesheets/application.scss: @import '#{theme_file}' "
130
+ if !application_scss.include?("@import '#{theme_file}';")
131
+ application_scss << ( "\n @import '#{theme_file}'; ")
132
+ File.write("app/assets/stylesheets/application.scss", application_scss)
133
+ puts " HOTGLUE --> added to app/assets/stylesheets/application.scss: @import '#{theme_file}' "
134
+ else
135
+ puts " HOTGLUE --> already found theme in app/assets/stylesheets/application.scss: @import '#{theme_file}' "
136
+ end
116
137
  end
138
+ rescue StandardError => e
139
+ puts "WARNING: error writing to app/assets/stylesheets/application.scss --- #{e.message}"
117
140
  end
118
141
 
119
142
 
120
143
 
121
- if !File.exists?("config/hot_glue.yml")
144
+ begin
145
+
146
+ if !File.exists?("config/hot_glue.yml")
122
147
 
123
- yaml = {layout: @layout,
124
- markup: @markup,
125
- license_activation_key: license_activation_key,
126
- license_email: license_email}.to_yaml
127
- File.write("#{'spec/dummy/' if Rails.env.test?}config/hot_glue.yml", yaml)
148
+ yaml = {layout: @layout,
149
+ markup: @markup,
150
+ license_activation_key: license_activation_key,
151
+ license_email: license_email}.to_yaml
152
+ File.write("#{'spec/dummy/' if Rails.env.test?}config/hot_glue.yml", yaml)
128
153
 
154
+ end
155
+ rescue StandardError => e
156
+ puts "WARNING: error writing to config/hot_glue.yml --- #{e.message}"
129
157
  end
130
158
 
131
159
 
132
- if !File.exists?("spec/support/capybara_login.rb")
133
- copy_file "capybara_login.rb", "#{'spec/dummy/' if Rails.env.test?}spec/support/capybara_login.rb"
160
+ begin
161
+ if !File.exists?("spec/support/capybara_login.rb")
162
+ copy_file "capybara_login.rb", "#{'spec/dummy/' if Rails.env.test?}spec/support/capybara_login.rb"
163
+ end
164
+ rescue StandardError => e
165
+ puts "WARNING: error writing to spec/support/capybara_login.rb --- #{e.message}"
134
166
  end
135
167
  end
136
168
  end
@@ -21,7 +21,7 @@ module HotGlue
21
21
  magic_buttons.collect{ |button_name|
22
22
  "<%= form_with model: #{singular}, url: #{path_helper_singular}(#{path_helper_args}) do |f| %>
23
23
  <%= f.hidden_field :#{button_name}, value: \"#{button_name}\" %>
24
- <%= f.submit '#{button_name.titleize}'.html_safe, data: {confirm: 'Are you sure you want to #{button_name} this #{singular}?'}, class: '#{singular}-button btn btn-primary ' %>
24
+ <%= 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 ' %>
25
25
  <% end %>"
26
26
  }.join("\n")
27
27
  end
@@ -43,8 +43,12 @@ module HotGlue
43
43
  columns = args[0][:columns]
44
44
  column_width = args[0][:column_width]
45
45
  col_identifier = args[0][:col_identifier]
46
-
47
- columns.map(&:to_s).map{|col_name| "<div class='#{col_identifier}' style='flex-basis: #{column_width}%'>#{col_name.humanize}</div>"}.join("\n")
46
+ if @layout == "hotglue"
47
+ col_style = " style='flex-basis: #{column_width}%'"
48
+ else
49
+ col_style = ""
50
+ end
51
+ columns.map(&:to_s).map{|col_name| "<div class='#{col_identifier}'" + col_style +">#{col_name.humanize}</div>"}.join("\n")
48
52
  end
49
53
 
50
54
 
@@ -168,17 +172,20 @@ module HotGlue
168
172
  singular_class = args[0][:singular_class]
169
173
  singular = args[0][:singular]
170
174
  perc_width = args[0][:perc_width]
175
+ layout = args[0][:layout]
171
176
 
172
177
  columns_count = columns.count + 1
173
178
  perc_width = (perc_width).floor
174
179
 
175
- if @layout == "boostrap"
180
+ if layout == "bootstrap"
176
181
  col_identifer = "col"
177
-
182
+ style_with_flex_basis = ""
178
183
  else
184
+ style_with_flex_basis = " style='flex-basis: #{perc_width}%'"
179
185
  col_identifer = "scaffold-cell"
180
-
181
186
  end
187
+
188
+
182
189
  columns.map { |col|
183
190
  type = eval("#{singular_class}.columns_hash['#{col}']").type
184
191
  limit = eval("#{singular_class}.columns_hash['#{col}']").limit
@@ -203,30 +210,30 @@ module HotGlue
203
210
 
204
211
  display_column = HotGlue.derrive_reference_name(assoc.class_name)
205
212
 
206
- "<div class='#{col_identifer}' style='flex-basis: #{perc_width}%'>
213
+ "<div class='#{col_identifer}'#{style_with_flex_basis}>
207
214
  <%= #{singular}.#{assoc.name.to_s}.try(:#{display_column}) || '<span class=\"content alert-danger\">MISSING</span>'.html_safe %>
208
215
  </div>"
209
216
 
210
217
  else
211
- "<div class='#{col_identifer}' style='flex-basis: #{perc_width}%'>
218
+ "<div class='#{col_identifer}'#{style_with_flex_basis}>
212
219
  <%= #{singular}.#{col}%></div>"
213
220
  end
214
221
  when :float
215
222
  width = (limit && limit < 40) ? limit : (40)
216
- "<div class='#{col_identifer}' style='flex-basis: #{perc_width}%'>
223
+ "<div class='#{col_identifer}'#{style_with_flex_basis}>
217
224
  <%= #{singular}.#{col}%></div>"
218
225
  when :string
219
226
  width = (limit && limit < 40) ? limit : (40)
220
- "<div class='#{col_identifer}' style='flex-basis: #{perc_width}%'>
227
+ "<div class='#{col_identifer}'#{style_with_flex_basis} >
221
228
  <%= #{singular}.#{col} %>
222
229
  </div>"
223
230
  when :text
224
- "<div class='#{col_identifer}' style='flex-basis: #{perc_width}%'>
231
+ "<div class='#{col_identifer}'#{style_with_flex_basis}>
225
232
  <%= #{singular}.#{col} %>
226
233
  </div>"
227
234
  when :datetime
228
235
 
229
- "<div class='#{col_identifer}' style='flex-basis: #{perc_width}%'>
236
+ "<div class='#{col_identifer}' #{style_with_flex_basis} >
230
237
  <% unless #{singular}.#{col}.nil? %>
231
238
  <%= #{singular}.#{col}.in_time_zone(current_timezone).strftime('%m/%d/%Y @ %l:%M %p ') + timezonize(current_timezone) %>
232
239
  <% else %>
@@ -234,7 +241,7 @@ module HotGlue
234
241
  <% end %>
235
242
  </div>"
236
243
  when :date
237
- "<div class='#{col_identifer}' style='flex-basis: #{perc_width}%'>
244
+ "<div class='#{col_identifer}' #{style_with_flex_basis} >
238
245
  <% unless #{singular}.#{col}.nil? %>
239
246
  <%= #{singular}.#{col} %>
240
247
  <% else %>
@@ -242,7 +249,7 @@ module HotGlue
242
249
  <% end %>
243
250
  </div>"
244
251
  when :time
245
- "<div class='#{col_identifer}' style='flex-basis: #{perc_width}%'>
252
+ "<div class='#{col_identifer}' #{style_with_flex_basis} >
246
253
  <% unless #{singular}.#{col}.nil? %>
247
254
  <%= #{singular}.#{col}.in_time_zone(current_timezone).strftime('%l:%M %p ') + timezonize(current_timezone) %>
248
255
  <% else %>
@@ -251,7 +258,7 @@ module HotGlue
251
258
  </div>
252
259
  "
253
260
  when :boolean
254
- "<div class='#{col_identifer}' style='flex-basis: #{perc_width}%'>
261
+ "<div class='#{col_identifer}' #{style_with_flex_basis} >
255
262
  <% if #{singular}.#{col}.nil? %>
256
263
  <span class='alert-danger'>MISSING</span>
257
264
  <% elsif #{singular}.#{col} %>
@@ -261,7 +268,7 @@ module HotGlue
261
268
  <% end %>
262
269
  </div>
263
270
  " when :enum
264
- "<div class='#{col_identifer}'>
271
+ "<div class='#{col_identifer}' #{style_with_flex_basis} >
265
272
  <% if #{singular}.#{col}.nil? %>
266
273
  <span class='alert-danger'>MISSING</span>
267
274
  <% else %>
@@ -273,8 +280,4 @@ module HotGlue
273
280
  }.join("\n")
274
281
  end
275
282
  end
276
-
277
-
278
-
279
-
280
283
  end
@@ -52,6 +52,7 @@ module HotGlue
52
52
  class_option :no_delete, type: :boolean, default: false
53
53
  class_option :no_create, type: :boolean, default: false
54
54
  class_option :no_edit, type: :boolean, default: false
55
+ class_option :no_list, type: :boolean, default: false
55
56
  class_option :no_paginate, type: :boolean, default: false
56
57
  class_option :big_edit, type: :boolean, default: false
57
58
  class_option :show_only, type: :string, default: ""
@@ -164,6 +165,8 @@ module HotGlue
164
165
  @big_edit = options['big_edit']
165
166
 
166
167
  @no_edit = options['no_edit'] || false
168
+ @no_list = options['no_list'] || false
169
+
167
170
  @display_list_after_update = options['display_list_after_update'] || false
168
171
 
169
172
 
@@ -724,7 +727,8 @@ module HotGlue
724
727
  columns: @columns,
725
728
  show_only: @show_only,
726
729
  singular_class: singular_class,
727
- singular: singular
730
+ singular: singular,
731
+ layout: @layout
728
732
  )
729
733
  end
730
734
 
@@ -795,8 +799,18 @@ module HotGlue
795
799
 
796
800
  def controller_magic_button_update_actions
797
801
  @magic_buttons.collect{ |magic_button|
798
- " @#{singular}.#{magic_button}! if #{singular}_params[:#{magic_button}]"
799
- }.join("\n")
802
+ " if #{singular}_params[:#{magic_button}]
803
+ begin
804
+ res = @#{singular}.#{magic_button}!
805
+ res = \"#{magic_button.titleize}ed.\" if res === true
806
+ flash[:notice] = (flash[:notice] || \"\") << (res ? res + \" \" : \"\")
807
+ rescue ActiveRecord::RecordInvalid => e
808
+ @#{singular}.errors.add(:base, e.message)
809
+ flash[:alert] = (flash[:alert] || \"\") << 'There was ane error #{magic_button}ing your #{@singular}: '
810
+ end
811
+ end"
812
+
813
+ }.join("\n") + "\n"
800
814
  end
801
815
 
802
816
  def controller_update_params_tap_away_magic_buttons
@@ -112,9 +112,10 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
112
112
 
113
113
  <% end %><% if @build_update_action %> def update
114
114
  <%= controller_magic_button_update_actions %> if @<%= singular_name %>.update(modify_date_inputs_on_params(<%= singular %>_params<%= @auth ? ', ' + @auth : '' %>)<%= controller_update_params_tap_away_magic_buttons %>)
115
- flash[:notice] = "Saved #{@<%= singular %>.<%= display_class %>}"
115
+ flash[:notice] = (flash[:notice] || "") << "Saved #{@<%= singular %>.<%= display_class %>}"
116
116
  else
117
- flash[:alert] = "<%= singular_name.titlecase %> could not be saved."
117
+ flash[:alert] = (flash[:alert] || "") << "<%= singular_name.titlecase %> could not be saved."
118
+
118
119
  end
119
120
  <% if @display_list_after_update %> load_all_<%= plural %><% end %>
120
121
  respond_to do |format|
@@ -1,15 +1,18 @@
1
1
  <\%= turbo_frame_tag "<%= plural %>-list" <%= nested_for_turbo_id_list_constructor %> do %>
2
2
  <div class="<%= @container_name %> scaffold-list">
3
- <% unless @nested_args.any? %><h4><%= plural.gsub("_", " ").upcase %></h4><% end %>
3
+ <% unless @no_list || @nested_args.any? %><h4><%= plural.gsub("_", " ").upcase %></h4><% end %>
4
4
 
5
5
  <% unless @no_create %><%= '<%= render partial: "' + ((@namespace+"/" if @namespace) || "") + plural + '/new_button", locals: {' + nested_assignments + '}' + '%\>'.gsub('\\',"") %><% end %>
6
6
 
7
+ <% unless @no_list %>
7
8
  <div class="row scaffold-row">
8
9
  <%= list_column_headings %>
9
10
  <% if @downnest_children.any? %>
10
11
  <% each_downnest_width = @downnest_children.count == 1 ? 40 : (60/@downnest_children.count).floor %>
11
- <% @downnest_children.each do |downnest| %>
12
- <div class="col scaffold-col-heading" style="flex-basis: <%= each_downnest_width %>%;">
12
+ <% downnest_column_style = @layout == "hotglue" ? 'style="flex-basis: ' + each_downnest_width + '%;' : "" %>
13
+
14
+ <% @downnest_children.each do |downnest| %>
15
+ <div class="<%= @col_identifer %> scaffold-col-heading<%= ' col-md-3' if @layout=="bootstrap" %>" <%= downnest_column_style %>>
13
16
  <h4>
14
17
  <%= downnest.titleize %>
15
18
  </h4>
@@ -17,7 +20,11 @@
17
20
  <% end %>
18
21
  <% end %>
19
22
 
20
- <div class='col scaffold-col-heading scaffold-col-heading-buttons' style="flex-basis: 150px"></div>
23
+ <% button_column_style = @layout == "hotglue" ? 'style="flex-basis: 150px' : "" %>
24
+
25
+ <div class='<%= @col_identifer %> scaffold-col-heading scaffold-col-heading-buttons<%= ' col-md-2' if @layout=="bootstrap" %>' <%= button_column_style %>>
26
+
27
+ </div>
21
28
  </div>
22
29
 
23
30
  <\% if <%= plural %>.empty? %>
@@ -28,8 +35,9 @@
28
35
  <\% <%= plural %>.each do |<%= singular %>| %>
29
36
  <\%= render partial: '<%= line_path_partial %>', locals: {<%= singular %>: <%= singular %><%= nested_assignments_with_leading_comma if @nestable %><%= ", nested_for: nested_for" if @nestable %> } %>
30
37
  <\% end %>
31
-
32
38
  <%= @no_paginate ? "" : paginate %>
39
+
33
40
  </div>
41
+ <% end %>
34
42
  </div>
35
43
  <\% end %>
@@ -1,3 +1,5 @@
1
1
  <\%= turbo_frame_tag "<%= singular %>-new" do %>
2
- <\%= link_to "New <%= singular.titlecase %>", <%= new_path_name %>, disable_with: "Loading...", class: "new-<%= singular %>-button btn btn-primary pull-right" %>
2
+ <div>
3
+ <\%= link_to "New <%= singular.titlecase %>", <%= new_path_name %>, disable_with: "Loading...", class: "new-<%= singular %>-button btn btn-primary pull-right <%= 'btn-sm' if @nested_args.any? %> " %>
4
+ </div>
3
5
  <\% end %>
@@ -2,8 +2,11 @@
2
2
 
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
- <div class="<%= @col_identifier %> scaffold-downnest" style="flex-basis: <%= each_downnest_width %>%" >
7
+
8
+ <% downnest_style = @layout == "hotglue" ? 'style="flex-basis: ' + each_downnest_width + '%"' : "" %>
9
+ <div class="<%= @col_identifier %><%= ' col-md-3' if @layout == "bootstrap" %> scaffold-downnest" <%= downnest_style %> >
7
10
  <\%= render partial: "<%= namespace_with_trailing_dash %><%= downnest %>/list", locals: {
8
11
  nested_for: "<% if @nested_args.any? %>#{nested_for + "__" if nested_for}<% end %><%= @singular %>-#{<%= @singular %>.id}",
9
12
  <%= @singular %>: <%= @singular %><%= nest_assignments_operator(false, true) %>,
@@ -12,10 +15,11 @@
12
15
  <% end %>
13
16
  <% end %>
14
17
 
15
- <div class="<%= @col_identifier %> scaffold-line-buttons" style="flex-basis: 150px;">
18
+ <% button_style = @layout == "hotglue" ? 'style="flex-basis: ' + (100 - (column_width * @columns.count)).floor.to_s + '%;"' : "" %>
19
+ <div class="<%= @col_identifier %> scaffold-line-buttons <%= ' col-md-2' if @layout == "bootstrap" %>" <%= button_style %>>
16
20
  <% if destroy_action %>
17
21
  <\%= form_with url: <%= path_helper_singular %>(<%= path_helper_args %>), html: {style: "display: inline-block;"}, method: :delete do |f| %>
18
- <\%= f.submit "Delete".html_safe, data: <%= delete_confirmation_syntax %>, class: "delete-<%= singular %>-button btn btn-primary btn-sm" %>
22
+ <\%= f.submit "Delete".html_safe, data: <%= delete_confirmation_syntax %>, class: "delete-<%= singular %>-button btn btn-primary btn-sm" %>
19
23
  <\% end %>
20
24
  <% end %>
21
25
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  <div class="clearfix"></div>
8
8
  <\%= render partial: '<%= list_path_partial %>',
9
- locals: {<%= plural %>: @<%= plural %><%= nested_for_assignments_constructor %><%= nest_assignments_operator(true, true) if @nestable %> } \%>
9
+ locals: {<%= plural %>: @<%= plural %><%= nested_for_assignments_constructor %><%= nest_assignments_operator(true, true) if @nestable %> } \%>
10
10
 
11
11
  <% if @layout == "bootstrap" %></div></div><% else %></div><% end %>
12
12
  </div>
@@ -1,3 +1,3 @@
1
1
  module HotGlue
2
- VERSION = '0.3.5'
2
+ VERSION = '0.4.0'
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.3.5
4
+ version: 0.4.0
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-03 00:00:00.000000000 Z
11
+ date: 2021-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -174,7 +174,7 @@ post_install_message: |
174
174
  ---------------------------------------------
175
175
  Welcome to Hot Glue - A Scaffold Building Companion for Hotwire + Turbo-Rails
176
176
 
177
- To purchase a license, please visit https://heliosdev.shop/hot-glue-licens
177
+ To purchase a license, please visit https://heliosdev.shop/hot-glue-license
178
178
  ---------------------------------------------
179
179
  rdoc_options: []
180
180
  require_paths: