hot-glue 0.5.11 → 0.5.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +17 -2
- data/README.md +78 -7
- data/lib/generators/hot_glue/default_config_loader.rb +12 -0
- data/lib/generators/hot_glue/field_factory.rb +2 -0
- data/lib/generators/hot_glue/fields/association_field.rb +1 -1
- data/lib/generators/hot_glue/fields/attachment_field.rb +27 -0
- data/lib/generators/hot_glue/fields/date_time_field.rb +3 -2
- data/lib/generators/hot_glue/fields/enum_field.rb +2 -2
- data/lib/generators/hot_glue/fields/field.rb +2 -2
- data/lib/generators/hot_glue/fields/integer_field.rb +1 -1
- data/lib/generators/hot_glue/fields/uuid_field.rb +1 -2
- data/lib/generators/hot_glue/flash_notices_install_generator.rb +20 -0
- data/lib/generators/hot_glue/hot_glue.rb +5 -0
- data/lib/generators/hot_glue/install_generator.rb +2 -7
- data/lib/generators/hot_glue/layout/builder.rb +38 -55
- data/lib/generators/hot_glue/markup_templates/erb.rb +9 -15
- data/lib/generators/hot_glue/scaffold_generator.rb +971 -1008
- data/lib/generators/hot_glue/templates/controller.rb.erb +5 -4
- data/lib/generators/hot_glue/templates/erb/_edit.erb +12 -0
- data/lib/generators/hot_glue/templates/erb/_flash_notices.erb +12 -8
- data/lib/generators/hot_glue/templates/erb/_list.erb +1 -2
- data/lib/generators/hot_glue/templates/erb/_show.erb +2 -2
- data/lib/generators/hot_glue/templates/erb/create.turbo_stream.erb +3 -4
- data/lib/generators/hot_glue/templates/erb/destroy.turbo_stream.erb +7 -1
- data/lib/generators/hot_glue/templates/erb/edit.erb +34 -16
- data/lib/generators/hot_glue/templates/erb/update.turbo_stream.erb +3 -6
- data/lib/generators/hot_glue/templates/system_spec.rb.erb +1 -1
- data/lib/hot-glue.rb +81 -0
- data/lib/hotglue/version.rb +1 -1
- data/script/test +2 -4
- metadata +6 -18
- data/lib/generators/hot_glue/templates/erb/_errors.erb +0 -11
- data/lib/generators/hot_glue/templates/haml/_errors.haml +0 -6
- data/lib/generators/hot_glue/templates/haml/_flash_notices.haml +0 -8
- data/lib/generators/hot_glue/templates/haml/_form.haml +0 -5
- data/lib/generators/hot_glue/templates/haml/_line.haml +0 -6
- data/lib/generators/hot_glue/templates/haml/_list.haml +0 -15
- data/lib/generators/hot_glue/templates/haml/_new_button.haml +0 -2
- data/lib/generators/hot_glue/templates/haml/_new_form.haml +0 -7
- data/lib/generators/hot_glue/templates/haml/_show.haml +0 -7
- data/lib/generators/hot_glue/templates/haml/create.turbo_stream.haml +0 -14
- data/lib/generators/hot_glue/templates/haml/destroy.turbo_stream.haml +0 -2
- data/lib/generators/hot_glue/templates/haml/edit.haml +0 -19
- data/lib/generators/hot_glue/templates/haml/edit.turbo_stream.haml +0 -4
- data/lib/generators/hot_glue/templates/haml/index.haml +0 -8
- data/lib/generators/hot_glue/templates/haml/new.haml +0 -1
- data/lib/generators/hot_glue/templates/haml/update.turbo_stream.haml +0 -9
@@ -57,8 +57,7 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
|
|
57
57
|
def load_<%= singular_name %>
|
58
58
|
<% if @nested_set[0] && @nested_set[0][:optional] %>if params.include?(:<%= @nested_set.last[:singular] %>_id)
|
59
59
|
@<%= singular_name %> = <%= object_scope.gsub("@",'') %>.find(params[:id])
|
60
|
-
else
|
61
|
-
<% end %>@<%= singular_name %> = <%= object_scope %>.find(params[:id])<% if @nested_set[0] && @nested_set[0][:optional] %>
|
60
|
+
else <% end %>@<%= singular_name %> = <%= object_scope %>.find(params[:id])<% if @nested_set[0] && @nested_set[0][:optional] %>
|
62
61
|
end<% end %>
|
63
62
|
end
|
64
63
|
<% else %>
|
@@ -93,6 +92,7 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
|
|
93
92
|
|
94
93
|
if @<%= singular_name %>.save
|
95
94
|
flash[:notice] = "Successfully created #{@<%= singular %>.<%= display_class %>}"
|
95
|
+
<%= post_action_parental_updates %>
|
96
96
|
load_all_<%= plural %>
|
97
97
|
render :create
|
98
98
|
else
|
@@ -137,9 +137,10 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
|
|
137
137
|
<% end %><% if destroy_action %> def destroy
|
138
138
|
begin
|
139
139
|
@<%=singular_name%>.destroy
|
140
|
+
flash[:notice] = '<%= singular_name.titlecase %> successfully deleted'
|
140
141
|
rescue StandardError => e
|
141
|
-
flash[:alert] = '<%= singular_name.titlecase %> could not be deleted
|
142
|
-
end
|
142
|
+
flash[:alert] = '<%= singular_name.titlecase %> could not be deleted'
|
143
|
+
end <%= post_action_parental_updates %>
|
143
144
|
load_all_<%= plural %>
|
144
145
|
end<% end %>
|
145
146
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<\%= turbo_frame_tag "<%= @namespace %>__#{dom_id(@<%= singular %>)}" do %>
|
2
|
+
<div class="cell editable" style="position: relative;">
|
3
|
+
<\% if @<%= singular %>.errors.any? %>
|
4
|
+
<\%= render(partial: "<%= namespace_with_trailing_dash %>errors", locals: {resource: @<%= singular %> }) %>
|
5
|
+
<\% end %>
|
6
|
+
|
7
|
+
<h2>Editing <\%= @<%= @singular %>.<%= display_class %> %></h2>
|
8
|
+
<\%= form_with model: <%= "@" + singular %>, url: <%= form_path_edit_helper %> do |f| %>
|
9
|
+
<\%= render partial: "form", locals: {:<%= singular %> => <%= "@" + singular%>, f: f}<%= @nested_set.collect{|arg| ".merge(@#{arg[:singular]} ? {#{arg[:singular]}: @#{arg[:singular]}} : {})" }.join %> \%>
|
10
|
+
<\% end %>
|
11
|
+
</div>
|
12
|
+
<\% end %>
|
@@ -1,12 +1,16 @@
|
|
1
1
|
<%= turbo_frame_tag "flash_notices" do %>
|
2
|
-
<% unless notice.nil? %>
|
3
|
-
<div class="alert alert
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
2
|
+
<% unless notice.nil? && alert.nil? %>
|
3
|
+
<div class="alert alert-<%= alert ? 'danger' : 'primary' %> alert-dismissible">
|
4
|
+
<div><%= notice %></div>
|
5
|
+
<div><%= alert %></div>
|
6
|
+
<% if defined?(resource) && resource %>
|
7
|
+
<ul>
|
8
|
+
<% resource.errors.full_messages.each do |message| %>
|
9
|
+
<li><%= message %></li>
|
10
|
+
<% end %>
|
11
|
+
</ul>
|
12
|
+
<% end %>
|
13
|
+
|
10
14
|
</div>
|
11
15
|
<% end %>
|
12
16
|
<% end %>
|
@@ -13,7 +13,7 @@
|
|
13
13
|
<div class="<%= @layout_strategy.row_classes %> <%= @layout_strategy.row_heading_classes %>">
|
14
14
|
<%= list_column_headings %>
|
15
15
|
|
16
|
-
<% if @downnest_object.any? %>
|
16
|
+
<% if @downnest_object.any? && !@big_edit %>
|
17
17
|
<% if !@stacked_downnesting %>
|
18
18
|
<%= @layout_strategy.downnest_column_style %>
|
19
19
|
<% @downnest_object.each do |downnest,i| %>
|
@@ -33,7 +33,6 @@
|
|
33
33
|
<% end %>
|
34
34
|
</div>
|
35
35
|
<% end %>
|
36
|
-
|
37
36
|
<% end %>
|
38
37
|
|
39
38
|
<div class=' scaffold-col-heading scaffold-col-heading-buttons <%= @layout_strategy.column_classes_for_column_headings %>' <%= @layout_strategy.button_column_style %>>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
<% if @downnest_children.any? %>
|
5
|
+
<% if @downnest_children.any? && ! @big_edit %>
|
6
6
|
<% each_downnest_width = @downnest_children.count == 1 ? 33 : (53/@downnest_children.count).floor %>
|
7
7
|
<% if @stacked_downnesting %><div class="<%= @layout_strategy.downnest_portal_stacked_column_width %> scaffold-downnest" ><% end %>
|
8
8
|
<% @downnest_object.each do |downnest, size| %>
|
@@ -35,6 +35,6 @@
|
|
35
35
|
<% end %>
|
36
36
|
|
37
37
|
<% unless @no_edit %>
|
38
|
-
<\%= link_to "Edit
|
38
|
+
<\%= link_to "Edit <% if @button_icons == 'font-awesome' %><i class='fa fa-1x fa-list-alt'></i><% end %>".html_safe, <%= edit_path_helper %>, <% if @big_edit %>'data-turbo' => 'false', <% end %>disable_with: "Loading...", class: "edit-<%= singular %>-button btn btn-primary btn-sm" %>
|
39
39
|
<% end %>
|
40
40
|
</div>
|
@@ -3,6 +3,7 @@
|
|
3
3
|
<\%= render partial: "list", locals: {<%= plural %>: @<%= plural %>}<%= @nested_set.collect{|arg| ".merge(@" + arg[:singular] + " ? {nested_for: \"" + arg[:singular] + "-\#{@" + arg[:singular] + ".id}\"" + ", " + arg[:singular] + ": @" + arg[:singular] + "} : {})"}.join() %> \%>
|
4
4
|
<\% end %>
|
5
5
|
<\% end %>
|
6
|
+
<%= turbo_parental_updates %>
|
6
7
|
<\%= turbo_stream.replace "<%= @namespace %>__<%= singular %>__<%= singular %>-new" do %>
|
7
8
|
<\% if @<%= singular %>.errors.none? %>
|
8
9
|
<\%= render partial: "new_button", locals: {}<%= @nested_set.collect{|arg| ".merge(@" + arg[:singular] + " ? {" + arg[:singular] + ": @" + arg[:singular] + "} : {})"}.join() %> %>
|
@@ -11,8 +12,6 @@
|
|
11
12
|
<\% end %>
|
12
13
|
<\% end %>
|
13
14
|
<\%= turbo_stream.replace "flash_notices" do %>
|
14
|
-
<\%= render partial: "layouts/flash_notices" %>
|
15
|
-
|
16
|
-
<\%= render partial: "errors", locals: {resource: @<%= singular %>} %>
|
17
|
-
<\% end %>
|
15
|
+
<\%= render partial: "layouts/flash_notices", locals: {resource: @<%= singular %>} %>
|
16
|
+
|
18
17
|
<\% end %>
|
@@ -1,3 +1,9 @@
|
|
1
|
-
|
1
|
+
<%= turbo_parental_updates %>
|
2
|
+
|
3
|
+
<\%= turbo_stream.update "<%= @namespace %>__<%= plural %>-list" + <%= nested_for_turbo_nested_constructor %> do %>
|
2
4
|
<\%= render partial: "list", locals: {<%=plural%>: @<%=plural%> }<%= @nested_set.collect{|arg| ".merge(@" + arg[:singular] + " ? {nested_for: \"" + arg[:singular] + "-\#{@" + arg[:singular] + ".id}\"" + ", " + arg[:singular] + ": @" + arg[:singular] + "} : {})"}.join() %> \%>
|
3
5
|
<\% end %>
|
6
|
+
|
7
|
+
<\%= turbo_stream.update "flash_notices" do %>
|
8
|
+
<\%= render partial: "layouts/flash_notices", locals: {resource: @<%= singular %>} %>
|
9
|
+
<\% end %>
|
@@ -1,20 +1,38 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
<h2>Editing <\%= @<%= @singular %>.<%= display_class %> %></h2>
|
12
|
-
<\%= form_with model: <%= "@" + singular %>, url: <%= form_path_edit_helper %> do |f| %>
|
13
|
-
<\%= render partial: "form", locals: {:<%= singular %> => <%= "@" + singular%>, f: f}<%= @nested_set.collect{|arg| ".merge(@#{arg[:singular]} ? {#{arg[:singular]}: @#{arg[:singular]}} : {})" }.join %> \%>
|
14
|
-
<\% end %>
|
15
|
-
|
1
|
+
<% if @big_edit %>
|
2
|
+
<div class="container">
|
3
|
+
<div class="row">
|
4
|
+
<div class="col-md-12">
|
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
|
+
<% end %>
|
7
|
+
<\%= render partial: "edit", locals: {<%= singular %>: @<%= singular %>} %>
|
8
|
+
<% if @big_edit %>
|
9
|
+
</div>
|
16
10
|
</div>
|
17
11
|
|
18
|
-
<\% end %>
|
19
12
|
|
13
|
+
<% if @downnest_children.any? && @big_edit %>
|
14
|
+
<% each_downnest_width = @downnest_children.count == 1 ? 33 : (53/@downnest_children.count).floor %>
|
15
|
+
<% @downnest_object.each do |downnest, size| %>
|
16
|
+
<div class="row">
|
17
|
+
<div class="col-md-6">
|
18
|
+
<% downnest_object = eval("#{singular_class}.reflect_on_association(:#{downnest})") %>
|
19
|
+
<% if downnest_object.nil?; raise "no relationship for downnested portal `#{downnest}` found on `#{singular_class}`; please check relationship for has_many :#{downnest}"; end; %>
|
20
|
+
<% downnest_class = downnest_object.class_name %>
|
21
|
+
<% downnest_object_name = eval("#{downnest_class}.table_name") %>
|
22
|
+
<% downnest_style = @layout_strategy.downnest_style %>
|
23
|
+
|
24
|
+
<\%= render partial: "<%= namespace_with_trailing_dash %><%= downnest_object_name %>/list", locals: {
|
25
|
+
<%= @singular %>: @<%= @singular %>,
|
26
|
+
<%= downnest_object_name %>: @<%= @singular %>.<%= downnest %>
|
27
|
+
}
|
28
|
+
.merge({nested_for: "<% if @nested_set.any? %>#{nested_for + "__" if defined?(nested_for)}<% end %><%= @singular %>-#{@<%= @singular %>.id}"})
|
29
|
+
<%= @nested_set.collect{|arg| ".merge(defined?(#{arg[:singular]}) ? {#{arg[:singular]}: #{arg[:singular]}} : {} )"}.join("\n") %>
|
30
|
+
\%>
|
31
|
+
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
<% end %>
|
35
|
+
<% end %>
|
36
|
+
</div>
|
37
|
+
<% end %>
|
20
38
|
|
@@ -4,10 +4,7 @@
|
|
4
4
|
<\%= render partial: '<%= list_path_partial %>', locals: {<%= plural %>: @<%= plural %>}<%= @nested_set.collect{|arg| ".merge(@#{arg[:singular]} ? {#{arg[:singular]}: @#{arg[:singular]}} : {})" }.join %> \%>
|
5
5
|
<\% end %>
|
6
6
|
<% end %>
|
7
|
-
|
8
|
-
<\%= turbo_stream.
|
9
|
-
<\%= render partial: "layouts/flash_notices" %>
|
10
|
-
<\% if @<%= singular %>.errors.any? %>
|
11
|
-
<\%= render partial: "errors", locals: {resource: @<%= singular %>} %>
|
12
|
-
<\% end %>
|
7
|
+
<%= turbo_parental_updates %>
|
8
|
+
<\%= turbo_stream.update "flash_notices" do %>
|
9
|
+
<\%= render partial: "layouts/flash_notices", locals: {resource: @<%= singular %>} %>
|
13
10
|
<\% end %>
|
@@ -25,7 +25,7 @@ describe 'interaction for <%= controller_class_name %>' do
|
|
25
25
|
describe "index" do
|
26
26
|
it "should show me the list" do
|
27
27
|
visit <%= path_helper_plural %>
|
28
|
-
<%= @columns_map.collect{|col, col_object| col_object.spec_list_view_assertion } %>
|
28
|
+
<%= @columns_map.collect{|col, col_object| col_object.spec_list_view_assertion }.join("\n ") %>
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
data/lib/hot-glue.rb
CHANGED
@@ -5,5 +5,86 @@ module HotGlue
|
|
5
5
|
module TemplateBuilders
|
6
6
|
|
7
7
|
end
|
8
|
+
|
9
|
+
|
10
|
+
class Error < StandardError
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.construct_downnest_object(input)
|
14
|
+
res = input.split(",").map { |child|
|
15
|
+
child_name = child.gsub("+","")
|
16
|
+
extra_size = child.count("+")
|
17
|
+
{child_name => 4+extra_size}
|
18
|
+
}
|
19
|
+
Hash[*res.collect{|hash| hash.collect{|key,value| [key,value].flatten}.flatten}.flatten]
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.optionalized_ternary(namespace: nil,
|
23
|
+
target:,
|
24
|
+
nested_set:,
|
25
|
+
modifier: "",
|
26
|
+
with_params: false,
|
27
|
+
top_level: false,
|
28
|
+
put_form: false)
|
29
|
+
instance_sym = top_level ? "@" : ""
|
30
|
+
|
31
|
+
if nested_set.nil? || nested_set.empty?
|
32
|
+
return modifier + "#{(namespace + '_') if namespace}#{target}_path" + (("(#{instance_sym}#{target})" if put_form) || "")
|
33
|
+
elsif nested_set[0][:optional] == false
|
34
|
+
|
35
|
+
return modifier + ((namespace + "_" if namespace) || "") + nested_set.collect{|x|
|
36
|
+
x[:singular] + "_"
|
37
|
+
}.join() + target + "_path" + (("(#{nested_set.collect{
|
38
|
+
|x| instance_sym + x[:singular] }.join(",")
|
39
|
+
}#{ put_form ? ',' + instance_sym + target : '' })") || "")
|
40
|
+
|
41
|
+
|
42
|
+
else
|
43
|
+
# copy the first item, make a ternery in this cycle, and recursively move to both the
|
44
|
+
# is present path and the is optional path
|
45
|
+
|
46
|
+
nonoptional = nested_set[0].dup
|
47
|
+
nonoptional[:optional] = false
|
48
|
+
rest_of_nest = nested_set[1..-1]
|
49
|
+
|
50
|
+
is_present_path = HotGlue.optionalized_ternary(
|
51
|
+
namespace: namespace,
|
52
|
+
target: target,
|
53
|
+
modifier: modifier,
|
54
|
+
top_level: top_level,
|
55
|
+
with_params: with_params,
|
56
|
+
put_form: put_form,
|
57
|
+
nested_set: [nonoptional, *rest_of_nest])
|
58
|
+
|
59
|
+
is_missing_path = HotGlue.optionalized_ternary(
|
60
|
+
namespace: namespace,
|
61
|
+
target: target,
|
62
|
+
modifier: modifier,
|
63
|
+
top_level: top_level,
|
64
|
+
with_params: with_params,
|
65
|
+
put_form: put_form,
|
66
|
+
nested_set: rest_of_nest )
|
67
|
+
return "defined?(#{instance_sym + nested_set[0][:singular]}2) ? #{is_present_path} : #{is_missing_path}"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.derrive_reference_name(thing_as_string)
|
72
|
+
assoc_class = eval(thing_as_string)
|
73
|
+
|
74
|
+
if assoc_class.new.respond_to?("name")
|
75
|
+
display_column = "name"
|
76
|
+
elsif assoc_class.new.respond_to?("to_label")
|
77
|
+
display_column = "to_label"
|
78
|
+
elsif assoc_class.new.respond_to?("full_name")
|
79
|
+
display_column = "full_name"
|
80
|
+
elsif assoc_class.new.respond_to?("display_name")
|
81
|
+
display_column = "display_name"
|
82
|
+
elsif assoc_class.new.respond_to?("email")
|
83
|
+
display_column = "email"
|
84
|
+
end
|
85
|
+
display_column
|
86
|
+
end
|
87
|
+
|
88
|
+
|
8
89
|
end
|
9
90
|
|
data/lib/hotglue/version.rb
CHANGED
data/script/test
CHANGED
@@ -4,9 +4,7 @@ clean_generated_code() {
|
|
4
4
|
./clean_generated_code
|
5
5
|
}
|
6
6
|
|
7
|
-
|
8
|
-
# the internal specs test only Hot Glue's command line usage
|
9
|
-
rspec spec
|
7
|
+
|
10
8
|
|
11
9
|
script/clean_generated_code
|
12
10
|
|
@@ -47,7 +45,7 @@ rails generate hot_glue:scaffold Human --gd
|
|
47
45
|
|
48
46
|
|
49
47
|
|
50
|
-
rspec
|
48
|
+
rspec || exit
|
51
49
|
|
52
50
|
cd ../
|
53
51
|
|
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.14
|
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-
|
11
|
+
date: 2023-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- config/database.yml
|
76
76
|
- config/hot_glue.yml
|
77
77
|
- db/schema.rb
|
78
|
+
- lib/generators/hot_glue/default_config_loader.rb
|
78
79
|
- lib/generators/hot_glue/direct_upload_install_generator.rb
|
79
80
|
- lib/generators/hot_glue/dropzone_install_generator.rb
|
80
81
|
- lib/generators/hot_glue/field_factory.rb
|
@@ -91,6 +92,8 @@ files:
|
|
91
92
|
- lib/generators/hot_glue/fields/text_field.rb
|
92
93
|
- lib/generators/hot_glue/fields/time_field.rb
|
93
94
|
- lib/generators/hot_glue/fields/uuid_field.rb
|
95
|
+
- lib/generators/hot_glue/flash_notices_install_generator.rb
|
96
|
+
- lib/generators/hot_glue/hot_glue.rb
|
94
97
|
- lib/generators/hot_glue/install_generator.rb
|
95
98
|
- lib/generators/hot_glue/layout/builder.rb
|
96
99
|
- lib/generators/hot_glue/layout_strategy/base.rb
|
@@ -104,7 +107,7 @@ files:
|
|
104
107
|
- lib/generators/hot_glue/templates/capybara_login.rb
|
105
108
|
- lib/generators/hot_glue/templates/computer_code.jpg
|
106
109
|
- lib/generators/hot_glue/templates/controller.rb.erb
|
107
|
-
- lib/generators/hot_glue/templates/erb/
|
110
|
+
- lib/generators/hot_glue/templates/erb/_edit.erb
|
108
111
|
- lib/generators/hot_glue/templates/erb/_flash_notices.erb
|
109
112
|
- lib/generators/hot_glue/templates/erb/_form.erb
|
110
113
|
- lib/generators/hot_glue/templates/erb/_line.erb
|
@@ -119,21 +122,6 @@ files:
|
|
119
122
|
- lib/generators/hot_glue/templates/erb/index.erb
|
120
123
|
- lib/generators/hot_glue/templates/erb/new.erb
|
121
124
|
- lib/generators/hot_glue/templates/erb/update.turbo_stream.erb
|
122
|
-
- lib/generators/hot_glue/templates/haml/_errors.haml
|
123
|
-
- lib/generators/hot_glue/templates/haml/_flash_notices.haml
|
124
|
-
- lib/generators/hot_glue/templates/haml/_form.haml
|
125
|
-
- lib/generators/hot_glue/templates/haml/_line.haml
|
126
|
-
- lib/generators/hot_glue/templates/haml/_list.haml
|
127
|
-
- lib/generators/hot_glue/templates/haml/_new_button.haml
|
128
|
-
- lib/generators/hot_glue/templates/haml/_new_form.haml
|
129
|
-
- lib/generators/hot_glue/templates/haml/_show.haml
|
130
|
-
- lib/generators/hot_glue/templates/haml/create.turbo_stream.haml
|
131
|
-
- lib/generators/hot_glue/templates/haml/destroy.turbo_stream.haml
|
132
|
-
- lib/generators/hot_glue/templates/haml/edit.haml
|
133
|
-
- lib/generators/hot_glue/templates/haml/edit.turbo_stream.haml
|
134
|
-
- lib/generators/hot_glue/templates/haml/index.haml
|
135
|
-
- lib/generators/hot_glue/templates/haml/new.haml
|
136
|
-
- lib/generators/hot_glue/templates/haml/update.turbo_stream.haml
|
137
125
|
- lib/generators/hot_glue/templates/javascript/dropzone_controller.js
|
138
126
|
- lib/generators/hot_glue/templates/system_spec.rb.erb
|
139
127
|
- lib/generators/hot_glue/templates/themes/hotglue_scaffold_dark_knight.scss
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<\%= turbo_frame_tag "errors" do %>
|
2
|
-
<\% if resource.errors.any? %>
|
3
|
-
<div id="error_explanation">
|
4
|
-
<\% resource.errors.full_messages.each do |message| %>
|
5
|
-
<div class="alert alert-danger">
|
6
|
-
<\%= message %>
|
7
|
-
</div>
|
8
|
-
<\% end %>
|
9
|
-
</div>
|
10
|
-
<\% end %>
|
11
|
-
<\% end %>
|
@@ -1,15 +0,0 @@
|
|
1
|
-
= turbo_frame_tag "<%= plural %>-list" do
|
2
|
-
%div{class: "<%= @container_name %> <%= singular %>-table"}
|
3
|
-
.row
|
4
|
-
.col-md-12
|
5
|
-
<%= '= render partial: "' + (@namespace+"/" if @namespace) + plural + '/new_button", locals: {' + nested_assignments + '}' unless @no_create %>
|
6
|
-
|
7
|
-
.row
|
8
|
-
<%= list_column_headings %>
|
9
|
-
.col
|
10
|
-
%div
|
11
|
-
- if <%= plural %>.empty?
|
12
|
-
None
|
13
|
-
- <%= plural %>.each do |<%= singular %>|
|
14
|
-
= render partial: '<%= line_path_partial %>', locals: {<%= singular %>: <%= singular %><%= nested_assignments_with_leading_comma if @nest %> }
|
15
|
-
<%= @no_paginate ? "" : paginate %>
|
@@ -1,7 +0,0 @@
|
|
1
|
-
= turbo_frame_tag "<%= singular %>-new" do
|
2
|
-
%h3
|
3
|
-
New <%= singular.titlecase %>
|
4
|
-
|
5
|
-
= form_with model: <%= singular %>, url: <%= path_helper_plural %>(<%= nested_objects_arity %>), method: "post" do |f|
|
6
|
-
= render partial: "<%=namespace_with_slash%><%= @plural %>/form", locals: {<%= singular %>: <%= singular %>, f: f}
|
7
|
-
|
@@ -1,7 +0,0 @@
|
|
1
|
-
<%= all_line_fields %>
|
2
|
-
.col
|
3
|
-
<% if destroy_action %>
|
4
|
-
= link_to "Delete <i class='fa fa-1x fa-remove'></i>".html_safe, <%= path_helper_singular %>(<%= path_helper_args %>), method: :delete, data: {confirm: 'Are you sure?'}, disable_with: "Loading...", class: "delete-<%= singular %>-button btn btn-primary "
|
5
|
-
<% end %>
|
6
|
-
|
7
|
-
= link_to "Edit <i class='fa fa-1x fa-list-alt'></i>".html_safe, edit_<%= path_helper_singular %>(<%= path_helper_args %>), <% if @big_edit %>'data-turbo' => 'false', <% end %>disable_with: "Loading...", class: "edit-<%= singular %>-button btn btn-primary "
|
@@ -1,14 +0,0 @@
|
|
1
|
-
- if @<%= singular %>.errors.none?
|
2
|
-
= turbo_stream.replace "<%= plural %>-list" do
|
3
|
-
= render partial: "list", locals: {<%= plural %>: @<%= plural %> <%= nest_assignments_operator(true, true) %>}
|
4
|
-
|
5
|
-
= turbo_stream.replace "<%= singular %>-new" do
|
6
|
-
- if @<%= singular %>.errors.none?
|
7
|
-
= render partial: "new_button", locals: {<%= nest_assignments_operator(true, false) %> }
|
8
|
-
- else
|
9
|
-
= render partial: "new_form", locals: {<%= singular %>: @<%= singular %> <%= nest_assignments_operator(true, true) %>}
|
10
|
-
|
11
|
-
= turbo_stream.replace "flash_notices" do
|
12
|
-
= render partial: "layouts/flash_notices"
|
13
|
-
- if @<%= singular %>.errors.any?
|
14
|
-
= render partial: "errors", locals: {resource: @<%= singular %>}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
= link_to "<i class='fa fa-arrow-circle-left 2x'></i> Back to list".html_safe, <%= path_helper_plural %>
|
2
|
-
|
3
|
-
= turbo_frame_tag "<%= singular %>__#{<%= "@" + singular %>.id}" do
|
4
|
-
.cell.editable{style: "position: relative;"}
|
5
|
-
- if <%="@" + singular%>.errors.any?
|
6
|
-
= render(partial: "#{controller.namespace}errors", locals: {resource: <%="@" + singular%>})
|
7
|
-
|
8
|
-
|
9
|
-
Editing
|
10
|
-
- if <%="@" + singular%>.try(:to_label)
|
11
|
-
= <%="@" + singular%>.to_label
|
12
|
-
- elsif <%="@" + singular%>.try(:name)
|
13
|
-
= <%="@" + singular%>.name
|
14
|
-
- else
|
15
|
-
(no name)
|
16
|
-
|
17
|
-
= form_with model: <%= "@" + singular%>, url: <%= path_helper_singular %>(<%= path_arity %>) do |f|
|
18
|
-
= render partial: "form", locals: {:<%= singular %> => <%= "@" + singular%>, f: f}
|
19
|
-
|
@@ -1 +0,0 @@
|
|
1
|
-
= render partial: "new_form", locals: {<%=singular%>: @<%=singular%>}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
|
2
|
-
= turbo_stream.replace "<%= singular%>__#{@<%= singular %>.id}" do
|
3
|
-
= render partial: 'line', locals: {<%= singular %>: @<%= singular %> <%= nested_assignments_with_leading_comma %> }
|
4
|
-
|
5
|
-
|
6
|
-
= turbo_stream.replace "flash_notices" do
|
7
|
-
= render partial: "layouts/flash_notices"
|
8
|
-
- if @<%= singular %>.errors.any?
|
9
|
-
= render partial: "errors", locals: {resource: @<%= singular %>}
|