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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d209a8d2e3679c9017931e313f683ea37cbfd82b3c15b7c342babc1ff200a297
4
- data.tar.gz: 3d4309214d3292e7a4a763ae8796f5c415f472faa00564efec1d01c530ffcfb3
3
+ metadata.gz: 65ecce33b187d9753531ef6dbcefea0bd1e69daf0c1794fa2e7e5207f4cf1cbc
4
+ data.tar.gz: fa9ae86f0ae1fb1958026bfe4ff690ec562469e985439e67b6885d45810caef5
5
5
  SHA512:
6
- metadata.gz: 7e07f6a687883dc6d265d74b91fece5b402346a7c9f2f57a2749b02c221a9153ac7db2f407598fba7bc4b227a0eae0d0b8d8d98c0f0bf1b025465daf679ecac8
7
- data.tar.gz: 17c6d5992dba3a40c16241b46119548722031bbfbbe406c506165f44c0e181a7515a043a609370070a8879019f509bde5c1392e1939bb82060749b8bee8c152f
6
+ metadata.gz: 76a8f0d41386fb37cae6338d14466175e222ecba71c6eb80ffa684627be8ef1a11ed22349ac8cc8a5ba4d2794e4a40b52dc4ffa9246eceb345f6b5e680b4cacb
7
+ data.tar.gz: f92466be845487a7e8eb1027c4e04d18b74fbbdc6c01a0e481e50efa0c1bddaecabd2af47a6d9c6fa3c8e1f22a2a7d48480c0d97b2362b57416e84b99e152ccd
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.6
@@ -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.4"
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("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>
@@ -32,13 +32,13 @@ module Draft
32
32
  end
33
33
 
34
34
  def create_root_folder
35
- empty_directory File.join("app/views", "#{plural_table_name}")
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", "#{plural_table_name}", File.basename(options[:new_form_name].presence || filename))
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 => "<%= plural_table_name.underscore %>/index" })
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 => "<%= plural_table_name.underscore %>/show" })
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 == :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,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 == :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
 
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 => "<%= plural_table_name.underscore %>/show" })
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 == :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 -%>
@@ -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 == :check_box -%>
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 == :text_area -%>
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 == :check_box -%>
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 == :text_area -%>
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
- <div>
2
- <div>
3
- <h1>
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
- <div>
12
- <div>
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
- <form action="/insert_<%= singular_table_name %>"<% unless skip_post? -%> method="post"<% end -%>>
14
+ <form action="/insert_<%= singular_table_name %>"<% unless skip_post? -%> method="post"<% end -%>>
18
15
  <% attributes.each do |attribute| -%>
19
- <% if attribute.field_type == :check_box -%>
20
- <div>
21
- <input type="checkbox" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" value="1">
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
- <label for="<%= attribute.column_name %>_box"><%= attribute.column_name.humanize %></label>
24
- </div>
20
+ <label for="<%= attribute.column_name %>_field"><%= attribute.column_name.humanize %></label>
21
+ </div>
25
22
 
26
23
  <% else -%>
27
- <div>
28
- <label for="<%= attribute.column_name %>_box">
29
- <%= attribute.column_name.humanize %>
30
- </label>
24
+ <div>
25
+ <label for="<%= attribute.column_name %>_field">
26
+ <%= attribute.column_name.humanize %>
27
+ </label>
31
28
 
32
- <% if attribute.field_type == :text_area -%>
33
- <textarea id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" rows="3"></textarea>
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
- <input type="datetime-local" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>">
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
- <input type="date" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>">
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
- <input type="time" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>">
40
- <% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :integer -%>
41
- <input type="number" id="<%= attribute.column_name %>_box" name="query_<%= 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">
42
39
  <% else -%>
43
- <input type="text" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>">
40
+ <input type="text" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param">
44
41
  <% end -%>
45
- </div>
42
+ </div>
46
43
 
47
44
  <% end -%>
48
45
  <% end -%>
49
- <button>
50
- Create <%= singular_table_name.humanize.downcase %>
51
- </button>
52
- </form>
53
- </div>
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
- <!-- Ransack Code end -->
61
-
62
- <!-- Location Map Code start -->
63
-
64
- <!-- Location Map Code end -->
65
-
66
- <hr>
67
-
68
- <% end -%>
69
- <div>
70
- <div>
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 == :check_box -%>
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 == :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"></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 == :check_box -%>
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 == :text_area -%>
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
- <div>
2
- <div>
3
- <h1>
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
- <div>
8
- <div>
9
- <a href="/<%= plural_table_name %>">
10
- Go back
11
- </a>
12
- </div>
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
- <div>
19
- <a href="/delete_<%= singular_table_name %>/<%%= @the_<%= singular_table_name %>.id %>">
20
- Delete <%= singular_table_name.humanize.downcase %>
21
- </a>
22
- </div>
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
- </div>
28
-
29
- <dl>
25
+ <dl>
30
26
  <% attributes.each do |attribute| -%>
31
- <dt>
32
- <%= attribute.human_name %>
33
- </dt>
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
- <dd>
38
- <%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>
39
- </dd>
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
- <dt>
46
- Created at
47
- </dt>
41
+ <dt>
42
+ Created at
43
+ </dt>
48
44
  <% if with_sentinels? -%>
49
45
  <!-- Display created_at start -->
50
46
  <% end -%>
51
- <dd>
52
- <%%= time_ago_in_words(@the_<%= singular_table_name %>.created_at) %> ago
53
- </dd>
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
- <dt>
59
- Updated at
60
- </dt>
54
+ <dt>
55
+ Updated at
56
+ </dt>
61
57
  <% if with_sentinels? -%>
62
58
  <!-- Display updated_at start -->
63
59
  <% end -%>
64
- <dd>
65
- <%%= time_ago_in_words(@the_<%= singular_table_name %>.updated_at) %> ago
66
- </dd>
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
- </dl>
71
- </div>
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
- <div>
83
- <div>
77
+ <article>
78
+ <header>
84
79
  <h2>
85
80
  Edit <%= singular_table_name.humanize.downcase %>
86
81
  </h2>
82
+ </header>
87
83
 
88
- <form action="/modify_<%= singular_table_name %>/<%%= @the_<%= singular_table_name %>.id %>" <% unless skip_post? -%> method="post" <% end -%>>
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 == :check_box -%>
91
- <div>
92
- <input type="checkbox" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" value="1" <%%= "checked" if @the_<%= singular_table_name %>.<%= attribute.column_name %> %>>
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
- <label for="<%= attribute.column_name %>_box">
95
- <%= attribute.column_name.humanize %>
96
- </label>
97
- </div>
90
+ <label for="<%= attribute.column_name %>_field">
91
+ <%= attribute.column_name.humanize %>
92
+ </label>
93
+ </div>
98
94
 
99
95
  <% else -%>
100
- <div>
101
- <label for="<%= attribute.column_name %>_box">
102
- <%= attribute.column_name.humanize %>
103
- </label>
96
+ <div>
97
+ <label for="<%= attribute.column_name %>_field">
98
+ <%= attribute.column_name.humanize %>
99
+ </label>
104
100
 
105
- <% if attribute.field_type == :text_area -%>
106
- <textarea id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>"><%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %></textarea>
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
- <input type="datetime-local" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>"
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
- <input type="date" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" value="<%%= @the_<%= singular_table_name %>.<%= 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 %> %>">
112
108
  <% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :time -%>
113
- <input type="time" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" value="<%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>">
114
- <% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :integer -%>
115
- <input type="number" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" value="<%%= @the_<%= singular_table_name %>.<%= 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 %> %>">
116
112
  <% else -%>
117
- <input type="text" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" value="<%%= @the_<%= singular_table_name %>.<%= 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 %> %>">
118
114
  <% end -%>
119
- </div>
115
+ </div>
120
116
 
121
117
  <% end -%>
122
118
  <% end -%>
123
- <button>
124
- Update <%= singular_table_name.humanize.downcase %>
125
- </button>
126
- </form>
127
- </div>
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 == :check_box -%>
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 == :check_box -%>
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
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.1.6
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: []