draft_generators 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/draft_generators.gemspec +1 -1
  4. data/lib/generators/draft/account/templates/controllers/authentication_controller.rb +12 -12
  5. data/lib/generators/draft/account/templates/views/authentication/edit_profile.html.erb +10 -10
  6. data/lib/generators/draft/account/templates/views/authentication/edit_profile_with_errors.html.erb +10 -10
  7. data/lib/generators/draft/account/templates/views/authentication/sign_in.html.erb +4 -4
  8. data/lib/generators/draft/account/templates/views/authentication/sign_up.html.erb +12 -12
  9. data/lib/generators/draft/resource/templates/controllers/controller.rb +6 -6
  10. data/lib/generators/draft/resource/templates/specs/crud_spec.rb +2 -2
  11. data/lib/generators/draft/resource/templates/views/association_new_form.html.erb +9 -9
  12. data/lib/generators/draft/resource/templates/views/create_row.html.erb +23 -10
  13. data/lib/generators/draft/resource/templates/views/destroy_row.html.erb +23 -10
  14. data/lib/generators/draft/resource/templates/views/edit_form.html.erb +44 -41
  15. data/lib/generators/draft/resource/templates/views/edit_form_with_errors.html.erb +46 -43
  16. data/lib/generators/draft/resource/templates/views/index.html.erb +30 -34
  17. data/lib/generators/draft/resource/templates/views/new_form.html.erb +44 -42
  18. data/lib/generators/draft/resource/templates/views/new_form_with_errors.html.erb +46 -44
  19. data/lib/generators/draft/resource/templates/views/show.html.erb +51 -50
  20. data/lib/generators/draft/resource/templates/views/update_row.html.erb +20 -7
  21. data/lib/generators/draft/scaffold/templates/_form.html.erb +2 -2
  22. metadata +2 -2
@@ -1,40 +1,30 @@
1
- <h1>
2
- <%= singular_table_name.humanize %> #<%%= @the_<%= singular_table_name %>.id %> details
3
- </h1>
1
+ <nav aria-label="breadcrumb">
2
+ <ul>
3
+ <li><a href="/<%= plural_table_name %>"><%= plural_table_name.humanize %></a></li>
4
+ <li><%= singular_table_name.humanize %> #<%%= @the_<%= singular_table_name %>.id %></li>
5
+ </ul>
6
+ </nav>
4
7
 
5
- <article>
6
- <div>
7
- <a href="/<%= plural_table_name %>">
8
- Go back
9
- </a>
10
- </div>
8
+ <div class="card">
9
+ <header>
10
+ <h1>
11
+ <%= singular_table_name.humanize %> #<%%= @the_<%= singular_table_name %>.id %> details
12
+ </h1>
13
+ </header>
11
14
 
12
- <% unless read_only? -%>
13
- <% if with_sentinels? -%>
14
- <!-- Delete link <%= singular_table_name %> start -->
15
- <% end -%>
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>
21
- <% if with_sentinels? -%>
22
- <!-- Delete link <%= singular_table_name %> end -->
23
- <% end -%>
24
- <% end -%>
25
15
  <dl>
26
16
  <% attributes.each do |attribute| -%>
27
17
  <dt>
28
18
  <%= attribute.human_name %>
29
19
  </dt>
30
20
  <% if with_sentinels? -%>
31
- <!-- Display the_<%= attribute.column_name %> start -->
21
+ <!-- Display the_<%= attribute.column_name %> start -->
32
22
  <% end -%>
33
23
  <dd>
34
24
  <%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>
35
25
  </dd>
36
26
  <% if with_sentinels? -%>
37
- <!-- Display the_<%= attribute.column_name %> end -->
27
+ <!-- Display the_<%= attribute.column_name %> end -->
38
28
  <% end -%>
39
29
 
40
30
  <% end -%>
@@ -42,75 +32,87 @@
42
32
  Created at
43
33
  </dt>
44
34
  <% if with_sentinels? -%>
45
- <!-- Display created_at start -->
35
+ <!-- Display created_at start -->
46
36
  <% end -%>
47
37
  <dd>
48
38
  <%%= time_ago_in_words(@the_<%= singular_table_name %>.created_at) %> ago
49
39
  </dd>
50
40
  <% if with_sentinels? -%>
51
- <!-- Display created_at end -->
41
+ <!-- Display created_at end -->
52
42
  <% end -%>
53
43
 
54
44
  <dt>
55
45
  Updated at
56
46
  </dt>
57
47
  <% if with_sentinels? -%>
58
- <!-- Display updated_at start -->
48
+ <!-- Display updated_at start -->
59
49
  <% end -%>
60
50
  <dd>
61
51
  <%%= time_ago_in_words(@the_<%= singular_table_name %>.updated_at) %> ago
62
52
  </dd>
63
53
  <% if with_sentinels? -%>
64
- <!-- Display updated_at end -->
54
+ <!-- Display updated_at end -->
65
55
  <% end -%>
66
56
  </dl>
67
- </article>
68
-
69
- <hr>
57
+ <% unless read_only? -%>
70
58
 
71
59
  <% if with_sentinels? -%>
60
+ <!-- Delete link <%= singular_table_name %> start -->
61
+ <% end -%>
62
+ <p>
63
+ <a href="/delete_<%= singular_table_name %>/<%%= @the_<%= singular_table_name %>.id %>" class="btn btn-outline">
64
+ Delete <%= singular_table_name.humanize.downcase %>
65
+ </a>
66
+ </p>
67
+ <% if with_sentinels? -%>
68
+ <!-- Delete link <%= singular_table_name %> end -->
69
+ <% end -%>
70
+ <% end -%>
71
+ </div>
72
+ <% if with_sentinels? -%>
73
+
72
74
  <!-- Show Page Customization starts -->
73
75
 
74
76
  <!-- Show Page Customization end -->
75
77
  <% end -%>
78
+ <% unless read_only? -%>
76
79
 
77
- <article>
80
+ <div class="card">
78
81
  <header>
79
82
  <h2>
80
83
  Edit <%= singular_table_name.humanize.downcase %>
81
84
  </h2>
82
85
  </header>
83
86
 
84
- <form action="/modify_<%= singular_table_name %>/<%%= @the_<%= singular_table_name %>.id %>" <% unless skip_post? -%> method="post" <% end -%>>
87
+ <form action="/modify_<%= singular_table_name %>/<%%= @the_<%= singular_table_name %>.id %>"<% unless skip_post? -%> method="post"<% end -%>>
85
88
  <% attributes.each do |attribute| -%>
86
- <% if attribute.field_type == :check_box -%>
89
+ <% if [:check_box, :checkbox].include?(attribute.field_type) -%>
87
90
  <div>
88
- <input type="checkbox" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" value="1" <%%= "checked" if @the_<%= singular_table_name %>.<%= attribute.column_name %> %>>
91
+ <input type="checkbox" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" value="1" <%%= "checked" if @the_<%= singular_table_name %>.<%= attribute.column_name %> %>>
89
92
 
90
- <label for="<%= attribute.column_name %>_box">
91
- <%= attribute.column_name.humanize %>
93
+ <label for="<%= attribute.column_name %>_field">
94
+ <%= attribute.column_name.humanize %>
92
95
  </label>
93
96
  </div>
94
97
 
95
98
  <% else -%>
96
99
  <div>
97
- <label for="<%= attribute.column_name %>_box">
100
+ <label for="<%= attribute.column_name %>_field">
98
101
  <%= attribute.column_name.humanize %>
99
102
  </label>
100
103
 
101
- <% if attribute.field_type == :text_area -%>
102
- <textarea id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>"><%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %></textarea>
104
+ <% if [:text_area, :textarea].include?(attribute.field_type) -%>
105
+ <textarea id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param"><%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %></textarea>
103
106
  <% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :datetime -%>
104
- <input type="datetime-local" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>"
105
- value="<%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>">
107
+ <input type="datetime-local" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" value="<%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>">
106
108
  <% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :date -%>
107
- <input type="date" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" value="<%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>">
109
+ <input type="date" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" value="<%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>">
108
110
  <% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :time -%>
109
- <input type="time" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" value="<%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>">
110
- <% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :integer -%>
111
- <input type="number" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" value="<%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>">
111
+ <input type="time" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" value="<%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>">
112
+ <% elsif attribute.field_type.to_s.gsub(/_.*/, "").to_sym == :number -%>
113
+ <input type="number" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" value="<%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>">
112
114
  <% else -%>
113
- <input type="text" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" value="<%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>">
115
+ <input type="text" id="<%= attribute.column_name %>_field" name="<%= attribute.column_name %>_param" value="<%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>">
114
116
  <% end -%>
115
117
  </div>
116
118
 
@@ -120,6 +122,5 @@
120
122
  Update <%= singular_table_name.humanize.downcase %>
121
123
  </button>
122
124
  </form>
123
- </article>
124
-
125
- <hr>
125
+ </div>
126
+ <% end -%>
@@ -1,9 +1,22 @@
1
- <h1>You updated <%= singular_table_name.humanize.downcase %> #<%%= @<%= singular_table_name %>.id %>!</h1>
1
+ <nav aria-label="breadcrumb">
2
+ <ul>
3
+ <li><a href="/<%= plural_table_name.underscore %>"><%= plural_table_name.humanize %></a></li>
4
+ <li><%= singular_table_name.humanize %> #<%%= @<%= singular_table_name %>.id %></li>
5
+ </ul>
6
+ </nav>
2
7
 
3
- <p>
4
- <a href="/<%= plural_table_name.underscore %>/<%%= @<%= singular_table_name.underscore %>.id %>">
5
- Click here
6
- </a>
8
+ <div class="card">
9
+ <header>
10
+ <h1>
11
+ You updated <%= singular_table_name.humanize.downcase %> #<%%= @<%= singular_table_name %>.id %>!
12
+ </h1>
13
+ </header>
7
14
 
8
- to check it out.
9
- </p>
15
+ <p>
16
+ <a href="/<%= plural_table_name.underscore %>/<%%= @<%= singular_table_name.underscore %>.id %>">
17
+ Click here
18
+ </a>
19
+
20
+ to check it out.
21
+ </p>
22
+ </div>
@@ -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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: draft_generators
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raghu Betina
@@ -207,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
209
209
  requirements: []
210
- rubygems_version: 3.6.5
210
+ rubygems_version: 3.6.9
211
211
  specification_version: 4
212
212
  summary: Generators that help beginners learn to program.
213
213
  test_files: []