hot-glue 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +7 -6
- data/README.md +10 -2
- data/app/helpers/hot_glue/controller_helper.rb +1 -1
- data/lib/generators/hot_glue/install_generator.rb +0 -2
- data/lib/generators/hot_glue/markup_templates/base.rb +7 -0
- data/lib/generators/hot_glue/markup_templates/erb.rb +228 -0
- data/lib/generators/hot_glue/markup_templates/haml.rb +223 -0
- data/lib/generators/hot_glue/markup_templates/slim.rb +9 -0
- data/lib/generators/hot_glue/scaffold_generator.rb +97 -214
- data/lib/generators/hot_glue/templates/erb/_errors.erb +11 -0
- data/lib/generators/hot_glue/templates/erb/_flash_notices.erb +12 -0
- data/lib/generators/hot_glue/templates/erb/_form.erb +8 -0
- data/lib/generators/hot_glue/templates/erb/_line.erb +10 -0
- data/lib/generators/hot_glue/templates/erb/_list.erb +19 -0
- data/lib/generators/hot_glue/templates/erb/_new_button.erb +3 -0
- data/lib/generators/hot_glue/templates/erb/_new_form.erb +8 -0
- data/lib/generators/hot_glue/templates/erb/_show.erb +8 -0
- data/lib/generators/hot_glue/templates/erb/create.turbo_stream.erb +18 -0
- data/lib/generators/hot_glue/templates/erb/destroy.turbo_stream.erb +3 -0
- data/lib/generators/hot_glue/templates/erb/edit.erb +30 -0
- data/lib/generators/hot_glue/templates/erb/edit.turbo_stream.erb +3 -0
- data/lib/generators/hot_glue/templates/erb/index.erb +10 -0
- data/lib/generators/hot_glue/templates/erb/new.erb +1 -0
- data/lib/generators/hot_glue/templates/erb/update.turbo_stream.erb +10 -0
- data/lib/generators/hot_glue/templates/{_errors.haml → haml/_errors.haml} +0 -0
- data/lib/generators/hot_glue/templates/{_flash_notices.haml → haml/_flash_notices.haml} +0 -0
- data/lib/generators/hot_glue/templates/{_form.haml → haml/_form.haml} +0 -0
- data/lib/generators/hot_glue/templates/{_line.haml → haml/_line.haml} +0 -0
- data/lib/generators/hot_glue/templates/{_list.haml → haml/_list.haml} +0 -0
- data/lib/generators/hot_glue/templates/{_new_button.haml → haml/_new_button.haml} +0 -0
- data/lib/generators/hot_glue/templates/{_new_form.haml → haml/_new_form.haml} +0 -0
- data/lib/generators/hot_glue/templates/{_show.haml → haml/_show.haml} +0 -0
- data/lib/generators/hot_glue/templates/{create.turbo_stream.haml → haml/create.turbo_stream.haml} +0 -0
- data/lib/generators/hot_glue/templates/{destroy.turbo_stream.haml → haml/destroy.turbo_stream.haml} +0 -0
- data/lib/generators/hot_glue/templates/{edit.haml → haml/edit.haml} +0 -0
- data/lib/generators/hot_glue/templates/{edit.turbo_stream.haml → haml/edit.turbo_stream.haml} +0 -0
- data/lib/generators/hot_glue/templates/{index.haml → haml/index.haml} +0 -0
- data/lib/generators/hot_glue/templates/{new.haml → haml/new.haml} +0 -0
- data/lib/generators/hot_glue/templates/{update.turbo_stream.haml → haml/update.turbo_stream.haml} +0 -0
- data/lib/hot-glue.rb +6 -20
- data/lib/hotglue/version.rb +1 -1
- metadata +36 -17
@@ -0,0 +1,11 @@
|
|
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 %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= turbo_frame_tag "flash_notices" do %>
|
2
|
+
<% unless notice.nil? %>
|
3
|
+
<div class="alert alert-notice alert-dismissible">
|
4
|
+
<%= notice %>
|
5
|
+
</div>
|
6
|
+
<% end %>
|
7
|
+
<% unless alert.nil? %>
|
8
|
+
<div class="alert alert-danger alert-dismissible">
|
9
|
+
<%= alert %>
|
10
|
+
</div>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
|
2
|
+
<\%= turbo_frame_tag "<%= singular %>__#{ <%= singular %>.id }" do %>
|
3
|
+
<div class='row' data-id='<\%= <%= singular %>.id %>' data-edit='false'>
|
4
|
+
<\%= render partial: '<%= show_path_partial %>', locals: { <%= singular %>: <%= singular %>} %>
|
5
|
+
</div>
|
6
|
+
<\% end %>
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<\%= turbo_frame_tag "<%= plural %>-list" do %>
|
2
|
+
<div class="container-fluid "><%= singular %>-table
|
3
|
+
<div class="row">
|
4
|
+
<%= list_column_headings %>
|
5
|
+
<div class='col buttons-col'></div>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<\% if <%= plural %>.empty? %>
|
9
|
+
<div>
|
10
|
+
None
|
11
|
+
</div>
|
12
|
+
<\% end %>
|
13
|
+
<\% <%= plural %>.each do |<%= singular %>| %>
|
14
|
+
<\%= render partial: '<%= line_path_partial %>', locals: {<%= singular %>: <%= singular %> <%= nested_assignments_with_leading_comma %> } %>
|
15
|
+
<\% end %>
|
16
|
+
|
17
|
+
<%= @no_paginate ? "" : paginate %>
|
18
|
+
</div>
|
19
|
+
<\% end %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<\%= turbo_frame_tag "<%= singular %>-new" do %>
|
2
|
+
<h3>
|
3
|
+
New <%= singular.titlecase %>
|
4
|
+
</h3>
|
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
|
+
<\% end %>
|
8
|
+
<\% end %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%= all_line_fields %>
|
2
|
+
<div class="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 " %>
|
8
|
+
</div>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<\% if @<%= singular %>.errors.none? %>
|
2
|
+
<\%= turbo_stream.replace "<%= plural %>-list" do %>
|
3
|
+
<\%= render partial: "list", locals: {<%= plural %>: @<%= plural %>} %>
|
4
|
+
<\% end %>
|
5
|
+
<\% end %>
|
6
|
+
<\%= turbo_stream.replace "<%= singular %>-new" do %>
|
7
|
+
<\% if @<%= singular %>.errors.none? %>
|
8
|
+
<\%= render partial: "new_button" %>
|
9
|
+
<\% else %>
|
10
|
+
<\%= render partial: "new_form", locals: {<%= singular %>: @<%= singular %>} %>
|
11
|
+
<\% end %>
|
12
|
+
<\% end %>
|
13
|
+
<\%= turbo_stream.replace "flash_notices" do %>
|
14
|
+
<\%= render partial: "layouts/flash_notices" %>
|
15
|
+
<\% if @<%= singular %>.errors.any? %>
|
16
|
+
<\%= render partial: "errors", locals: {resource: @<%= singular %>} %>
|
17
|
+
<\% end %>
|
18
|
+
<\% end %>
|
@@ -0,0 +1,30 @@
|
|
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
|
+
|
5
|
+
<div class="cell editable" style="position: relative;">
|
6
|
+
|
7
|
+
<\% if @<%= singular %>.errors.any? %>
|
8
|
+
<\%= render(partial: "#{controller.namespace}errors", locals: {resource: @<%= singular%> }) %>
|
9
|
+
<\% end %>
|
10
|
+
|
11
|
+
<h2>Editing</h2>
|
12
|
+
<% if eval("@" + singular).try(:to_label) %>
|
13
|
+
<%="@" + singular%>.to_label
|
14
|
+
<% elsif eval("@" + singular).try(:name) %>
|
15
|
+
<%="@" + singular%>.name %>
|
16
|
+
<% else %>
|
17
|
+
(no name)
|
18
|
+
<% end %>
|
19
|
+
<\%= form_with model: <%= "@" + singular%>, url: <%= path_helper_singular %>(<%= path_arity %>) do |f| %>
|
20
|
+
<\%= render partial: "form", locals: {:<%= singular %> => <%= "@" + singular%>, f: f} %>
|
21
|
+
<\% end %>
|
22
|
+
<i class='fa fa-times-circle fa-2x'
|
23
|
+
data-name='close-<%= singular %>__<\% <%= "@" + singular %>.id %> }'
|
24
|
+
data-row-id=<%= "@" + singular %>.id,
|
25
|
+
data-role='close-button'></i>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<\% end %>
|
29
|
+
|
30
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<div class="container-fluid">
|
2
|
+
<div class="row">
|
3
|
+
<div class="col-md-12">
|
4
|
+
<\%= render partial: "new_button" %>
|
5
|
+
<div class="clearfix"></div>
|
6
|
+
<\%= render partial: '<%= list_path_partial %>',
|
7
|
+
locals: {<%= plural %>: @<%= plural %>} \%>
|
8
|
+
</div>
|
9
|
+
</div>
|
10
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<\%= render partial: "new_form", locals: {<%= singular %>: @<%=singular%>} %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<\%= turbo_stream.replace "<%= singular%>__#{@<%= singular %>.id}" do %>
|
2
|
+
<\%= render partial: 'line', locals: {<%= singular %>: @<%= singular %> <%= nested_assignments_with_leading_comma %> } %>
|
3
|
+
<\% end %>
|
4
|
+
|
5
|
+
<\%= turbo_stream.replace "flash_notices" do %>
|
6
|
+
<\%= render partial: "layouts/flash_notices" %>
|
7
|
+
<\% if @<%= singular %>.errors.any? %>
|
8
|
+
<\%= render partial: "errors", locals: {resource: @<%= singular %>} %>
|
9
|
+
<\% end %>
|
10
|
+
<\% end %>
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/generators/hot_glue/templates/{create.turbo_stream.haml → haml/create.turbo_stream.haml}
RENAMED
File without changes
|
data/lib/generators/hot_glue/templates/{destroy.turbo_stream.haml → haml/destroy.turbo_stream.haml}
RENAMED
File without changes
|
File without changes
|
data/lib/generators/hot_glue/templates/{edit.turbo_stream.haml → haml/edit.turbo_stream.haml}
RENAMED
File without changes
|
File without changes
|
File without changes
|
data/lib/generators/hot_glue/templates/{update.turbo_stream.haml → haml/update.turbo_stream.haml}
RENAMED
File without changes
|
data/lib/hot-glue.rb
CHANGED
@@ -3,26 +3,12 @@ require "hotglue/engine"
|
|
3
3
|
require 'kaminari'
|
4
4
|
require 'haml-rails'
|
5
5
|
|
6
|
-
|
7
6
|
module HotGlue
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
# params.keys.each{|k|
|
15
|
-
# if k.ends_with?("_at") || k.ends_with?("_date")
|
16
|
-
#
|
17
|
-
# begin
|
18
|
-
# params[k] = DateTime.strptime("#{params[k]} #{use_timezone}", '%Y-%m-%dT%H:%M %z')
|
19
|
-
# rescue StandardError
|
20
|
-
#
|
21
|
-
# end
|
22
|
-
# end
|
23
|
-
# }
|
24
|
-
# end
|
25
|
-
# modified_params
|
26
|
-
# end
|
27
|
-
# end
|
8
|
+
|
9
|
+
|
10
|
+
module TemplateBuilders
|
11
|
+
|
12
|
+
end
|
28
13
|
end
|
14
|
+
|
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
|
+
version: 0.2.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-06
|
11
|
+
date: 2021-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -121,25 +121,44 @@ files:
|
|
121
121
|
- db/migrate/20210306225506_create_xyzs.rb
|
122
122
|
- db/schema.rb
|
123
123
|
- lib/generators/hot_glue/install_generator.rb
|
124
|
+
- lib/generators/hot_glue/markup_templates/base.rb
|
125
|
+
- lib/generators/hot_glue/markup_templates/erb.rb
|
126
|
+
- lib/generators/hot_glue/markup_templates/haml.rb
|
127
|
+
- lib/generators/hot_glue/markup_templates/slim.rb
|
124
128
|
- lib/generators/hot_glue/scaffold_generator.rb
|
125
|
-
- lib/generators/hot_glue/templates/_errors.haml
|
126
|
-
- lib/generators/hot_glue/templates/_flash_notices.haml
|
127
|
-
- lib/generators/hot_glue/templates/_form.haml
|
128
|
-
- lib/generators/hot_glue/templates/_line.haml
|
129
|
-
- lib/generators/hot_glue/templates/_list.haml
|
130
|
-
- lib/generators/hot_glue/templates/_new_button.haml
|
131
|
-
- lib/generators/hot_glue/templates/_new_form.haml
|
132
|
-
- lib/generators/hot_glue/templates/_show.haml
|
133
129
|
- lib/generators/hot_glue/templates/base_controller.rb.erb
|
134
130
|
- lib/generators/hot_glue/templates/controller.rb.erb
|
135
|
-
- lib/generators/hot_glue/templates/
|
136
|
-
- lib/generators/hot_glue/templates/
|
137
|
-
- lib/generators/hot_glue/templates/
|
138
|
-
- lib/generators/hot_glue/templates/
|
139
|
-
- lib/generators/hot_glue/templates/
|
140
|
-
- lib/generators/hot_glue/templates/
|
131
|
+
- lib/generators/hot_glue/templates/erb/_errors.erb
|
132
|
+
- lib/generators/hot_glue/templates/erb/_flash_notices.erb
|
133
|
+
- lib/generators/hot_glue/templates/erb/_form.erb
|
134
|
+
- lib/generators/hot_glue/templates/erb/_line.erb
|
135
|
+
- lib/generators/hot_glue/templates/erb/_list.erb
|
136
|
+
- lib/generators/hot_glue/templates/erb/_new_button.erb
|
137
|
+
- lib/generators/hot_glue/templates/erb/_new_form.erb
|
138
|
+
- lib/generators/hot_glue/templates/erb/_show.erb
|
139
|
+
- lib/generators/hot_glue/templates/erb/create.turbo_stream.erb
|
140
|
+
- lib/generators/hot_glue/templates/erb/destroy.turbo_stream.erb
|
141
|
+
- lib/generators/hot_glue/templates/erb/edit.erb
|
142
|
+
- lib/generators/hot_glue/templates/erb/edit.turbo_stream.erb
|
143
|
+
- lib/generators/hot_glue/templates/erb/index.erb
|
144
|
+
- lib/generators/hot_glue/templates/erb/new.erb
|
145
|
+
- lib/generators/hot_glue/templates/erb/update.turbo_stream.erb
|
146
|
+
- lib/generators/hot_glue/templates/haml/_errors.haml
|
147
|
+
- lib/generators/hot_glue/templates/haml/_flash_notices.haml
|
148
|
+
- lib/generators/hot_glue/templates/haml/_form.haml
|
149
|
+
- lib/generators/hot_glue/templates/haml/_line.haml
|
150
|
+
- lib/generators/hot_glue/templates/haml/_list.haml
|
151
|
+
- lib/generators/hot_glue/templates/haml/_new_button.haml
|
152
|
+
- lib/generators/hot_glue/templates/haml/_new_form.haml
|
153
|
+
- lib/generators/hot_glue/templates/haml/_show.haml
|
154
|
+
- lib/generators/hot_glue/templates/haml/create.turbo_stream.haml
|
155
|
+
- lib/generators/hot_glue/templates/haml/destroy.turbo_stream.haml
|
156
|
+
- lib/generators/hot_glue/templates/haml/edit.haml
|
157
|
+
- lib/generators/hot_glue/templates/haml/edit.turbo_stream.haml
|
158
|
+
- lib/generators/hot_glue/templates/haml/index.haml
|
159
|
+
- lib/generators/hot_glue/templates/haml/new.haml
|
160
|
+
- lib/generators/hot_glue/templates/haml/update.turbo_stream.haml
|
141
161
|
- lib/generators/hot_glue/templates/system_spec.rb.erb
|
142
|
-
- lib/generators/hot_glue/templates/update.turbo_stream.haml
|
143
162
|
- lib/hot-glue.rb
|
144
163
|
- lib/hotglue/engine.rb
|
145
164
|
- lib/hotglue/version.rb
|