hot-glue 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/{LICENCE → LICENSE} +10 -6
- data/README.md +16 -16
- data/lib/generators/hot_glue/layout/builder.rb +9 -7
- data/lib/generators/hot_glue/markup_templates/erb.rb +3 -2
- data/lib/generators/hot_glue/scaffold_generator.rb +24 -11
- data/lib/generators/hot_glue/templates/erb/_list.erb +1 -1
- data/lib/generators/hot_glue/templates/erb/_show.erb +3 -3
- data/lib/hotglue/version.rb +1 -1
- metadata +3 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fbadc4071a06e16784758f6e235240633748cb4261c91fe54960311db08a24c
|
4
|
+
data.tar.gz: c9e8d53f5b94cf5890e4dc79648ee30e030b12c19ee9e1c70537aa2cc6a3a7a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07a355f3810b4cccbbab4c868e08e028c92ca39f363e0b7051582b7dece1c40acb5a59f0ecb284cf8c7688a5bdc122f20660a5435a21988e41820412d948c360
|
7
|
+
data.tar.gz: 431b04bf111bb990c5853a4b5bf9f5aaee316ec91aac833a0232ba15c2da33be41b1800aeb164d174da9431ad663ce96b63ee8f80c238e69f565fbb80152cb7e
|
data/Gemfile.lock
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hot-glue (0.4.
|
4
|
+
hot-glue (0.4.5)
|
5
5
|
ffaker (~> 2.16)
|
6
6
|
kaminari (~> 1.2)
|
7
|
-
rails (> 5.1
|
7
|
+
rails (> 5.1)
|
8
8
|
sass-rails
|
9
9
|
|
10
10
|
GEM
|
@@ -91,7 +91,7 @@ GEM
|
|
91
91
|
factory_bot (6.2.0)
|
92
92
|
activesupport (>= 5.0.0)
|
93
93
|
ffaker (2.20.0)
|
94
|
-
ffi (1.15.
|
94
|
+
ffi (1.15.5)
|
95
95
|
globalid (0.4.2)
|
96
96
|
activesupport (>= 4.2.0)
|
97
97
|
i18n (1.8.10)
|
data/{LICENCE → LICENSE}
RENAMED
@@ -1,3 +1,7 @@
|
|
1
|
+
© 2022 Jason Fleetwood-Boldt. All Rights Reserved
|
2
|
+
This software is 'fauxpen source,' which means you can think of it like 'free' as in speech but not 'free' as in beer....
|
3
|
+
|
4
|
+
It is definitely 'free' as in Britney.
|
1
5
|
|
2
6
|
FOR HOBBYISTS/STUDENTS/TEACHERS/INDIVIDUALS/NON-PROFITS:
|
3
7
|
|
@@ -7,14 +11,14 @@ Any users of this software agree to work to
|
|
7
11
|
1) dismantle systemic racism
|
8
12
|
2) seek justice for black, brown, transgender people, women, and
|
9
13
|
3) work towards LGBTQIAA+ representation and inclusion
|
10
|
-
|
11
|
-
FOR ALL OTHERS:
|
12
|
-
|
13
|
-
TO PURCHASE A LICENSE PLEASE VISIT
|
14
|
-
https://heliosdev.shop/hot-glue-license
|
15
|
-
|
16
14
|
Organizations using this software agree to center the narratives of black, brown, transgender, and non-advantaged people in the world.
|
17
15
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
18
16
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
19
17
|
|
18
|
+
Just sign the pledge at https://heliosdev.shop/hot-glue-license and your email will be granted lifetime usage access.
|
19
|
+
|
20
|
+
TO PURCHASE A COMMERCIAL USAGE LICENSE PLEASE VISIT
|
21
|
+
https://heliosdev.shop/hot-glue-license
|
20
22
|
|
23
|
+
OR JUST BUY THE TUTORIAL (all purchases come with lifetime license)
|
24
|
+
https://jfb.teachable.com/p/hot-glue-in-depth-tutorial
|
data/README.md
CHANGED
@@ -576,30 +576,30 @@ IMPORTANT: By default, all fields that begin with an underscore (`_`) are automa
|
|
576
576
|
|
577
577
|
I would recommend this for fields you want globally non-editable by users in your app. For example, a counter cache or other field set only by a backend mechanism.
|
578
578
|
|
579
|
-
### `--
|
580
|
-
(for Rails <=6, default is false. For Rails 7, default is true.)
|
579
|
+
### `--ujs_syntax=true` (Default is set automatically based on whether you have turbo-rails installed)
|
581
580
|
|
582
|
-
|
581
|
+
If you are pre-Turbo (UJS), your delete buttons will come out like this:
|
582
|
+
`data: {'confirm': 'Are you sure you want to delete....?'}`
|
583
583
|
|
584
|
-
If you
|
584
|
+
If you are Turbo (Rails 7 or Rails 6 with proactive Turbo-Rails install), your delete button will be:
|
585
|
+
`data: {'turbo-confirm': 'Are you sure you want to delete....?'}`
|
585
586
|
|
586
|
-
|
587
|
-
{confirm: 'Are you sure?'}
|
588
|
-
```
|
587
|
+
If you specify the flag, you preference will be used. If you leave the flag off, Hot Glue will detect the presence of Turbo-Rails in your app.
|
589
588
|
|
590
|
-
If you
|
591
|
-
|
592
|
-
## TODO: fix this
|
593
|
-
```
|
589
|
+
**WARNING**: If you created a new Rails app since October 2021 and you have the yanked turbo-rails Gems on your local machine,
|
590
|
+
you will have some bugs with the delete buttons and also not be on the latest version of turbo-rails.
|
594
591
|
|
592
|
+
Make sure to uninstall the yanked 7.1.0 and 7.1.1 from your machine with `gem uninstall turbo-rails`
|
593
|
+
and also fix any Rails apps created since October 2021 by fixing the Gemfile. Details here:
|
594
|
+
https://stackoverflow.com/questions/70671324/new-rails-7-turbo-app-doesnt-show-the-data-turbo-confirm-alert-messages-dont-f
|
595
595
|
|
596
596
|
|
597
|
-
### `--magic-buttons`
|
597
|
+
### `--magic-buttons`
|
598
598
|
If you pass a list of magic buttons (separated by commas), they will appear in the button area on your list.
|
599
599
|
|
600
|
-
It will be assumed there will be
|
600
|
+
It will be assumed there will be corresponding bang methods on your models.
|
601
601
|
|
602
|
-
The
|
602
|
+
The bang (`!`) methods can respond in one of four ways:
|
603
603
|
|
604
604
|
• With true, in which case a generic success message will be shown in the flash notice (“Approved” or “Rejected” in this case)
|
605
605
|
|
@@ -711,8 +711,9 @@ Obviously, the created controller will always have this base controller as its s
|
|
711
711
|
|
712
712
|
# VERSION HISTORY
|
713
713
|
|
714
|
+
#### 2022-01-01 - v0.4.3 and 0.4.4 - adding fully email based license; no activation codes required
|
714
715
|
|
715
|
-
#### 2022-12-30 - v0.4.2
|
716
|
+
#### 2022-12-30 - v0.4.2 -- Smart layouts introduced
|
716
717
|
|
717
718
|
#### 2021-12-15 - v0.4.1
|
718
719
|
|
@@ -720,7 +721,6 @@ Obviously, the created controller will always have this base controller as its s
|
|
720
721
|
|
721
722
|
#### 2021-12-12 - v0.3.9 - Magic Buttons
|
722
723
|
|
723
|
-
|
724
724
|
#### 2021-12-11 - v0.3.5 - Downnesting
|
725
725
|
|
726
726
|
|
@@ -3,13 +3,15 @@
|
|
3
3
|
module HotGlue
|
4
4
|
module Layout
|
5
5
|
class Builder
|
6
|
-
attr_reader :include_setting, :downnest_children, :
|
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
|
-
|
12
|
-
@
|
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
|
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
|
-
|
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,6 +72,7 @@ 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
|
@@ -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? ),
|
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
|
@@ -59,10 +59,12 @@ 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 :
|
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
|
@@ -218,6 +220,9 @@ module HotGlue
|
|
218
220
|
@magic_buttons = options['magic_buttons'].split(',')
|
219
221
|
end
|
220
222
|
|
223
|
+
|
224
|
+
@small_buttons = options['small_buttons'] || false
|
225
|
+
|
221
226
|
@build_update_action = !@no_edit || !@magic_buttons.empty?
|
222
227
|
# if the magic buttons are present, build the update action anyway
|
223
228
|
|
@@ -236,16 +241,23 @@ module HotGlue
|
|
236
241
|
end
|
237
242
|
end
|
238
243
|
|
244
|
+
|
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
|
239
250
|
@reference_name = HotGlue.derrive_reference_name(singular_class)
|
240
251
|
|
241
252
|
identify_object_owner
|
242
253
|
setup_fields
|
243
254
|
|
255
|
+
buttons_width = ((!@no_edit && 1) || 0) + ((!@no_delete && 1) || 0) + @magic_buttons.count
|
256
|
+
|
244
257
|
builder = HotGlue::Layout::Builder.new({
|
245
258
|
include_setting: options['include'],
|
246
259
|
downnest_children: @downnest_children,
|
247
|
-
|
248
|
-
no_delete: @no_delete,
|
260
|
+
buttons_width: buttons_width,
|
249
261
|
columns: @columns,
|
250
262
|
smart_layout: @smart_layout
|
251
263
|
})
|
@@ -617,7 +629,8 @@ module HotGlue
|
|
617
629
|
path_helper_singular: path_helper_singular,
|
618
630
|
path_helper_args: path_helper_args,
|
619
631
|
singular: singular,
|
620
|
-
magic_buttons: @magic_buttons
|
632
|
+
magic_buttons: @magic_buttons,
|
633
|
+
small_buttons: @small_buttons
|
621
634
|
)
|
622
635
|
end
|
623
636
|
|
@@ -825,13 +838,13 @@ module HotGlue
|
|
825
838
|
@template_builder.paginate(plural: plural)
|
826
839
|
end
|
827
840
|
|
828
|
-
def delete_confirmation_syntax
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
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
|
835
848
|
|
836
849
|
|
837
850
|
def controller_magic_button_update_actions
|
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
<% button_column_style = @layout == "hotglue" ? 'style="flex-basis: 150px' : "" %>
|
24
24
|
|
25
|
-
<div class=' scaffold-col-heading scaffold-col-heading-buttons<%=
|
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>
|
@@ -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 <%=
|
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,
|
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
|
|
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.4.
|
4
|
+
version: 0.4.5
|
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: 2022-01-
|
11
|
+
date: 2022-01-11 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
|
-
-
|
81
|
+
- LICENSE
|
88
82
|
- README.md
|
89
83
|
- Rakefile
|
90
84
|
- app/assets/config/manifest.js
|