hot-glue 0.3.8 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/hot_glue/markup_templates/erb.rb +7 -3
- data/lib/generators/hot_glue/scaffold_generator.rb +10 -2
- data/lib/generators/hot_glue/templates/controller.rb.erb +3 -2
- data/lib/generators/hot_glue/templates/erb/_list.erb +10 -3
- data/lib/generators/hot_glue/templates/erb/_new_button.erb +3 -1
- data/lib/generators/hot_glue/templates/erb/_show.erb +6 -5
- data/lib/generators/hot_glue/templates/erb/index.erb +1 -1
- data/lib/hotglue/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b43859a9d9550d50e2afb38b0a340bdbafd2c0cfc48864fca79134fa0ce96a73
|
4
|
+
data.tar.gz: 566e3be087670f1bd4eb7a869a67934d576ed854f0c975437cd8fa04043f634d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d7fb818064534ad24e0b069c8355b7cb677a87ebc45e5f2c1da4cf148eb824200c82bf29ec1effb9dada56144279f858cc92fb85d36e6727e927fef84e9fc7e
|
7
|
+
data.tar.gz: 60bf9b8a843018bbba2d9457b99f212445dc51ca288e97f04940e17e9c25af72c586aa4c4fbbecf3bac900b0df1e844b80e62f3d276bbd7aa733fe60fb74f607
|
@@ -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: (schedule.respond_to?(:#{button_name}able?) && ! schedule.#{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
|
-
|
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
|
|
@@ -796,8 +796,16 @@ module HotGlue
|
|
796
796
|
|
797
797
|
def controller_magic_button_update_actions
|
798
798
|
@magic_buttons.collect{ |magic_button|
|
799
|
-
"
|
800
|
-
|
799
|
+
" begin
|
800
|
+
if #{singular}_params[:#{magic_button}]
|
801
|
+
res = @#{singular}.#{magic_button}!
|
802
|
+
res = \"#{magic_button.titleize}ed.\" if res === true
|
803
|
+
flash[:notice] = (flash[:notice] || \"\") << (res ? res + \" \" : \"\")
|
804
|
+
end
|
805
|
+
rescue ActiveRecord::RecordInvalid => e
|
806
|
+
@#{singular}.errors.add(:base, e.message)
|
807
|
+
flash[:alert] = (flash[:alert] || \"\") << 'There was ane error #{magic_button}ing your #{@singular}: '
|
808
|
+
end" }.join("\n") + "\n"
|
801
809
|
end
|
802
810
|
|
803
811
|
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|
|
@@ -4,12 +4,15 @@
|
|
4
4
|
|
5
5
|
<% unless @no_create %><%= '<%= render partial: "' + ((@namespace+"/" if @namespace) || "") + plural + '/new_button", locals: {' + nested_assignments + '}' + '%\>'.gsub('\\',"") %><% end %>
|
6
6
|
|
7
|
+
|
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
|
-
|
12
|
-
|
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
|
-
|
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? %>
|
@@ -1,3 +1,5 @@
|
|
1
1
|
<\%= turbo_frame_tag "<%= singular %>-new" do %>
|
2
|
-
|
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 %>
|
@@ -4,8 +4,9 @@
|
|
4
4
|
<% each_downnest_width = @downnest_children.count == 1 ? 33 : (53/@downnest_children.count).floor %>
|
5
5
|
|
6
6
|
<% @downnest_children.each do |downnest| %>
|
7
|
-
|
8
|
-
|
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 %> >
|
9
10
|
<\%= render partial: "<%= namespace_with_trailing_dash %><%= downnest %>/list", locals: {
|
10
11
|
nested_for: "<% if @nested_args.any? %>#{nested_for + "__" if nested_for}<% end %><%= @singular %>-#{<%= @singular %>.id}",
|
11
12
|
<%= @singular %>: <%= @singular %><%= nest_assignments_operator(false, true) %>,
|
@@ -14,11 +15,11 @@
|
|
14
15
|
<% end %>
|
15
16
|
<% end %>
|
16
17
|
|
17
|
-
<% button_style = @layout == "hotglue" ? 'style="flex-basis: ' + (100 - (column_width * @columns.count)).floor + '%;' : "" %>
|
18
|
-
<div class="<%= @col_identifier %> scaffold-line-buttons" <%= button_style %>>
|
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 %>>
|
19
20
|
<% if destroy_action %>
|
20
21
|
<\%= form_with url: <%= path_helper_singular %>(<%= path_helper_args %>), html: {style: "display: inline-block;"}, method: :delete do |f| %>
|
21
|
-
<\%= f.submit "Delete".html_safe,
|
22
|
+
<\%= f.submit "Delete".html_safe, data: <%= delete_confirmation_syntax %>, class: "delete-<%= singular %>-button btn btn-primary btn-sm" %>
|
22
23
|
<\% end %>
|
23
24
|
<% end %>
|
24
25
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
<div class="clearfix"></div>
|
8
8
|
<\%= render partial: '<%= list_path_partial %>',
|
9
|
-
|
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>
|
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.3.
|
4
|
+
version: 0.3.9
|
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-
|
11
|
+
date: 2021-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|