draft_generators 0.0.5 → 0.0.6
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/draft_generators.gemspec +1 -1
- data/lib/generators/draft/account/templates/controllers/authentication_controller.rb +12 -12
- data/lib/generators/draft/account/templates/views/authentication/edit_profile.html.erb +10 -10
- data/lib/generators/draft/account/templates/views/authentication/edit_profile_with_errors.html.erb +10 -10
- data/lib/generators/draft/account/templates/views/authentication/sign_in.html.erb +4 -4
- data/lib/generators/draft/account/templates/views/authentication/sign_up.html.erb +12 -12
- data/lib/generators/draft/resource/templates/controllers/controller.rb +6 -6
- data/lib/generators/draft/resource/templates/specs/crud_spec.rb +2 -2
- data/lib/generators/draft/resource/templates/views/association_new_form.html.erb +8 -8
- data/lib/generators/draft/resource/templates/views/edit_form.html.erb +8 -8
- data/lib/generators/draft/resource/templates/views/edit_form_with_errors.html.erb +8 -8
- data/lib/generators/draft/resource/templates/views/index.html.erb +12 -12
- data/lib/generators/draft/resource/templates/views/new_form.html.erb +8 -8
- data/lib/generators/draft/resource/templates/views/new_form_with_errors.html.erb +8 -8
- data/lib/generators/draft/resource/templates/views/show.html.erb +12 -12
- data/lib/generators/draft/scaffold/templates/_form.html.erb +2 -2
- 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: 65ecce33b187d9753531ef6dbcefea0bd1e69daf0c1794fa2e7e5207f4cf1cbc
|
|
4
|
+
data.tar.gz: fa9ae86f0ae1fb1958026bfe4ff690ec562469e985439e67b6885d45810caef5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 76a8f0d41386fb37cae6338d14466175e222ecba71c6eb80ffa684627be8ef1a11ed22349ac8cc8a5ba4d2794e4a40b52dc4ffa9246eceb345f6b5e680b4cacb
|
|
7
|
+
data.tar.gz: f92466be845487a7e8eb1027c4e04d18b74fbbdc6c01a0e481e50efa0c1bddaecabd2af47a6d9c6fa3c8e1f22a2a7d48480c0d97b2362b57416e84b99e152ccd
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.6
|
data/draft_generators.gemspec
CHANGED
|
@@ -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.
|
|
9
|
+
s.version = "0.0.6"
|
|
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("
|
|
10
|
+
<%= singular_table_name.underscore %> = <%= class_name.singularize %>.where({ :email => params.fetch("email_param") }).first
|
|
11
11
|
|
|
12
|
-
the_supplied_password = params.fetch("
|
|
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
|
|
43
|
-
@<%= singular_table_name.underscore %>.<%= attribute.column_name %> = params.fetch("
|
|
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("
|
|
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("
|
|
48
|
-
@<%= singular_table_name.underscore %>.password_confirmation = params.fetch("
|
|
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
|
|
71
|
-
@<%= singular_table_name.underscore %>.<%= attribute.column_name %> = params.fetch("
|
|
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("
|
|
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("
|
|
76
|
-
@<%= singular_table_name.underscore %>.password_confirmation = params.fetch("
|
|
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 %>
|
|
12
|
-
<% if attribute.field_type
|
|
13
|
-
<textarea id="<%= attribute.column_name %>
|
|
14
|
-
<% elsif attribute.field_type
|
|
15
|
-
<input id="<%= 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 %>
|
|
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="
|
|
25
|
-
<input id="
|
|
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="
|
|
30
|
-
<input id="
|
|
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>
|
data/lib/generators/draft/account/templates/views/authentication/edit_profile_with_errors.html.erb
CHANGED
|
@@ -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 %>
|
|
19
|
-
<% if attribute.field_type
|
|
20
|
-
<textarea id="<%= attribute.column_name %>
|
|
21
|
-
<% elsif attribute.field_type
|
|
22
|
-
<input id="<%= 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 %>
|
|
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="
|
|
31
|
-
<input id="
|
|
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="
|
|
36
|
-
<input id="
|
|
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="
|
|
6
|
-
<input id="
|
|
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="
|
|
11
|
-
<input id="
|
|
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="
|
|
7
|
-
<input id="
|
|
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 %>
|
|
13
|
-
<%- if attribute.field_type
|
|
14
|
-
<input id="<%= attribute.column_name %>
|
|
15
|
-
<%- elsif attribute.field_type
|
|
16
|
-
<textarea id="<%= attribute.column_name %>
|
|
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 %>
|
|
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="
|
|
26
|
-
<input id="
|
|
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="
|
|
31
|
-
<input id="
|
|
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
|
|
24
|
-
the_<%= singular_table_name.underscore %>.<%= attribute.column_name %> = params.fetch("
|
|
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("
|
|
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
|
|
56
|
-
the_<%= singular_table_name.underscore %>.<%= attribute.column_name %> = params.fetch("
|
|
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("
|
|
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
|
|
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
|
|
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 -%>
|
|
@@ -16,31 +16,31 @@
|
|
|
16
16
|
<% if with_sentinels? -%>
|
|
17
17
|
<!-- Label and input for <%= attribute.column_name %> start -->
|
|
18
18
|
<% end -%>
|
|
19
|
-
<% if attribute.field_type
|
|
19
|
+
<% if [:check_box, :checkbox].include?(attribute.field_type) -%>
|
|
20
20
|
<div>
|
|
21
|
-
<input type="hidden" value="0" name="<%= attribute.column_name %>">
|
|
21
|
+
<input type="hidden" value="0" name="<%= attribute.column_name %>_param">
|
|
22
22
|
<% if with_sentinels? -%>
|
|
23
23
|
<!-- Input for <%= attribute.column_name %> start -->
|
|
24
24
|
<% end -%>
|
|
25
|
-
<input id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" type="checkbox" value="1" <%%= "checked" if @<%= singular_table_name %>.<%= attribute.column_name %> %>>
|
|
25
|
+
<input id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" type="checkbox" value="1" <%%= "checked" if @<%= singular_table_name %>.<%= attribute.column_name %> %>>
|
|
26
26
|
<% if with_sentinels? -%>
|
|
27
27
|
<!-- Input for <%= attribute.column_name %> end -->
|
|
28
28
|
<% end -%>
|
|
29
|
-
<label for="<%= attribute.column_name %>">
|
|
29
|
+
<label for="<%= attribute.column_name %>_field">
|
|
30
30
|
<%= attribute.column_name.humanize %>
|
|
31
31
|
</label>
|
|
32
32
|
</div>
|
|
33
33
|
<% else -%>
|
|
34
34
|
<div>
|
|
35
|
-
<label for="<%= attribute.column_name %>">
|
|
35
|
+
<label for="<%= attribute.column_name %>_field">
|
|
36
36
|
<%= attribute.column_name.humanize %>
|
|
37
37
|
</label>
|
|
38
38
|
|
|
39
|
-
<% if attribute.field_type
|
|
39
|
+
<% if [:text_area, :textarea].include?(attribute.field_type) -%>
|
|
40
40
|
<% if with_sentinels? -%>
|
|
41
41
|
<!-- Input for <%= attribute.column_name %> start -->
|
|
42
42
|
<% end -%>
|
|
43
|
-
<textarea id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" rows="3"><%%= @<%= singular_table_name %>.<%= attribute.column_name %> %></textarea>
|
|
43
|
+
<textarea id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" rows="3"><%%= @<%= singular_table_name %>.<%= attribute.column_name %> %></textarea>
|
|
44
44
|
<% if with_sentinels? -%>
|
|
45
45
|
<!-- Input for <%= attribute.column_name %> end -->
|
|
46
46
|
<% end -%>
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
<% if with_sentinels? -%>
|
|
49
49
|
<!-- Input for <%= attribute.column_name %> start -->
|
|
50
50
|
<% end -%>
|
|
51
|
-
<input type="text" id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" value="<%%= @<%= singular_table_name %>.<%= attribute.column_name %> %>">
|
|
51
|
+
<input type="text" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" value="<%%= @<%= singular_table_name %>.<%= attribute.column_name %> %>">
|
|
52
52
|
<% if with_sentinels? -%>
|
|
53
53
|
<!-- Input for <%= attribute.column_name %> end -->
|
|
54
54
|
<% end -%>
|
|
@@ -29,31 +29,31 @@
|
|
|
29
29
|
<% if with_sentinels? -%>
|
|
30
30
|
<!-- Label and input for <%= attribute.column_name %> start -->
|
|
31
31
|
<% end -%>
|
|
32
|
-
<% if attribute.field_type
|
|
32
|
+
<% if [:check_box, :checkbox].include?(attribute.field_type) -%>
|
|
33
33
|
<div>
|
|
34
|
-
<input type="hidden" value="0" name="<%= attribute.column_name %>">
|
|
34
|
+
<input type="hidden" value="0" name="<%= attribute.column_name %>_param">
|
|
35
35
|
<% if with_sentinels? -%>
|
|
36
36
|
<!-- Input for <%= attribute.column_name %> start -->
|
|
37
37
|
<% end -%>
|
|
38
|
-
<input id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" type="checkbox" value="1" <%%= "checked" if @<%= singular_table_name %>.<%= attribute.column_name %> %>>
|
|
38
|
+
<input id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" type="checkbox" value="1" <%%= "checked" if @<%= singular_table_name %>.<%= attribute.column_name %> %>>
|
|
39
39
|
<% if with_sentinels? -%>
|
|
40
40
|
<!-- Input for <%= attribute.column_name %> end -->
|
|
41
41
|
<% end -%>
|
|
42
|
-
<label for="<%= attribute.column_name %>">
|
|
42
|
+
<label for="<%= attribute.column_name %>_field">
|
|
43
43
|
<%= attribute.column_name.humanize %>
|
|
44
44
|
</label>
|
|
45
45
|
</div>
|
|
46
46
|
<% else -%>
|
|
47
47
|
<div>
|
|
48
|
-
<label for="<%= attribute.column_name %>">
|
|
48
|
+
<label for="<%= attribute.column_name %>_field">
|
|
49
49
|
<%= attribute.column_name.humanize %>
|
|
50
50
|
</label>
|
|
51
51
|
|
|
52
|
-
<% if attribute.field_type
|
|
52
|
+
<% if [:text_area, :textarea].include?(attribute.field_type) -%>
|
|
53
53
|
<% if with_sentinels? -%>
|
|
54
54
|
<!-- Input for <%= attribute.column_name %> start -->
|
|
55
55
|
<% end -%>
|
|
56
|
-
<textarea id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" rows="3"><%%= @<%= singular_table_name %>.<%= attribute.column_name %> %></textarea>
|
|
56
|
+
<textarea id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" rows="3"><%%= @<%= singular_table_name %>.<%= attribute.column_name %> %></textarea>
|
|
57
57
|
<% if with_sentinels? -%>
|
|
58
58
|
<!-- Input for <%= attribute.column_name %> end -->
|
|
59
59
|
<% end -%>
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
<% if with_sentinels? -%>
|
|
62
62
|
<!-- Input for <%= attribute.column_name %> start -->
|
|
63
63
|
<% end -%>
|
|
64
|
-
<input type="text" id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" value="<%%= @<%= singular_table_name %>.<%= attribute.column_name %> %>">
|
|
64
|
+
<input type="text" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" value="<%%= @<%= singular_table_name %>.<%= attribute.column_name %> %>">
|
|
65
65
|
<% if with_sentinels? -%>
|
|
66
66
|
<!-- Input for <%= attribute.column_name %> end -->
|
|
67
67
|
<% end -%>
|
|
@@ -13,31 +13,31 @@
|
|
|
13
13
|
|
|
14
14
|
<form action="/insert_<%= singular_table_name %>"<% unless skip_post? -%> method="post"<% end -%>>
|
|
15
15
|
<% attributes.each do |attribute| -%>
|
|
16
|
-
<% if attribute.field_type
|
|
16
|
+
<% if [:check_box, :checkbox].include?(attribute.field_type) -%>
|
|
17
17
|
<div>
|
|
18
|
-
<input type="checkbox" id="<%= attribute.column_name %>
|
|
18
|
+
<input type="checkbox" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" value="1">
|
|
19
19
|
|
|
20
|
-
<label for="<%= attribute.column_name %>
|
|
20
|
+
<label for="<%= attribute.column_name %>_field"><%= attribute.column_name.humanize %></label>
|
|
21
21
|
</div>
|
|
22
22
|
|
|
23
23
|
<% else -%>
|
|
24
24
|
<div>
|
|
25
|
-
<label for="<%= attribute.column_name %>
|
|
25
|
+
<label for="<%= attribute.column_name %>_field">
|
|
26
26
|
<%= attribute.column_name.humanize %>
|
|
27
27
|
</label>
|
|
28
28
|
|
|
29
|
-
<% if attribute.field_type
|
|
30
|
-
<textarea id="<%= attribute.column_name %>
|
|
29
|
+
<% if [:text_area, :textarea].include?(attribute.field_type) -%>
|
|
30
|
+
<textarea id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" rows="3"></textarea>
|
|
31
31
|
<% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :datetime -%>
|
|
32
|
-
<input type="datetime-local" id="<%= attribute.column_name %>
|
|
32
|
+
<input type="datetime-local" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param">
|
|
33
33
|
<% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :date -%>
|
|
34
|
-
<input type="date" id="<%= attribute.column_name %>
|
|
34
|
+
<input type="date" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param">
|
|
35
35
|
<% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :time -%>
|
|
36
|
-
<input type="time" id="<%= attribute.column_name %>
|
|
37
|
-
<% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :
|
|
38
|
-
<input type="number" id="<%= attribute.column_name %>
|
|
36
|
+
<input type="time" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param">
|
|
37
|
+
<% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :number -%>
|
|
38
|
+
<input type="number" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param">
|
|
39
39
|
<% else -%>
|
|
40
|
-
<input type="text" id="<%= attribute.column_name %>
|
|
40
|
+
<input type="text" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param">
|
|
41
41
|
<% end -%>
|
|
42
42
|
</div>
|
|
43
43
|
|
|
@@ -17,31 +17,31 @@
|
|
|
17
17
|
<% if with_sentinels? -%>
|
|
18
18
|
<!-- Label and input for <%= attribute.column_name %> start -->
|
|
19
19
|
<% end -%>
|
|
20
|
-
<% if attribute.field_type
|
|
20
|
+
<% if [:check_box, :checkbox].include?(attribute.field_type) -%>
|
|
21
21
|
<div>
|
|
22
|
-
<input type="hidden" value="0" name="<%= attribute.column_name %>">
|
|
22
|
+
<input type="hidden" value="0" name="<%= attribute.column_name %>_param">
|
|
23
23
|
<% if with_sentinels? -%>
|
|
24
24
|
<!-- Input for <%= attribute.column_name %> start -->
|
|
25
25
|
<% end -%>
|
|
26
|
-
<input id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" type="checkbox">
|
|
26
|
+
<input id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" type="checkbox">
|
|
27
27
|
<% if with_sentinels? -%>
|
|
28
28
|
<!-- Input for <%= attribute.column_name %> end -->
|
|
29
29
|
<% end -%>
|
|
30
|
-
<label for="<%= attribute.column_name %>">
|
|
30
|
+
<label for="<%= attribute.column_name %>_field">
|
|
31
31
|
<%= attribute.column_name.humanize %>
|
|
32
32
|
</label>
|
|
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
|
|
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"></textarea>
|
|
44
|
+
<textarea id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" rows="3"></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 %>">
|
|
52
|
+
<input type="text" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param">
|
|
53
53
|
<% if with_sentinels? -%>
|
|
54
54
|
<!-- Input for <%= attribute.column_name %> end -->
|
|
55
55
|
<% end -%>
|
|
@@ -30,31 +30,31 @@
|
|
|
30
30
|
<% if with_sentinels? -%>
|
|
31
31
|
<!-- Label and input for <%= attribute.column_name %> start -->
|
|
32
32
|
<% end -%>
|
|
33
|
-
<% if attribute.field_type
|
|
33
|
+
<% if [:check_box, :checkbox].include?(attribute.field_type) -%>
|
|
34
34
|
<div>
|
|
35
|
-
<input type="hidden" value="0" name="<%= attribute.column_name %>">
|
|
35
|
+
<input type="hidden" value="0" name="<%= attribute.column_name %>_param">
|
|
36
36
|
<% if with_sentinels? -%>
|
|
37
37
|
<!-- Input for <%= attribute.column_name %> start -->
|
|
38
38
|
<% end -%>
|
|
39
|
-
<input id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" type="checkbox" <% unless skip_validation_alerts? -%><%%= "checked" if @<%= singular_table_name %>.<%= attribute.column_name %> %><% end -%>>
|
|
39
|
+
<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 -%>>
|
|
40
40
|
<% if with_sentinels? -%>
|
|
41
41
|
<!-- Input for <%= attribute.column_name %> end -->
|
|
42
42
|
<% end -%>
|
|
43
|
-
<label for="<%= attribute.column_name %>">
|
|
43
|
+
<label for="<%= attribute.column_name %>_field">
|
|
44
44
|
<%= attribute.column_name.humanize %>
|
|
45
45
|
</label>
|
|
46
46
|
</div>
|
|
47
47
|
<% else -%>
|
|
48
48
|
<div>
|
|
49
|
-
<label for="<%= attribute.column_name %>">
|
|
49
|
+
<label for="<%= attribute.column_name %>_field">
|
|
50
50
|
<%= attribute.column_name.humanize %>
|
|
51
51
|
</label>
|
|
52
52
|
|
|
53
|
-
<% if attribute.field_type
|
|
53
|
+
<% if [:text_area, :textarea].include?(attribute.field_type) -%>
|
|
54
54
|
<% if with_sentinels? -%>
|
|
55
55
|
<!-- Input for <%= attribute.column_name %> start -->
|
|
56
56
|
<% end -%>
|
|
57
|
-
<textarea id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" rows="3"><% unless skip_validation_alerts? -%><%%= @<%= singular_table_name %>.<%= attribute.column_name %> %><% end -%></textarea>
|
|
57
|
+
<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>
|
|
58
58
|
<% if with_sentinels? -%>
|
|
59
59
|
<!-- Input for <%= attribute.column_name %> end -->
|
|
60
60
|
<% end -%>
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
<% if with_sentinels? -%>
|
|
63
63
|
<!-- Input for <%= attribute.column_name %> start -->
|
|
64
64
|
<% end -%>
|
|
65
|
-
<input type="text" id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" <% unless skip_validation_alerts? -%> value="<%%= @<%= singular_table_name %>.<%= attribute.column_name %> %>"<% end -%>>
|
|
65
|
+
<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 -%>>
|
|
66
66
|
<% if with_sentinels? -%>
|
|
67
67
|
<!-- Input for <%= attribute.column_name %> end -->
|
|
68
68
|
<% end -%>
|
|
@@ -83,34 +83,34 @@
|
|
|
83
83
|
|
|
84
84
|
<form action="/modify_<%= singular_table_name %>/<%%= @the_<%= singular_table_name %>.id %>" <% unless skip_post? -%> method="post" <% end -%>>
|
|
85
85
|
<% attributes.each do |attribute| -%>
|
|
86
|
-
<% if attribute.field_type
|
|
86
|
+
<% if [:check_box, :checkbox].include?(attribute.field_type) -%>
|
|
87
87
|
<div>
|
|
88
|
-
<input type="checkbox" id="<%= attribute.column_name %>
|
|
88
|
+
<input type="checkbox" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" value="1" <%%= "checked" if @the_<%= singular_table_name %>.<%= attribute.column_name %> %>>
|
|
89
89
|
|
|
90
|
-
<label for="<%= attribute.column_name %>
|
|
90
|
+
<label for="<%= attribute.column_name %>_field">
|
|
91
91
|
<%= attribute.column_name.humanize %>
|
|
92
92
|
</label>
|
|
93
93
|
</div>
|
|
94
94
|
|
|
95
95
|
<% else -%>
|
|
96
96
|
<div>
|
|
97
|
-
<label for="<%= attribute.column_name %>
|
|
97
|
+
<label for="<%= attribute.column_name %>_field">
|
|
98
98
|
<%= attribute.column_name.humanize %>
|
|
99
99
|
</label>
|
|
100
100
|
|
|
101
|
-
<% if attribute.field_type
|
|
102
|
-
<textarea id="<%= attribute.column_name %>
|
|
101
|
+
<% if [:text_area, :textarea].include?(attribute.field_type) -%>
|
|
102
|
+
<textarea id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param"><%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %></textarea>
|
|
103
103
|
<% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :datetime -%>
|
|
104
|
-
<input type="datetime-local" id="<%= attribute.column_name %>
|
|
104
|
+
<input type="datetime-local" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param"
|
|
105
105
|
value="<%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>">
|
|
106
106
|
<% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :date -%>
|
|
107
|
-
<input type="date" id="<%= attribute.column_name %>
|
|
107
|
+
<input type="date" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" value="<%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>">
|
|
108
108
|
<% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :time -%>
|
|
109
|
-
<input type="time" id="<%= attribute.column_name %>
|
|
110
|
-
<% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :
|
|
111
|
-
<input type="number" id="<%= attribute.column_name %>
|
|
109
|
+
<input type="time" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" value="<%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>">
|
|
110
|
+
<% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :number -%>
|
|
111
|
+
<input type="number" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" value="<%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>">
|
|
112
112
|
<% else -%>
|
|
113
|
-
<input type="text" id="<%= attribute.column_name %>
|
|
113
|
+
<input type="text" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" value="<%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>">
|
|
114
114
|
<% end -%>
|
|
115
115
|
</div>
|
|
116
116
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
<%%= form_for(<%= singular_table_name %>, html: form_html_options) do |f| %>
|
|
6
6
|
<% attributes.each do |attribute| -%>
|
|
7
|
-
<% if attribute.field_type
|
|
7
|
+
<% if [:check_box, :checkbox].include?(attribute.field_type) -%>
|
|
8
8
|
<div class="form-check">
|
|
9
9
|
<%% <%= attribute.name %>_class = "form-check-input" %>
|
|
10
10
|
<% else -%>
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<%% end %>
|
|
22
22
|
<%% end %>
|
|
23
23
|
|
|
24
|
-
<% if attribute.field_type
|
|
24
|
+
<% if [:check_box, :checkbox].include?(attribute.field_type) -%>
|
|
25
25
|
<%%= f.label :<%= attribute.name %>, class: "form-check-label" do %>
|
|
26
26
|
<%%= f.check_box :<%= attribute.name %>, class: <%= attribute.name %>_class %> <%= attribute.name.humanize %>
|
|
27
27
|
<%% end %>
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: draft_generators
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Raghu Betina
|
|
@@ -207,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
207
207
|
- !ruby/object:Gem::Version
|
|
208
208
|
version: '0'
|
|
209
209
|
requirements: []
|
|
210
|
-
rubygems_version: 3.6.
|
|
210
|
+
rubygems_version: 3.6.9
|
|
211
211
|
specification_version: 4
|
|
212
212
|
summary: Generators that help beginners learn to program.
|
|
213
213
|
test_files: []
|