draft_generators 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/draft_generators.gemspec +1 -1
  4. data/lib/generators/draft/account/templates/controllers/authentication_controller.rb +12 -12
  5. data/lib/generators/draft/account/templates/views/authentication/edit_profile.html.erb +10 -10
  6. data/lib/generators/draft/account/templates/views/authentication/edit_profile_with_errors.html.erb +10 -10
  7. data/lib/generators/draft/account/templates/views/authentication/sign_in.html.erb +4 -4
  8. data/lib/generators/draft/account/templates/views/authentication/sign_up.html.erb +12 -12
  9. data/lib/generators/draft/resource/templates/controllers/controller.rb +6 -6
  10. data/lib/generators/draft/resource/templates/specs/crud_spec.rb +2 -2
  11. data/lib/generators/draft/resource/templates/views/association_new_form.html.erb +9 -9
  12. data/lib/generators/draft/resource/templates/views/create_row.html.erb +23 -10
  13. data/lib/generators/draft/resource/templates/views/destroy_row.html.erb +23 -10
  14. data/lib/generators/draft/resource/templates/views/edit_form.html.erb +44 -41
  15. data/lib/generators/draft/resource/templates/views/edit_form_with_errors.html.erb +46 -43
  16. data/lib/generators/draft/resource/templates/views/index.html.erb +30 -34
  17. data/lib/generators/draft/resource/templates/views/new_form.html.erb +44 -42
  18. data/lib/generators/draft/resource/templates/views/new_form_with_errors.html.erb +46 -44
  19. data/lib/generators/draft/resource/templates/views/show.html.erb +51 -50
  20. data/lib/generators/draft/resource/templates/views/update_row.html.erb +20 -7
  21. data/lib/generators/draft/scaffold/templates/_form.html.erb +2 -2
  22. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b03de9376ab53aee4c6010031bd0b26166d99acf969e033af2e5fd3a7e99b9b8
4
- data.tar.gz: d243fae3b1682dddff2b7a64ab22f09ba5e777ecd51de7075b4878772528cdaa
3
+ metadata.gz: 3354edf9392d768ed4b0651cbe2e417282b0938f310081559c1730ffd8f4fdb2
4
+ data.tar.gz: 5cebddd1e8e7920e28fa3b5ca8895bc4eb7b75b39ff8aa10f3930b3b7aaf4639
5
5
  SHA512:
6
- metadata.gz: 696ed7897525880e7eee749ccb2f7eb0454519511a16f62be649e2ecb78a1e2ffcedf33cad1b20157477f0226577db6436a48e79928a183a3254552b5e9694b4
7
- data.tar.gz: 6abf61779e1cfb60898d13c0cceffc2144f472d9b16ec8e620dbda16740c8759ae3eedab788a03f30c8f211d440d54144061e84170b42272bed505da384568fc
6
+ metadata.gz: e2bb35a35b221cd8f1bdb9939e4e9df456dd8bd74fe2cbc105b4ae48bb21f50cb3b58cab84a5d967a3d67417c5097b247f24753f198097d5e798cd09cd1d3a15
7
+ data.tar.gz: 923249f07997b666c50aa0dc05dc56ad8bac9dcc7c6068c9079e7dfd557bdfc4ea867ecc1e4e77d42bfcb2ebe0753383e0817f19fd5184c811cc0193b094a281
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.7
@@ -6,7 +6,7 @@
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "draft_generators".freeze
9
- s.version = "0.0.5"
9
+ s.version = "0.0.7"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
@@ -7,9 +7,9 @@ class <%= class_name.singularize %>AuthenticationController < ApplicationControl
7
7
  end
8
8
 
9
9
  def create_cookie
10
- <%= singular_table_name.underscore %> = <%= class_name.singularize %>.where({ :email => params.fetch("query_email") }).first
10
+ <%= singular_table_name.underscore %> = <%= class_name.singularize %>.where({ :email => params.fetch("email_param") }).first
11
11
 
12
- the_supplied_password = params.fetch("query_password")
12
+ the_supplied_password = params.fetch("password_param")
13
13
 
14
14
  if <%= singular_table_name.underscore %> != nil
15
15
  are_they_legit = <%= singular_table_name.underscore %>.authenticate(the_supplied_password)
@@ -39,13 +39,13 @@ class <%= class_name.singularize %>AuthenticationController < ApplicationControl
39
39
  def create
40
40
  @<%= singular_table_name.underscore %> = <%= class_name.singularize %>.new
41
41
  <% attributes.each do |attribute| -%>
42
- <% if attribute.field_type == :check_box -%>
43
- @<%= singular_table_name.underscore %>.<%= attribute.column_name %> = params.fetch("query_<%= attribute.column_name %>", false)
42
+ <% if [:check_box, :checkbox].include?(attribute.field_type) -%>
43
+ @<%= singular_table_name.underscore %>.<%= attribute.column_name %> = params.fetch("<%= attribute.column_name %>_param", false)
44
44
  <% elsif attribute.column_name != "password_digest" -%>
45
- @<%= singular_table_name.underscore %>.<%= attribute.column_name %> = params.fetch("query_<%= attribute.column_name %>")
45
+ @<%= singular_table_name.underscore %>.<%= attribute.column_name %> = params.fetch("<%= attribute.column_name %>_param")
46
46
  <% else -%>
47
- @<%= singular_table_name.underscore %>.password = params.fetch("query_password")
48
- @<%= singular_table_name.underscore %>.password_confirmation = params.fetch("query_password_confirmation")
47
+ @<%= singular_table_name.underscore %>.password = params.fetch("password_param")
48
+ @<%= singular_table_name.underscore %>.password_confirmation = params.fetch("password_confirmation_param")
49
49
  <% end -%>
50
50
  <% end -%>
51
51
 
@@ -67,13 +67,13 @@ class <%= class_name.singularize %>AuthenticationController < ApplicationControl
67
67
  def update
68
68
  @<%= singular_table_name.underscore %> = @current_<%= singular_table_name.underscore %>
69
69
  <% attributes.each do |attribute| -%>
70
- <% if attribute.field_type == :check_box -%>
71
- @<%= singular_table_name.underscore %>.<%= attribute.column_name %> = params.fetch("query_<%= attribute.column_name %>", false)
70
+ <% if [:check_box, :checkbox].include?(attribute.field_type) -%>
71
+ @<%= singular_table_name.underscore %>.<%= attribute.column_name %> = params.fetch("<%= attribute.column_name %>_param", false)
72
72
  <% elsif attribute.column_name != "password_digest" -%>
73
- @<%= singular_table_name.underscore %>.<%= attribute.column_name %> = params.fetch("query_<%= attribute.column_name %>")
73
+ @<%= singular_table_name.underscore %>.<%= attribute.column_name %> = params.fetch("<%= attribute.column_name %>_param")
74
74
  <% else -%>
75
- @<%= singular_table_name.underscore %>.password = params.fetch("query_password")
76
- @<%= singular_table_name.underscore %>.password_confirmation = params.fetch("query_password_confirmation")
75
+ @<%= singular_table_name.underscore %>.password = params.fetch("password_param")
76
+ @<%= singular_table_name.underscore %>.password_confirmation = params.fetch("password_confirmation_param")
77
77
  <% end -%>
78
78
  <% end -%>
79
79
 
@@ -8,26 +8,26 @@
8
8
  <% attributes.each do |attribute| -%>
9
9
  <% if attribute.column_name != "password_digest" -%>
10
10
  <div>
11
- <label for="<%= attribute.column_name %>_box"><%= attribute.column_name.humanize %></label>
12
- <% if attribute.field_type == :text_area -%>
13
- <textarea id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" rows="3"><%%= @current_<%= singular_table_name %>.<%= attribute.column_name %> %></textarea>
14
- <% elsif attribute.field_type == :check_box -%>
15
- <input id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" type="checkbox" value="1" <%%= "checked" if @current_<%= singular_table_name %>.<%= attribute.column_name %> %>>
11
+ <label for="<%= attribute.column_name %>_field"><%= attribute.column_name.humanize %></label>
12
+ <% if [:text_area, :textarea].include?(attribute.field_type) -%>
13
+ <textarea id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" rows="3"><%%= @current_<%= singular_table_name %>.<%= attribute.column_name %> %></textarea>
14
+ <% elsif [:check_box, :checkbox].include?(attribute.field_type) -%>
15
+ <input id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" type="checkbox" value="1" <%%= "checked" if @current_<%= singular_table_name %>.<%= attribute.column_name %> %>>
16
16
  <% else -%>
17
- <input id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" value="<%%= @current_<%= singular_table_name.underscore %>.<%= attribute.column_name %> %>">
17
+ <input id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" value="<%%= @current_<%= singular_table_name.underscore %>.<%= attribute.column_name %> %>">
18
18
  <% end -%>
19
19
  </div>
20
20
  <% end -%>
21
21
  <% end -%>
22
22
 
23
23
  <div>
24
- <label for="password_box">Password</label>
25
- <input id="password_box" name="query_password" placeholder="Choose a password..." type="password">
24
+ <label for="password_field">Password</label>
25
+ <input id="password_field" name="password_param" placeholder="Choose a password..." type="password">
26
26
  </div>
27
27
 
28
28
  <div>
29
- <label for="password_confirmation_box">Password Confirmation</label>
30
- <input id="password_confirmation_box" name="query_password_confirmation" placeholder="Confirm your password..." type="password">
29
+ <label for="password_confirmation_field">Password Confirmation</label>
30
+ <input id="password_confirmation_field" name="password_confirmation_param" placeholder="Confirm your password..." type="password">
31
31
  </div>
32
32
 
33
33
  <button>
@@ -15,25 +15,25 @@
15
15
  <% attributes.each do |attribute| -%>
16
16
  <% if attribute.column_name != "password_digest" %>
17
17
  <div>
18
- <label for="<%= attribute.column_name %>_box"><%= attribute.column_name.humanize %></label>
19
- <% if attribute.field_type == :text_area %>
20
- <textarea id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" rows="3"><%%= @current_<%= singular_table_name %>.<%= attribute.column_name %> %></textarea>
21
- <% elsif attribute.field_type == :check_box %>
22
- <input id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" type="checkbox" value="1" <%%= "checked" if @current_<%= singular_table_name %>.<%= attribute.column_name %> %>>
18
+ <label for="<%= attribute.column_name %>_field"><%= attribute.column_name.humanize %></label>
19
+ <% if [:text_area, :textarea].include?(attribute.field_type) %>
20
+ <textarea id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" rows="3"><%%= @current_<%= singular_table_name %>.<%= attribute.column_name %> %></textarea>
21
+ <% elsif [:check_box, :checkbox].include?(attribute.field_type) %>
22
+ <input id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" type="checkbox" value="1" <%%= "checked" if @current_<%= singular_table_name %>.<%= attribute.column_name %> %>>
23
23
  <% else %>
24
- <input id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" value="<%%= @current_<%= singular_table_name.underscore %>.<%= attribute.column_name %> %>">
24
+ <input id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" value="<%%= @current_<%= singular_table_name.underscore %>.<%= attribute.column_name %> %>">
25
25
  <% end %>
26
26
  </div>
27
27
  <% end -%>
28
28
  <% end %>
29
29
  <div>
30
- <label for="password_box">Password</label>
31
- <input id="password_box" name="query_password" placeholder="Choose a new password..." type="password">
30
+ <label for="password_field">Password</label>
31
+ <input id="password_field" name="password_param" placeholder="Choose a new password..." type="password">
32
32
  </div>
33
33
 
34
34
  <div>
35
- <label for="password_confirmation_box">Password Confirmation</label>
36
- <input id="password_confirmation_box" name="query_password_confirmation" placeholder="Confirm your new password..." type="password">
35
+ <label for="password_confirmation_field">Password Confirmation</label>
36
+ <input id="password_confirmation_field" name="password_confirmation_param" placeholder="Confirm your new password..." type="password">
37
37
  </div>
38
38
 
39
39
  <button>
@@ -2,13 +2,13 @@
2
2
 
3
3
  <form action="/<%= singular_table_name.underscore %>_verify_credentials" method="post">
4
4
  <div>
5
- <label for="email_box">Email</label>
6
- <input id="email_box" name="query_email" placeholder="Enter your email..." type="text">
5
+ <label for="email_field">Email</label>
6
+ <input id="email_field" name="email_param" placeholder="Enter your email..." type="text">
7
7
  </div>
8
8
 
9
9
  <div>
10
- <label for="password_box">Password</label>
11
- <input id="password_box" name="query_password" placeholder="Enter your password..." type="password">
10
+ <label for="password_field">Password</label>
11
+ <input id="password_field" name="password_param" placeholder="Enter your password..." type="password">
12
12
  </div>
13
13
 
14
14
  <button>
@@ -3,32 +3,32 @@
3
3
  <form action="/insert_<%= singular_table_name.underscore %>" method="post">
4
4
 
5
5
  <div>
6
- <label for="email_box">Email</label>
7
- <input id="email_box" name="query_email" placeholder="Choose a email..." type="text">
6
+ <label for="email_field">Email</label>
7
+ <input id="email_field" name="email_param" placeholder="Choose a email..." type="text">
8
8
  </div>
9
9
  <% attributes.each do |attribute| -%>
10
10
  <% if attribute.column_name != "password_digest" && attribute.column_name != "email" -%>
11
11
  <div>
12
- <label for="<%= attribute.column_name %>_box"><%= attribute.column_name.humanize %></label>
13
- <%- if attribute.field_type == :check_box -%>
14
- <input id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" type="checkbox">
15
- <%- elsif attribute.field_type == :text_area -%>
16
- <textarea id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" rows="3"></textarea>
12
+ <label for="<%= attribute.column_name %>_field"><%= attribute.column_name.humanize %></label>
13
+ <%- if [:check_box, :checkbox].include?(attribute.field_type) -%>
14
+ <input id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" type="checkbox">
15
+ <%- elsif [:text_area, :textarea].include?(attribute.field_type) -%>
16
+ <textarea id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" rows="3"></textarea>
17
17
  <%- else -%>
18
- <input type="text" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>">
18
+ <input type="text" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param">
19
19
  <%- end -%>
20
20
  </div>
21
21
  <%- end -%>
22
22
  <% end -%>
23
23
 
24
24
  <div>
25
- <label for="password_box">Password</label>
26
- <input id="password_box" name="query_password" placeholder="Choose a password..." type="password">
25
+ <label for="password_field">Password</label>
26
+ <input id="password_field" name="password_param" placeholder="Choose a password..." type="password">
27
27
  </div>
28
28
 
29
29
  <div>
30
- <label for="password_confirmation_box">Password Confirmation</label>
31
- <input id="password_confirmation_box" name="query_password_confirmation" placeholder="Confirm your password..." type="password">
30
+ <label for="password_confirmation_field">Password Confirmation</label>
31
+ <input id="password_confirmation_field" name="password_confirmation_param" placeholder="Confirm your password..." type="password">
32
32
  </div>
33
33
 
34
34
  <button>
@@ -20,10 +20,10 @@ class <%= plural_table_name.camelize %>Controller < ApplicationController
20
20
  def create
21
21
  the_<%= singular_table_name.underscore %> = <%= class_name.singularize %>.new
22
22
  <% attributes.each do |attribute| -%>
23
- <% if attribute.field_type == :check_box -%>
24
- the_<%= singular_table_name.underscore %>.<%= attribute.column_name %> = params.fetch("query_<%= attribute.column_name %>", false)
23
+ <% if [:check_box, :checkbox].include?(attribute.field_type) -%>
24
+ the_<%= singular_table_name.underscore %>.<%= attribute.column_name %> = params.fetch("<%= attribute.column_name %>_param", false)
25
25
  <% else -%>
26
- the_<%= singular_table_name.underscore %>.<%= attribute.column_name %> = params.fetch("query_<%= attribute.column_name %>")
26
+ the_<%= singular_table_name.underscore %>.<%= attribute.column_name %> = params.fetch("<%= attribute.column_name %>_param")
27
27
  <% end -%>
28
28
  <% end -%>
29
29
 
@@ -52,10 +52,10 @@ class <%= plural_table_name.camelize %>Controller < ApplicationController
52
52
  the_<%= singular_table_name.underscore %> = <%= class_name.singularize %>.where({ :id => the_id }).at(0)
53
53
 
54
54
  <% attributes.each do |attribute| -%>
55
- <% if attribute.field_type == :check_box -%>
56
- the_<%= singular_table_name.underscore %>.<%= attribute.column_name %> = params.fetch("query_<%= attribute.column_name %>", false)
55
+ <% if [:check_box, :checkbox].include?(attribute.field_type) -%>
56
+ the_<%= singular_table_name.underscore %>.<%= attribute.column_name %> = params.fetch("<%= attribute.column_name %>_param", false)
57
57
  <% else -%>
58
- the_<%= singular_table_name.underscore %>.<%= attribute.column_name %> = params.fetch("query_<%= attribute.column_name %>")
58
+ the_<%= singular_table_name.underscore %>.<%= attribute.column_name %> = params.fetch("<%= attribute.column_name %>_param")
59
59
  <% end -%>
60
60
  <% end -%>
61
61
 
@@ -199,8 +199,8 @@ feature "<%= plural_table_name.humanize.upcase %>" do
199
199
  click_on "Edit <%= singular_table_name.humanize.downcase %>"
200
200
 
201
201
  <% case attribute.field_type -%>
202
- <% when :check_box -%>
203
- <% when :text_area -%>
202
+ <% when :check_box, :checkbox -%>
203
+ <% when :text_area, :textarea -%>
204
204
  expect(page).to have_content(<%= singular_table_name %>_to_edit.<%= attribute.column_name %>)
205
205
  <% else -%>
206
206
  expect(page).to have_css("input[value='#{<%= singular_table_name %>_to_edit.<%= attribute.column_name %>}']")
@@ -14,34 +14,34 @@
14
14
  <% if with_sentinels? -%>
15
15
  <!-- Input for <%= attribute.column_name %> start -->
16
16
  <% end -%>
17
- <input type="hidden" name="<%= attribute.column_name %>" value="<%%= <%= new_form_hidden_variable %> %>">
17
+ <input type="hidden" name="<%= attribute.column_name %>_param" value="<%%= <%= new_form_hidden_variable %> %>">
18
18
  <% if with_sentinels? -%>
19
19
  <!-- Input for <%= attribute.column_name %> end -->
20
20
  <% end -%>
21
- <% elsif attribute.field_type == :check_box -%>
21
+ <% elsif [:check_box, :checkbox].include?(attribute.field_type) -%>
22
22
  <div>
23
- <label for="<%= attribute.column_name %>">
23
+ <label for="<%= attribute.column_name %>_field">
24
24
  <%= attribute.column_name.humanize %>
25
25
  </label>
26
26
  <% if with_sentinels? -%>
27
27
  <!-- Input for <%= attribute.column_name %> start -->
28
28
  <% end -%>
29
- <input id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" type="checkbox" <% unless skip_validation_alerts? -%><%%= "checked" if @<%= singular_table_name %>.<%= attribute.column_name %> %><% end -%>>
29
+ <input id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" type="checkbox" <% unless skip_validation_alerts? -%><%%= "checked" if @<%= singular_table_name %>.<%= attribute.column_name %> %><% end -%>>
30
30
  <% if with_sentinels? -%>
31
31
  <!-- Input for <%= attribute.column_name %> end -->
32
32
  <% end -%>
33
33
  </div>
34
34
  <% else -%>
35
35
  <div>
36
- <label for="<%= attribute.column_name %>">
36
+ <label for="<%= attribute.column_name %>_field">
37
37
  <%= attribute.column_name.humanize %>
38
38
  </label>
39
39
 
40
- <% if attribute.field_type == :text_area -%>
40
+ <% if [:text_area, :textarea].include?(attribute.field_type) -%>
41
41
  <% if with_sentinels? -%>
42
42
  <!-- Input for <%= attribute.column_name %> start -->
43
43
  <% end -%>
44
- <textarea id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" rows="3"><% unless skip_validation_alerts? -%><%%= @<%= singular_table_name %>.<%= attribute.column_name %> %><% end -%></textarea>
44
+ <textarea id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" rows="3"><% unless skip_validation_alerts? -%><%%= @<%= singular_table_name %>.<%= attribute.column_name %> %><% end -%></textarea>
45
45
  <% if with_sentinels? -%>
46
46
  <!-- Input for <%= attribute.column_name %> end -->
47
47
  <% end -%>
@@ -49,7 +49,7 @@
49
49
  <% if with_sentinels? -%>
50
50
  <!-- Input for <%= attribute.column_name %> start -->
51
51
  <% end -%>
52
- <input type="text" id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" <% unless skip_validation_alerts? -%> value="<%%= @<%= singular_table_name %>.<%= attribute.column_name %> %>"<% end -%>>
52
+ <input type="text" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" <% unless skip_validation_alerts? -%> value="<%%= @<%= singular_table_name %>.<%= attribute.column_name %> %>"<% end -%>>
53
53
  <% if with_sentinels? -%>
54
54
  <!-- Input for <%= attribute.column_name %> end -->
55
55
  <% end -%>
@@ -61,7 +61,7 @@
61
61
  <% end -%>
62
62
 
63
63
  <% end -%>
64
- <button>
64
+ <button type="submit">
65
65
  Create <%= singular_table_name.humanize.downcase %>
66
66
  </button>
67
67
  </form>
@@ -1,13 +1,26 @@
1
- <h1>You created <%= singular_table_name.humanize.downcase %> #<%%= @<%= singular_table_name %>.id %>!</h1>
1
+ <nav aria-label="breadcrumb">
2
+ <ul>
3
+ <li><a href="/<%= plural_table_name.underscore %>"><%= plural_table_name.humanize %></a></li>
4
+ <li><%= singular_table_name.humanize %> #<%%= @<%= singular_table_name %>.id %></li>
5
+ </ul>
6
+ </nav>
2
7
 
3
- <p>
4
- There are now <%%= @current_count %> <%= plural_table_name.humanize.downcase %>.
5
- </p>
8
+ <div class="card">
9
+ <header>
10
+ <h1>
11
+ You created <%= singular_table_name.humanize.downcase %> #<%%= @<%= singular_table_name %>.id %>!
12
+ </h1>
13
+ </header>
6
14
 
7
- <p>
8
- <a href="/<%= @plural_table_name.underscore %>">
9
- Click here
10
- </a>
15
+ <p>
16
+ There are now <%%= @current_count %> <%= plural_table_name.humanize.downcase %>.
17
+ </p>
11
18
 
12
- to go back.
13
- </p>
19
+ <p>
20
+ <a href="/<%= plural_table_name.underscore %>">
21
+ Click here
22
+ </a>
23
+
24
+ to go back.
25
+ </p>
26
+ </div>
@@ -1,13 +1,26 @@
1
- <h1>You deleted <%= singular_table_name.humanize.downcase %> #<%%= @<%= singular_table_name %>.id %>!</h1>
1
+ <nav aria-label="breadcrumb">
2
+ <ul>
3
+ <li><a href="/<%= plural_table_name.underscore %>"><%= plural_table_name.humanize %></a></li>
4
+ <li><%= singular_table_name.humanize %> #<%%= @<%= singular_table_name %>.id %></li>
5
+ </ul>
6
+ </nav>
2
7
 
3
- <p>
4
- There are now <%%= @remaining_count %> <%= plural_table_name.humanize.downcase %>.
5
- </p>
8
+ <div class="card">
9
+ <header>
10
+ <h1>
11
+ You deleted <%= singular_table_name.humanize.downcase %> #<%%= @<%= singular_table_name %>.id %>!
12
+ </h1>
13
+ </header>
6
14
 
7
- <p>
8
- <a href="/<%= @plural_table_name.underscore %>">
9
- Click here
10
- </a>
15
+ <p>
16
+ There are now <%%= @remaining_count %> <%= plural_table_name.humanize.downcase %>.
17
+ </p>
11
18
 
12
- to go back.
13
- </p>
19
+ <p>
20
+ <a href="/<%= plural_table_name.underscore %>">
21
+ Click here
22
+ </a>
23
+
24
+ to go back.
25
+ </p>
26
+ </div>
@@ -1,72 +1,75 @@
1
- <h1>
2
- Edit <%= singular_table_name.humanize.downcase %> #<%%= @<%= singular_table_name %>.id %>
3
- </h1>
1
+ <nav aria-label="breadcrumb">
2
+ <ul>
3
+ <li><a href="/<%= plural_table_name %>"><%= plural_table_name.humanize %></a></li>
4
+ <li>Edit <%= singular_table_name.humanize.downcase %> #<%%= @<%= singular_table_name %>.id %></li>
5
+ </ul>
6
+ </nav>
4
7
 
5
- <hr>
8
+ <div class="card">
9
+ <header>
10
+ <h1>
11
+ Edit <%= singular_table_name.humanize.downcase %> #<%%= @<%= singular_table_name %>.id %>
12
+ </h1>
13
+ </header>
6
14
 
7
15
  <% if with_sentinels? -%>
8
- <!-- Form <%= singular_table_name %> start -->
16
+ <!-- Form <%= singular_table_name %> start -->
9
17
  <% end -%>
10
- <form action="/update_<%= singular_table_name %>/<%%= @<%= singular_table_name %>.id %>"<% unless skip_post? -%> method="post"<% end -%>>
18
+ <form action="/update_<%= singular_table_name %>/<%%= @<%= singular_table_name %>.id %>"<% unless skip_post? -%> method="post"<% end -%>>
11
19
  <% if with_sentinels? -%>
12
- <!-- Form <%= singular_table_name %> end -->
20
+ <!-- Form <%= singular_table_name %> end -->
13
21
  <% end -%>
14
22
 
15
23
  <% attributes.each do |attribute| -%>
16
24
  <% if with_sentinels? -%>
17
- <!-- Label and input for <%= attribute.column_name %> start -->
25
+ <!-- Label and input for <%= attribute.column_name %> start -->
18
26
  <% end -%>
19
- <% if attribute.field_type == :check_box -%>
20
- <div>
21
- <input type="hidden" value="0" name="<%= attribute.column_name %>">
27
+ <% if [:check_box, :checkbox].include?(attribute.field_type) -%>
28
+ <div>
29
+ <input type="hidden" value="0" name="<%= attribute.column_name %>_param">
22
30
  <% if with_sentinels? -%>
23
- <!-- Input for <%= attribute.column_name %> start -->
31
+ <!-- Input for <%= attribute.column_name %> start -->
24
32
  <% end -%>
25
- <input id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" type="checkbox" value="1" <%%= "checked" if @<%= singular_table_name %>.<%= attribute.column_name %> %>>
33
+ <input id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" type="checkbox" value="1" <%%= "checked" if @<%= singular_table_name %>.<%= attribute.column_name %> %>>
26
34
  <% if with_sentinels? -%>
27
- <!-- Input for <%= attribute.column_name %> end -->
35
+ <!-- Input for <%= attribute.column_name %> end -->
28
36
  <% end -%>
29
- <label for="<%= attribute.column_name %>">
30
- <%= attribute.column_name.humanize %>
31
- </label>
32
- </div>
37
+ <label for="<%= attribute.column_name %>_field">
38
+ <%= attribute.column_name.humanize %>
39
+ </label>
40
+ </div>
33
41
  <% else -%>
34
- <div>
35
- <label for="<%= attribute.column_name %>">
36
- <%= attribute.column_name.humanize %>
37
- </label>
42
+ <div>
43
+ <label for="<%= attribute.column_name %>_field">
44
+ <%= attribute.column_name.humanize %>
45
+ </label>
38
46
 
39
- <% if attribute.field_type == :text_area -%>
47
+ <% if [:text_area, :textarea].include?(attribute.field_type) -%>
40
48
  <% if with_sentinels? -%>
41
- <!-- Input for <%= attribute.column_name %> start -->
49
+ <!-- Input for <%= attribute.column_name %> start -->
42
50
  <% end -%>
43
- <textarea id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" rows="3"><%%= @<%= singular_table_name %>.<%= attribute.column_name %> %></textarea>
51
+ <textarea id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" rows="3"><%%= @<%= singular_table_name %>.<%= attribute.column_name %> %></textarea>
44
52
  <% if with_sentinels? -%>
45
- <!-- Input for <%= attribute.column_name %> end -->
53
+ <!-- Input for <%= attribute.column_name %> end -->
46
54
  <% end -%>
47
55
  <% else -%>
48
56
  <% if with_sentinels? -%>
49
- <!-- Input for <%= attribute.column_name %> start -->
57
+ <!-- Input for <%= attribute.column_name %> start -->
50
58
  <% end -%>
51
- <input type="text" id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" value="<%%= @<%= singular_table_name %>.<%= attribute.column_name %> %>">
59
+ <input type="text" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" value="<%%= @<%= singular_table_name %>.<%= attribute.column_name %> %>">
52
60
  <% if with_sentinels? -%>
53
- <!-- Input for <%= attribute.column_name %> end -->
61
+ <!-- Input for <%= attribute.column_name %> end -->
54
62
  <% end -%>
55
63
  <% end -%>
56
- </div>
64
+ </div>
57
65
  <% if with_sentinels? -%>
58
- <!-- Label and input for <%= attribute.column_name %> end -->
66
+ <!-- Label and input for <%= attribute.column_name %> end -->
59
67
  <% end -%>
60
68
  <% end -%>
61
69
 
62
70
  <% end -%>
63
- <button>
64
- Update <%= singular_table_name.humanize.downcase %>
65
- </button>
66
- </form>
67
-
68
- <hr>
69
-
70
- <a href="/<%= plural_table_name %>">
71
- Go back
72
- </a>
71
+ <button type="submit">
72
+ Update <%= singular_table_name.humanize.downcase %>
73
+ </button>
74
+ </form>
75
+ </div>