hot-glue 0.5.25 → 0.5.26

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: 9c2b46bf01f0742356ab56ad4cd139534becbe919b8e38ac8d166f8ca1c1c47c
4
- data.tar.gz: b697f19f9928249d693632ff040f7ebb97ddf396fd8fb8d74b60f3abfe3a6bca
3
+ metadata.gz: 226e0b7e11441c4332105233fc63eb44f879d582c4ce791e18e56bd54de56627
4
+ data.tar.gz: a1befc9f7e6d059b502730f4d7411d7aab538b8a239572163e112d85a364d39a
5
5
  SHA512:
6
- metadata.gz: 9ad16ec01f21d5ac9013cbbc0ee2e364cce4deec8ff52544d34438c641a4009d763ff953e70813d2f4b5e5b35904959ca49b5fea50dc8187c254c0bc0a19850c
7
- data.tar.gz: f7cbb297d36077486c6983b0dfebee09b32871b316f28fe215f3578df5054445f337d372e13b55d84f44f30a6e4e0de776df14cb3137a4ec12c8e481ed38abba
6
+ metadata.gz: fb0ce5e6cf19d8528f3a7cdf421f4cdaf81a10c8670b132a6994ee178361e353b9ffba58de34bf14c8f422bae485bd4994c5c55a06240b2f0ab358419fd2660f
7
+ data.tar.gz: b9bc2326b8d1b8430e278a3fc9b74a6a198238fdfc015e21b37024761283f1dbb770b15e4a90bbf8bfebcb6acf5e110a704409e3a22093067fdd0d6ddd4ad4ff
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hot-glue (0.5.25)
4
+ hot-glue (0.5.26)
5
5
  ffaker (~> 2.16)
6
6
  kaminari (~> 1.2)
7
7
  rails (> 5.1)
@@ -139,7 +139,7 @@ GEM
139
139
  mini_mime (1.1.2)
140
140
  mini_portile2 (2.8.4)
141
141
  minitest (5.16.3)
142
- net-imap (0.4.1)
142
+ net-imap (0.4.2)
143
143
  date
144
144
  net-protocol
145
145
  net-pop (0.1.2)
data/README.md CHANGED
@@ -1469,6 +1469,17 @@ bin/rails generate Thing --include=my_story --modify='my_story{tinymce}'
1469
1469
 
1470
1470
  # VERSION HISTORY
1471
1471
 
1472
+
1473
+ #### 2023-10-23 - v0.5.26
1474
+
1475
+ Various fixes:
1476
+ - fixed alert (danger) classes for bootstrap 5 ('alert alert-danger' was just 'alert-danger')
1477
+ - switches to use a self-defined instance var @action instead of action_name; this is so I can
1478
+ switch it back to 'new' or 'edit' upon a failure re-display to have the view behave the expected way
1479
+ - fix in create.turbo_stream.erb for failure redisplay (was not working)
1480
+ - fixes syntax error (in generated code) in edit.erb when there was a nested set
1481
+
1482
+
1472
1483
  #### 2023-10-16 - v0.5.25
1473
1484
 
1474
1485
  - Fixes scoping on Pundit-built controllers; even when using pundit we should still wrap to the current build's own ownership scope (#132
@@ -111,7 +111,7 @@ class AssociationField < Field
111
111
  end
112
112
 
113
113
  def field_error_name
114
- name
114
+ assoc_name
115
115
  end
116
116
 
117
117
  def form_show_only_output
@@ -140,6 +140,6 @@ class AssociationField < Field
140
140
 
141
141
  display_column = HotGlue.derrive_reference_name(assoc_class.to_s)
142
142
 
143
- "<%= #{singular}.#{assoc}.try(:#{display_column}) || '<span class=\"content alert-danger\">MISSING</span>'.html_safe %>"
143
+ "<%= #{singular}.#{assoc}.try(:#{display_column}) || '<span class=\"content \">MISSING</span>'.html_safe %>"
144
144
  end
145
145
  end
@@ -38,7 +38,7 @@ class BooleanField < Field
38
38
 
39
39
  def form_field_display
40
40
  if display_boolean_as.nil?
41
- byebug
41
+
42
42
  end
43
43
  "<div class='#{@layout_strategy.form_checkbox_wrapper_class} #{'form-switch' if display_boolean_as == 'switch'}'>\n" +
44
44
  (if display_boolean_as == 'radio'
@@ -58,7 +58,7 @@ class BooleanField < Field
58
58
  def line_field_output
59
59
  if modify_binary?
60
60
  "<% if #{singular}.#{name}.nil? %>
61
- <span class='alert-danger'>MISSING</span>
61
+ <span class=''>MISSING</span>
62
62
  <% elsif #{singular}.#{name} %>
63
63
  #{modify_as[:binary][:truthy]}
64
64
  <% else %>
@@ -66,7 +66,7 @@ class BooleanField < Field
66
66
  <% end %>"
67
67
  else
68
68
  "<% if #{singular}.#{name}.nil? %>
69
- <span class='alert-danger'>MISSING</span>
69
+ <span class=''>MISSING</span>
70
70
  <% elsif #{singular}.#{name} %>
71
71
  YES
72
72
  <% else %>
@@ -17,7 +17,7 @@ class DateField < Field
17
17
  "<% unless #{singular}.#{name}.nil? %>
18
18
  <%= #{singular}.#{name} %>
19
19
  <% else %>
20
- <span class='alert-danger'>MISSING</span>
20
+ <span class=''>MISSING</span>
21
21
  <% end %>"
22
22
  end
23
23
  end
@@ -13,7 +13,7 @@ class DateTimeField < Field
13
13
  if !modify_binary?
14
14
  "expect(page).to have_content(new_#{name}.in_time_zone(testing_timezone).strftime('%m/%d/%Y @ %l:%M %p %Z').gsub(' ', ' '))"
15
15
  else
16
- "expect(page).to have_content('#{modify[:binary][:truthy]}'"
16
+ "expect(page).to have_content('#{modify_as[:binary][:truthy]}'"
17
17
  end
18
18
  end
19
19
 
@@ -23,7 +23,7 @@ class DateTimeField < Field
23
23
 
24
24
  def spec_list_view_assertion
25
25
  if modify_binary?
26
- "expect(page).to have_content('#{modify[:binary][:truthy]}')"
26
+ "expect(page).to have_content('#{modify_as[:binary][:truthy]}')"
27
27
  else
28
28
  spec_list_view_natural_assertion
29
29
  end
@@ -44,7 +44,7 @@ class DateTimeField < Field
44
44
  "<% unless #{singular}.#{name}.nil? %>
45
45
  <%= #{singular}.#{name}.in_time_zone(current_timezone).strftime('%m/%d/%Y @ %l:%M %p %Z') %>
46
46
  <% else %>
47
- <span class='alert-danger'>MISSING</span>
47
+ <span class=''>MISSING</span>
48
48
  <% end %>"
49
49
  end
50
50
  end
@@ -12,7 +12,7 @@ class TimeField < Field
12
12
  "<% unless #{singular}.#{name}.nil? %>
13
13
  <%= #{singular}.#{name}.in_time_zone(current_timezone).strftime('%l:%M %p ') %>
14
14
  <% else %>
15
- <span class='alert-danger'>MISSING</span>
15
+ <span class=''>MISSING</span>
16
16
  <% end %>"
17
17
  end
18
18
 
@@ -95,9 +95,9 @@ module HotGlue
95
95
  if show_only.include?(col)
96
96
  columns_map[col].form_show_only_output
97
97
  elsif update_show_only.include?(col) && !@pundit
98
- "<% if action_name == 'edit' %>" + columns_map[col].form_show_only_output + "<% else %>" + columns_map[col].form_field_output + "<% end %>"
98
+ "<% if @action == 'edit' %>" + columns_map[col].form_show_only_output + "<% else %>" + columns_map[col].form_field_output + "<% end %>"
99
99
  elsif update_show_only.include?(col) && @pundit && eval("defined? #{singular_class}Policy") && eval("#{singular_class}Policy").instance_methods.include?("#{col}_able?".to_sym)
100
- "<% if action_name == 'new' && policy(@#{singular}).#{col}_able? %>" + columns_map[col].form_field_output + "<% else %>" + columns_map[col].form_show_only_output + "<% end %>"
100
+ "<% if @action == 'new' && policy(@#{singular}).#{col}_able? %>" + columns_map[col].form_field_output + "<% else %>" + columns_map[col].form_show_only_output + "<% end %>"
101
101
 
102
102
  # show only on the update action overrides any pundit policy
103
103
  elsif @pundit && eval("defined? #{singular_class}Policy") && eval("#{singular_class}Policy").instance_methods.include?("#{col}_able?".to_sym)
@@ -108,7 +108,7 @@ module HotGlue
108
108
  # byebug
109
109
  @tinymce_stimulus_controller = (columns_map[col].modify_as == {tinymce: 1} ? "data-controller='tiny-mce' " : "")
110
110
 
111
- add_spaces_each_line( "\n <span #{@tinymce_stimulus_controller}class='<%= \"alert-danger\" if #{singular}.errors.details.keys.include?(:#{field_error_name}) %>' #{'style="display: inherit;"'} >\n" +
111
+ add_spaces_each_line( "\n <span #{@tinymce_stimulus_controller}class='<%= \"alert alert-danger\" if #{singular}.errors.details.keys.include?(:#{field_error_name}) %>' #{'style="display: inherit;"'} >\n" +
112
112
  add_spaces_each_line( (form_labels_position == 'before' ? the_label || "" : "") +
113
113
  + " <br />\n" + field_result +
114
114
  (form_labels_position == 'after' ? the_label : "") , 4) +
@@ -91,6 +91,7 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
91
91
  @<%= singular_name %> = <% if @pundit %>policy_scope(<% end %><%= class_name %><% if @pundit %>)<% end %>.new({}.merge(<%= @nested_set.last[:singular] %> ? {<%= @object_owner_sym %>: <%= @object_owner_eval %>} : {}))<% else %>
92
92
  @<%= singular_name %> = <% if @pundit %>policy_scope(<% end %><%= class_name %><% if @pundit %>)<% end %>.new(<% if any_nested? %><%= @object_owner_sym %>: <%= @object_owner_eval %><% end %>)<% end %>
93
93
  <% if @pundit %>authorize @<%= singular_name %><% end %><% if @pundit %>
94
+ @action = "new"
94
95
  rescue Pundit::NotAuthorizedError
95
96
  flash[:alert] = "You are not authorized to perform this action."
96
97
  render :index<% end %>
@@ -119,6 +120,7 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
119
120
  render :create
120
121
  else
121
122
  flash[:alert] = "Oops, your <%= singular_name %> could not be created. #{@hawk_alarm}"
123
+ @action = "new"
122
124
  render :create, status: :unprocessable_entity
123
125
  end<% if @pundit %>
124
126
  rescue Pundit::NotAuthorizedError
@@ -139,6 +141,7 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
139
141
 
140
142
  def edit<% if @pundit %>
141
143
  authorize @<%= singular_name %><% end %>
144
+ @action = "edit"
142
145
  render :edit<% if @pundit %>
143
146
  rescue Pundit::NotAuthorizedError
144
147
  flash[:alert] = "Editing #{@<%= singular %>.<%= display_class %>} not authorized."
@@ -186,6 +189,7 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
186
189
  render :update
187
190
  else
188
191
  flash[:alert] = "<%= singular_name.titlecase %> could not be saved. #{@hawk_alarm}"
192
+ @action = "edit"
189
193
  render :update, status: :unprocessable_entity
190
194
  end<% if @pundit %>
191
195
  rescue Pundit::NotAuthorizedError
@@ -4,7 +4,7 @@
4
4
  <\% end %>
5
5
  <\% end %>
6
6
  <%= turbo_parental_updates %>
7
- <\%= turbo_stream.replace "<%= @namespace %>__<%= singular %>__<%= singular %>-new" do %>
7
+ <\%= turbo_stream.replace "<%= @namespace %>__<%= singular %>-new" do %>
8
8
  <\% if @<%= singular %>.errors.none? %>
9
9
  <\%= render partial: "new_button", locals: {}<%= @nested_set.collect{|arg| ".merge(@" + arg[:singular] + " ? {" + arg[:singular] + ": @" + arg[:singular] + "} : {})"}.join() %> %>
10
10
  <\% else %>
@@ -4,7 +4,7 @@
4
4
  <div class="col-md-12">
5
5
  <\%= link_to "<% if @button_icons == 'font-awesome' %><i class='fa fa-arrow-circle-left 2x'></i><% end %> Back to list".html_safe, <%= path_helper_plural %> %>
6
6
  <% end %>
7
- <\%= render partial: "edit", locals: {<%= singular %>: @<%= singular %>} %>
7
+ <\%= render partial: "edit", locals: {<%= singular %>: @<%= singular %><%= @nested_set.collect{|arg| ", #{arg[:singular]}: @#{arg[:singular]}" }.join(", ") %>} %>
8
8
  <% if @big_edit %>
9
9
  </div>
10
10
  </div>
@@ -1,3 +1,3 @@
1
1
  <\%= turbo_stream.replace "<%= @namespace %>__#{dom_id(<%= singular %>)}" do %>
2
- <\%= render 'edit' %>
2
+ <\%= render 'edit', locals: {<%= singular %>: @<%= singular %><%= @nested_set.collect{|arg| ", #{arg[:singular]}: @#{arg[:singular]}} " }.join("") %> %>
3
3
  <\% end %>
@@ -1,5 +1,5 @@
1
1
  module HotGlue
2
2
  class Version
3
- CURRENT = '0.5.25'
3
+ CURRENT = '0.5.26'
4
4
  end
5
5
  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.5.25
4
+ version: 0.5.26
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: 2023-10-16 00:00:00.000000000 Z
11
+ date: 2023-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails