draft_generators 0.0.4 → 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/resource_generator.rb +7 -7
- data/lib/generators/draft/resource/templates/controllers/controller.rb +11 -11
- 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 +41 -123
- 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 +64 -69
- data/lib/generators/draft/scaffold/templates/_form.html.erb +2 -2
- metadata +2 -5
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>
|
|
@@ -32,13 +32,13 @@ module Draft
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def create_root_folder
|
|
35
|
-
empty_directory File.join("app/views", "#{
|
|
35
|
+
empty_directory File.join("app/views", "#{singular_table_name}_templates")
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
def generate_view_files
|
|
39
39
|
available_views.each do |view|
|
|
40
40
|
filename = view_filename_with_extensions(view)
|
|
41
|
-
template filename, File.join("app/views", "#{
|
|
41
|
+
template filename, File.join("app/views", "#{singular_table_name}_templates", File.basename(options[:new_form_name].presence || filename))
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
|
|
@@ -72,16 +72,16 @@ module Draft
|
|
|
72
72
|
|
|
73
73
|
# CREATE
|
|
74
74
|
post("/insert_#{singular_table_name}", { :controller => "#{plural_table_name}", :action => "create" })
|
|
75
|
-
|
|
75
|
+
|
|
76
76
|
# READ
|
|
77
77
|
get("/#{plural_table_name}", { :controller => "#{plural_table_name}", :action => "index" })
|
|
78
|
-
|
|
78
|
+
|
|
79
79
|
get("/#{plural_table_name}/:path_id", { :controller => "#{plural_table_name}", :action => "show" })
|
|
80
|
-
|
|
80
|
+
|
|
81
81
|
# UPDATE
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
post("/modify_#{singular_table_name}/:path_id", { :controller => "#{plural_table_name}", :action => "update" })
|
|
84
|
-
|
|
84
|
+
|
|
85
85
|
# DELETE
|
|
86
86
|
get("/delete_#{singular_table_name}/:path_id", { :controller => "#{plural_table_name}", :action => "destroy" })
|
|
87
87
|
|
|
@@ -4,7 +4,7 @@ class <%= plural_table_name.camelize %>Controller < ApplicationController
|
|
|
4
4
|
|
|
5
5
|
@list_of_<%= plural_table_name.underscore %> = matching_<%= plural_table_name.underscore %>.order({ :created_at => :desc })
|
|
6
6
|
|
|
7
|
-
render({ :template => "<%=
|
|
7
|
+
render({ :template => "<%= singular_table_name.underscore %>_templates/index" })
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def show
|
|
@@ -14,16 +14,16 @@ class <%= plural_table_name.camelize %>Controller < ApplicationController
|
|
|
14
14
|
|
|
15
15
|
@the_<%= singular_table_name.underscore %> = matching_<%= plural_table_name.underscore.downcase %>.at(0)
|
|
16
16
|
|
|
17
|
-
render({ :template => "<%=
|
|
17
|
+
render({ :template => "<%= singular_table_name.underscore %>_templates/show" })
|
|
18
18
|
end
|
|
19
19
|
|
|
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,17 +52,17 @@ 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
|
|
|
62
62
|
<% unless skip_validation_alerts? -%>
|
|
63
63
|
if the_<%= singular_table_name.underscore %>.valid?
|
|
64
64
|
the_<%= singular_table_name.underscore %>.save
|
|
65
|
-
redirect_to("/<%= plural_table_name.underscore %>/#{the_<%= singular_table_name.underscore %>.id}", { :notice => "<%= singular_table_name.humanize %> updated successfully."} )
|
|
65
|
+
redirect_to("/<%= plural_table_name.underscore %>/#{the_<%= singular_table_name.underscore %>.id}", { :notice => "<%= singular_table_name.humanize %> updated successfully." } )
|
|
66
66
|
else
|
|
67
67
|
redirect_to("/<%= plural_table_name.underscore %>/#{the_<%= singular_table_name.underscore %>.id}", { :alert => the_<%= singular_table_name.underscore %>.errors.full_messages.to_sentence })
|
|
68
68
|
end
|
|
@@ -72,7 +72,7 @@ class <%= plural_table_name.camelize %>Controller < ApplicationController
|
|
|
72
72
|
<% unless skip_redirect? -%>
|
|
73
73
|
redirect_to("/<%= plural_table_name.underscore %>/#{the_<%= singular_table_name.underscore %>.id}")
|
|
74
74
|
<% else -%>
|
|
75
|
-
render({ :template => "<%=
|
|
75
|
+
render({ :template => "<%= singular_table_name.underscore %>_templates/show" })
|
|
76
76
|
<% end -%>
|
|
77
77
|
<% end -%>
|
|
78
78
|
end
|
|
@@ -84,7 +84,7 @@ class <%= plural_table_name.camelize %>Controller < ApplicationController
|
|
|
84
84
|
the_<%= singular_table_name.underscore %>.destroy
|
|
85
85
|
|
|
86
86
|
<% unless skip_validation_alerts? -%>
|
|
87
|
-
redirect_to("/<%= plural_table_name.underscore %>", { :notice => "<%= singular_table_name.humanize %> deleted successfully."} )
|
|
87
|
+
redirect_to("/<%= plural_table_name.underscore %>", { :notice => "<%= singular_table_name.humanize %> deleted successfully." } )
|
|
88
88
|
<% else -%>
|
|
89
89
|
<% unless skip_redirect? -%>
|
|
90
90
|
redirect_to("/<%= plural_table_name.underscore %>")
|
|
@@ -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 -%>
|
|
@@ -1,148 +1,66 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
List of all <%= plural_table_name.humanize.downcase %>
|
|
5
|
-
</h1>
|
|
6
|
-
</div>
|
|
7
|
-
</div>
|
|
1
|
+
<h1>
|
|
2
|
+
List of all <%= plural_table_name.humanize.downcase %>
|
|
3
|
+
</h1>
|
|
8
4
|
|
|
9
5
|
<hr>
|
|
10
6
|
|
|
11
|
-
<
|
|
12
|
-
<
|
|
7
|
+
<article>
|
|
8
|
+
<header>
|
|
13
9
|
<h2>
|
|
14
10
|
Add a new <%= singular_table_name.humanize.downcase %>
|
|
15
11
|
</h2>
|
|
12
|
+
</header>
|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
<form action="/insert_<%= singular_table_name %>"<% unless skip_post? -%> method="post"<% end -%>>
|
|
18
15
|
<% attributes.each do |attribute| -%>
|
|
19
|
-
<% if attribute.field_type
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
<% if [:check_box, :checkbox].include?(attribute.field_type) -%>
|
|
17
|
+
<div>
|
|
18
|
+
<input type="checkbox" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" value="1">
|
|
22
19
|
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
<label for="<%= attribute.column_name %>_field"><%= attribute.column_name.humanize %></label>
|
|
21
|
+
</div>
|
|
25
22
|
|
|
26
23
|
<% else -%>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
<div>
|
|
25
|
+
<label for="<%= attribute.column_name %>_field">
|
|
26
|
+
<%= attribute.column_name.humanize %>
|
|
27
|
+
</label>
|
|
31
28
|
|
|
32
|
-
<% if attribute.field_type
|
|
33
|
-
|
|
29
|
+
<% if [:text_area, :textarea].include?(attribute.field_type) -%>
|
|
30
|
+
<textarea id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" rows="3"></textarea>
|
|
34
31
|
<% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :datetime -%>
|
|
35
|
-
|
|
32
|
+
<input type="datetime-local" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param">
|
|
36
33
|
<% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :date -%>
|
|
37
|
-
|
|
34
|
+
<input type="date" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param">
|
|
38
35
|
<% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :time -%>
|
|
39
|
-
|
|
40
|
-
<% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :
|
|
41
|
-
|
|
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">
|
|
42
39
|
<% else -%>
|
|
43
|
-
|
|
40
|
+
<input type="text" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param">
|
|
44
41
|
<% end -%>
|
|
45
|
-
|
|
42
|
+
</div>
|
|
46
43
|
|
|
47
44
|
<% end -%>
|
|
48
45
|
<% end -%>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
</div>
|
|
46
|
+
<button type="submit">
|
|
47
|
+
Create <%= singular_table_name.humanize.downcase %>
|
|
48
|
+
</button>
|
|
49
|
+
</form>
|
|
50
|
+
</article>
|
|
55
51
|
|
|
56
52
|
<hr>
|
|
57
|
-
<% if with_sentinels? -%>
|
|
58
|
-
<!-- Ransack Code start -->
|
|
59
53
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
<table border="1">
|
|
72
|
-
<tr>
|
|
73
|
-
<th>
|
|
74
|
-
ID
|
|
75
|
-
</th>
|
|
76
|
-
|
|
77
|
-
<% attributes.each do |attribute| -%>
|
|
78
|
-
<th>
|
|
79
|
-
<%= attribute.human_name %>
|
|
80
|
-
</th>
|
|
81
|
-
|
|
82
|
-
<% end -%>
|
|
83
|
-
<th>
|
|
84
|
-
Created at
|
|
85
|
-
</th>
|
|
86
|
-
|
|
87
|
-
<th>
|
|
88
|
-
Updated at
|
|
89
|
-
</th>
|
|
90
|
-
|
|
91
|
-
<th>
|
|
92
|
-
</th>
|
|
93
|
-
</tr>
|
|
94
|
-
|
|
95
|
-
<%% @list_of_<%= plural_table_name %>.each do |<%= singular_table_name.indefinitize.gsub(" ", "_") %>| %>
|
|
96
|
-
<tr>
|
|
97
|
-
<% if with_sentinels? -%>
|
|
98
|
-
<!-- Display <%= singular_table_name.indefinitize.gsub(" ", "_") %>.id start -->
|
|
99
|
-
<% end -%>
|
|
100
|
-
<td>
|
|
101
|
-
<%%= <%= singular_table_name.indefinitize.gsub(" ", "_") %>.id %>
|
|
102
|
-
</td>
|
|
103
|
-
<% if with_sentinels? -%>
|
|
104
|
-
<!-- Display <%= singular_table_name.indefinitize.gsub(" ", "_") %>.id end -->
|
|
105
|
-
<% end -%>
|
|
106
|
-
|
|
107
|
-
<% attributes.each do |attribute| -%>
|
|
108
|
-
<% if with_sentinels? -%>
|
|
109
|
-
<!-- Display <%= singular_table_name.indefinitize.gsub(" ", "_") %>.<%= attribute.column_name %> start -->
|
|
110
|
-
<% end -%>
|
|
111
|
-
<td>
|
|
112
|
-
<%%= <%= singular_table_name.indefinitize.gsub(" ", "_") %>.<%= attribute.column_name %> %>
|
|
113
|
-
</td>
|
|
114
|
-
<% if with_sentinels? -%>
|
|
115
|
-
<!-- Display <%= singular_table_name.indefinitize.gsub(" ", "_") %>.<%= attribute.column_name %> end -->
|
|
116
|
-
<% end -%>
|
|
117
|
-
|
|
118
|
-
<% end -%>
|
|
119
|
-
<% if with_sentinels? -%>
|
|
120
|
-
<!-- Display <%= singular_table_name.indefinitize.gsub(" ", "_") %>.created_at start -->
|
|
121
|
-
<% end -%>
|
|
122
|
-
<td>
|
|
123
|
-
<%%= time_ago_in_words(<%= singular_table_name.indefinitize.gsub(" ", "_") %>.created_at) %> ago
|
|
124
|
-
</td>
|
|
125
|
-
<% if with_sentinels? -%>
|
|
126
|
-
<!-- Display <%= singular_table_name.indefinitize.gsub(" ", "_") %>.created_at end -->
|
|
127
|
-
|
|
128
|
-
<!-- Display <%= singular_table_name.indefinitize.gsub(" ", "_") %>.updated_at start -->
|
|
129
|
-
<% end -%>
|
|
130
|
-
<td>
|
|
131
|
-
<%%= time_ago_in_words(<%= singular_table_name.indefinitize.gsub(" ", "_") %>.updated_at) %> ago
|
|
132
|
-
</td>
|
|
133
|
-
<% if with_sentinels? -%>
|
|
134
|
-
<!-- Display <%= singular_table_name.indefinitize.gsub(" ", "_") %>.updated_at end -->
|
|
135
|
-
<% end -%>
|
|
136
|
-
|
|
137
|
-
<td>
|
|
138
|
-
<a href="/<%= plural_table_name %>/<%%= <%= singular_table_name.indefinitize.gsub(" ", "_") %>.id %>">
|
|
139
|
-
Show details
|
|
140
|
-
</a>
|
|
141
|
-
</td>
|
|
142
|
-
</tr>
|
|
143
|
-
<%% end %>
|
|
144
|
-
</table>
|
|
145
|
-
</div>
|
|
146
|
-
</div>
|
|
54
|
+
<article>
|
|
55
|
+
<ul>
|
|
56
|
+
<%% @list_of_<%= plural_table_name %>.each do |<%= singular_table_name.indefinitize.gsub(" ", "_") %>| %>
|
|
57
|
+
<li>
|
|
58
|
+
<a href="/<%= plural_table_name.underscore %>/<%%= <%= singular_table_name.indefinitize.gsub(" ", "_") %>.id %>">
|
|
59
|
+
<%= singular_table_name.humanize %> #<%%= <%= singular_table_name.indefinitize.gsub(" ", "_") %>.id %>
|
|
60
|
+
</a>
|
|
61
|
+
</li>
|
|
62
|
+
<%% end %>
|
|
63
|
+
</ul>
|
|
64
|
+
</article>
|
|
147
65
|
|
|
148
66
|
<hr>
|
|
@@ -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 -%>
|
|
@@ -1,75 +1,70 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
<%= singular_table_name.humanize %> #<%%= @the_<%= singular_table_name %>.id %> details
|
|
5
|
-
</h1>
|
|
1
|
+
<h1>
|
|
2
|
+
<%= singular_table_name.humanize %> #<%%= @the_<%= singular_table_name %>.id %> details
|
|
3
|
+
</h1>
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
<article>
|
|
6
|
+
<div>
|
|
7
|
+
<a href="/<%= plural_table_name %>">
|
|
8
|
+
Go back
|
|
9
|
+
</a>
|
|
10
|
+
</div>
|
|
13
11
|
|
|
14
12
|
<% unless read_only? -%>
|
|
15
13
|
<% if with_sentinels? -%>
|
|
16
14
|
<!-- Delete link <%= singular_table_name %> start -->
|
|
17
15
|
<% end -%>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
<div>
|
|
17
|
+
<a href="/delete_<%= singular_table_name %>/<%%= @the_<%= singular_table_name %>.id %>">
|
|
18
|
+
Delete <%= singular_table_name.humanize.downcase %>
|
|
19
|
+
</a>
|
|
20
|
+
</div>
|
|
23
21
|
<% if with_sentinels? -%>
|
|
24
22
|
<!-- Delete link <%= singular_table_name %> end -->
|
|
25
23
|
<% end -%>
|
|
26
24
|
<% end -%>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<dl>
|
|
25
|
+
<dl>
|
|
30
26
|
<% attributes.each do |attribute| -%>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
<dt>
|
|
28
|
+
<%= attribute.human_name %>
|
|
29
|
+
</dt>
|
|
34
30
|
<% if with_sentinels? -%>
|
|
35
31
|
<!-- Display the_<%= attribute.column_name %> start -->
|
|
36
32
|
<% end -%>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
<dd>
|
|
34
|
+
<%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>
|
|
35
|
+
</dd>
|
|
40
36
|
<% if with_sentinels? -%>
|
|
41
37
|
<!-- Display the_<%= attribute.column_name %> end -->
|
|
42
38
|
<% end -%>
|
|
43
39
|
|
|
44
40
|
<% end -%>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
<dt>
|
|
42
|
+
Created at
|
|
43
|
+
</dt>
|
|
48
44
|
<% if with_sentinels? -%>
|
|
49
45
|
<!-- Display created_at start -->
|
|
50
46
|
<% end -%>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
<dd>
|
|
48
|
+
<%%= time_ago_in_words(@the_<%= singular_table_name %>.created_at) %> ago
|
|
49
|
+
</dd>
|
|
54
50
|
<% if with_sentinels? -%>
|
|
55
51
|
<!-- Display created_at end -->
|
|
56
52
|
<% end -%>
|
|
57
53
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
<dt>
|
|
55
|
+
Updated at
|
|
56
|
+
</dt>
|
|
61
57
|
<% if with_sentinels? -%>
|
|
62
58
|
<!-- Display updated_at start -->
|
|
63
59
|
<% end -%>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
<dd>
|
|
61
|
+
<%%= time_ago_in_words(@the_<%= singular_table_name %>.updated_at) %> ago
|
|
62
|
+
</dd>
|
|
67
63
|
<% if with_sentinels? -%>
|
|
68
64
|
<!-- Display updated_at end -->
|
|
69
65
|
<% end -%>
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
</div>
|
|
66
|
+
</dl>
|
|
67
|
+
</article>
|
|
73
68
|
|
|
74
69
|
<hr>
|
|
75
70
|
|
|
@@ -79,52 +74,52 @@
|
|
|
79
74
|
<!-- Show Page Customization end -->
|
|
80
75
|
<% end -%>
|
|
81
76
|
|
|
82
|
-
<
|
|
83
|
-
<
|
|
77
|
+
<article>
|
|
78
|
+
<header>
|
|
84
79
|
<h2>
|
|
85
80
|
Edit <%= singular_table_name.humanize.downcase %>
|
|
86
81
|
</h2>
|
|
82
|
+
</header>
|
|
87
83
|
|
|
88
|
-
|
|
84
|
+
<form action="/modify_<%= singular_table_name %>/<%%= @the_<%= singular_table_name %>.id %>" <% unless skip_post? -%> method="post" <% end -%>>
|
|
89
85
|
<% attributes.each do |attribute| -%>
|
|
90
|
-
<% if attribute.field_type
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
<% if [:check_box, :checkbox].include?(attribute.field_type) -%>
|
|
87
|
+
<div>
|
|
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 %> %>>
|
|
93
89
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
90
|
+
<label for="<%= attribute.column_name %>_field">
|
|
91
|
+
<%= attribute.column_name.humanize %>
|
|
92
|
+
</label>
|
|
93
|
+
</div>
|
|
98
94
|
|
|
99
95
|
<% else -%>
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
96
|
+
<div>
|
|
97
|
+
<label for="<%= attribute.column_name %>_field">
|
|
98
|
+
<%= attribute.column_name.humanize %>
|
|
99
|
+
</label>
|
|
104
100
|
|
|
105
|
-
<% if attribute.field_type
|
|
106
|
-
|
|
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>
|
|
107
103
|
<% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :datetime -%>
|
|
108
|
-
|
|
104
|
+
<input type="datetime-local" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param"
|
|
109
105
|
value="<%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>">
|
|
110
106
|
<% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :date -%>
|
|
111
|
-
|
|
107
|
+
<input type="date" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" value="<%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>">
|
|
112
108
|
<% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :time -%>
|
|
113
|
-
|
|
114
|
-
<% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :
|
|
115
|
-
|
|
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 %> %>">
|
|
116
112
|
<% else -%>
|
|
117
|
-
|
|
113
|
+
<input type="text" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" value="<%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>">
|
|
118
114
|
<% end -%>
|
|
119
|
-
|
|
115
|
+
</div>
|
|
120
116
|
|
|
121
117
|
<% end -%>
|
|
122
118
|
<% end -%>
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
</div>
|
|
119
|
+
<button type="submit">
|
|
120
|
+
Update <%= singular_table_name.humanize.downcase %>
|
|
121
|
+
</button>
|
|
122
|
+
</form>
|
|
123
|
+
</article>
|
|
129
124
|
|
|
130
125
|
<hr>
|
|
@@ -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,11 +1,10 @@
|
|
|
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
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
10
|
date: 2023-05-30 00:00:00.000000000 Z
|
|
@@ -194,7 +193,6 @@ homepage: http://github.com/raghubetina/draft_generators
|
|
|
194
193
|
licenses:
|
|
195
194
|
- MIT
|
|
196
195
|
metadata: {}
|
|
197
|
-
post_install_message:
|
|
198
196
|
rdoc_options: []
|
|
199
197
|
require_paths:
|
|
200
198
|
- lib
|
|
@@ -209,8 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
209
207
|
- !ruby/object:Gem::Version
|
|
210
208
|
version: '0'
|
|
211
209
|
requirements: []
|
|
212
|
-
rubygems_version: 3.
|
|
213
|
-
signing_key:
|
|
210
|
+
rubygems_version: 3.6.9
|
|
214
211
|
specification_version: 4
|
|
215
212
|
summary: Generators that help beginners learn to program.
|
|
216
213
|
test_files: []
|