draft_generators 0.0.3 → 0.0.4

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 (27) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/VERSION +1 -1
  4. data/draft_generators.gemspec +21 -20
  5. data/lib/draft_generators.rb +1 -0
  6. data/lib/generators/draft/account/account_generator.rb +189 -0
  7. data/lib/generators/draft/account/templates/controllers/authentication_controller.rb +96 -0
  8. data/lib/generators/draft/account/templates/views/authentication/edit_profile.html.erb +38 -0
  9. data/lib/generators/draft/account/templates/views/authentication/edit_profile_with_errors.html.erb +44 -0
  10. data/lib/generators/draft/account/templates/views/authentication/sign_in.html.erb +23 -0
  11. data/lib/generators/draft/account/templates/views/authentication/sign_up.html.erb +43 -0
  12. data/lib/generators/draft/layout/layout_generator.rb +3 -3
  13. data/lib/generators/draft/layout/templates/_cdn_assets.html.erb +13 -0
  14. data/lib/generators/draft/layout/templates/_navbar.html.erb +1 -1
  15. data/lib/generators/draft/layout/templates/layout.html.erb +13 -12
  16. data/lib/generators/draft/resource/resource_generator.rb +19 -17
  17. data/lib/generators/draft/resource/templates/controllers/controller.rb +45 -44
  18. data/lib/generators/draft/resource/templates/controllers/read_only_controller.rb +2 -2
  19. data/lib/generators/draft/resource/templates/views/association_new_form.html.erb +6 -6
  20. data/lib/generators/draft/resource/templates/views/edit_form.html.erb +7 -7
  21. data/lib/generators/draft/resource/templates/views/edit_form_with_errors.html.erb +8 -8
  22. data/lib/generators/draft/resource/templates/views/index.html.erb +69 -23
  23. data/lib/generators/draft/resource/templates/views/new_form.html.erb +7 -7
  24. data/lib/generators/draft/resource/templates/views/new_form_with_errors.html.erb +8 -8
  25. data/lib/generators/draft/resource/templates/views/show.html.erb +65 -25
  26. metadata +24 -5
  27. data/lib/generators/draft/layout/templates/_bootstrapcdn_assets.html.erb +0 -10
@@ -3,7 +3,7 @@
3
3
  <%% if @<%= singular_table_name %>.present? %>
4
4
  <%% if @<%= singular_table_name %>.errors.any? %>
5
5
  <%% @<%= singular_table_name %>.errors.full_messages.each do |message| %>
6
- <div class="alert alert-danger">
6
+ <div>
7
7
  <%%= message %>
8
8
  </div>
9
9
  <%% end %>
@@ -31,21 +31,21 @@
31
31
  <!-- Label and input for <%= attribute.column_name %> start -->
32
32
  <% end -%>
33
33
  <% if attribute.field_type == :check_box -%>
34
- <div class="form-check">
34
+ <div>
35
35
  <input type="hidden" value="0" name="<%= attribute.column_name %>">
36
36
  <% if with_sentinels? -%>
37
37
  <!-- Input for <%= attribute.column_name %> start -->
38
38
  <% end -%>
39
- <input id="<%= attribute.column_name %>" class="form-check-input" 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 %>" name="<%= attribute.column_name %>" 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 %>" class="form-check-label">
43
+ <label for="<%= attribute.column_name %>">
44
44
  <%= attribute.column_name.humanize %>
45
45
  </label>
46
46
  </div>
47
47
  <% else -%>
48
- <div class="form-group">
48
+ <div>
49
49
  <label for="<%= attribute.column_name %>">
50
50
  <%= attribute.column_name.humanize %>
51
51
  </label>
@@ -54,7 +54,7 @@
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 %>" class="form-control" rows="3"><% unless skip_validation_alerts? -%><%%= @<%= singular_table_name %>.<%= attribute.column_name %> %><% end -%></textarea>
57
+ <textarea id="<%= attribute.column_name %>" name="<%= attribute.column_name %>" 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 %>" class="form-control"<% unless skip_validation_alerts? -%> value="<%%= @<%= singular_table_name %>.<%= attribute.column_name %> %>"<% 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 -%>>
66
66
  <% if with_sentinels? -%>
67
67
  <!-- Input for <%= attribute.column_name %> end -->
68
68
  <% end -%>
@@ -74,7 +74,7 @@
74
74
  <% end -%>
75
75
 
76
76
  <% end -%>
77
- <button class="btn btn-block btn-outline-secondary">
77
+ <button>
78
78
  Create <%= singular_table_name.humanize.downcase %>
79
79
  </button>
80
80
  </form>
@@ -1,34 +1,22 @@
1
- <div class="row mb-3">
2
- <div class="col-md-8 offset-md-2">
1
+ <div>
2
+ <div>
3
3
  <h1>
4
- <%= singular_table_name.humanize %> #<%%= @<%= singular_table_name %>.id %> details
4
+ <%= singular_table_name.humanize %> #<%%= @the_<%= singular_table_name %>.id %> details
5
5
  </h1>
6
6
 
7
- <div class="row mb-3">
8
- <div class="col">
9
- <a href="/<%= plural_table_name %>" class="btn btn-block btn-outline-secondary">
7
+ <div>
8
+ <div>
9
+ <a href="/<%= plural_table_name %>">
10
10
  Go back
11
11
  </a>
12
12
  </div>
13
13
 
14
- <% if with_sentinels? -%>
15
- <!-- Edit link <%= singular_table_name %> start -->
16
- <% end -%>
17
- <div class="col">
18
- <a href="/<%= plural_table_name %>/<%%= @<%= singular_table_name %>.id %>/edit" class="btn btn-block btn-outline-secondary">
19
- Edit <%= singular_table_name.humanize.downcase %>
20
- </a>
21
- </div>
22
- <% if with_sentinels? -%>
23
- <!-- Edit link <%= singular_table_name %> end -->
24
- <% end -%>
25
-
26
14
  <% unless read_only? -%>
27
15
  <% if with_sentinels? -%>
28
16
  <!-- Delete link <%= singular_table_name %> start -->
29
17
  <% end -%>
30
- <div class="col">
31
- <a href="/delete_<%= singular_table_name %>/<%%= @<%= singular_table_name %>.id %>" class="btn btn-block btn-outline-secondary">
18
+ <div>
19
+ <a href="/delete_<%= singular_table_name %>/<%%= @the_<%= singular_table_name %>.id %>">
32
20
  Delete <%= singular_table_name.humanize.downcase %>
33
21
  </a>
34
22
  </div>
@@ -44,13 +32,13 @@
44
32
  <%= attribute.human_name %>
45
33
  </dt>
46
34
  <% if with_sentinels? -%>
47
- <!-- Display <%= attribute.column_name %> start -->
35
+ <!-- Display the_<%= attribute.column_name %> start -->
48
36
  <% end -%>
49
37
  <dd>
50
- <%%= @<%= singular_table_name %>.<%= attribute.column_name %> %>
38
+ <%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>
51
39
  </dd>
52
40
  <% if with_sentinels? -%>
53
- <!-- Display <%= attribute.column_name %> end -->
41
+ <!-- Display the_<%= attribute.column_name %> end -->
54
42
  <% end -%>
55
43
 
56
44
  <% end -%>
@@ -61,7 +49,7 @@
61
49
  <!-- Display created_at start -->
62
50
  <% end -%>
63
51
  <dd>
64
- <%%= time_ago_in_words(@<%= singular_table_name %>.created_at) %> ago
52
+ <%%= time_ago_in_words(@the_<%= singular_table_name %>.created_at) %> ago
65
53
  </dd>
66
54
  <% if with_sentinels? -%>
67
55
  <!-- Display created_at end -->
@@ -74,7 +62,7 @@
74
62
  <!-- Display updated_at start -->
75
63
  <% end -%>
76
64
  <dd>
77
- <%%= time_ago_in_words(@<%= singular_table_name %>.updated_at) %> ago
65
+ <%%= time_ago_in_words(@the_<%= singular_table_name %>.updated_at) %> ago
78
66
  </dd>
79
67
  <% if with_sentinels? -%>
80
68
  <!-- Display updated_at end -->
@@ -83,8 +71,60 @@
83
71
  </div>
84
72
  </div>
85
73
 
74
+ <hr>
75
+
86
76
  <% if with_sentinels? -%>
87
77
  <!-- Show Page Customization starts -->
88
78
 
89
79
  <!-- Show Page Customization end -->
90
80
  <% end -%>
81
+
82
+ <div>
83
+ <div>
84
+ <h2>
85
+ Edit <%= singular_table_name.humanize.downcase %>
86
+ </h2>
87
+
88
+ <form action="/modify_<%= singular_table_name %>/<%%= @the_<%= singular_table_name %>.id %>" <% unless skip_post? -%> method="post" <% end -%>>
89
+ <% 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 %> %>>
93
+
94
+ <label for="<%= attribute.column_name %>_box">
95
+ <%= attribute.column_name.humanize %>
96
+ </label>
97
+ </div>
98
+
99
+ <% else -%>
100
+ <div>
101
+ <label for="<%= attribute.column_name %>_box">
102
+ <%= attribute.column_name.humanize %>
103
+ </label>
104
+
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>
107
+ <% 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 %>"
109
+ value="<%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>">
110
+ <% 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 %> %>">
112
+ <% 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 %> %>">
116
+ <% else -%>
117
+ <input type="text" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" value="<%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>">
118
+ <% end -%>
119
+ </div>
120
+
121
+ <% end -%>
122
+ <% end -%>
123
+ <button>
124
+ Update <%= singular_table_name.humanize.downcase %>
125
+ </button>
126
+ </form>
127
+ </div>
128
+ </div>
129
+
130
+ <hr>
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: draft_generators
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raghu Betina
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-01 00:00:00.000000000 Z
11
+ date: 2023-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: indefinite_article
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: devise
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -117,6 +131,12 @@ files:
117
131
  - draft_generators.gemspec
118
132
  - lib/devise_customization_service.rb
119
133
  - lib/draft_generators.rb
134
+ - lib/generators/draft/account/account_generator.rb
135
+ - lib/generators/draft/account/templates/controllers/authentication_controller.rb
136
+ - lib/generators/draft/account/templates/views/authentication/edit_profile.html.erb
137
+ - lib/generators/draft/account/templates/views/authentication/edit_profile_with_errors.html.erb
138
+ - lib/generators/draft/account/templates/views/authentication/sign_in.html.erb
139
+ - lib/generators/draft/account/templates/views/authentication/sign_up.html.erb
120
140
  - lib/generators/draft/devise/devise_generator.rb
121
141
  - lib/generators/draft/devise/views/templates/confirmations/new.html.erb
122
142
  - lib/generators/draft/devise/views/templates/mailer/confirmation_instructions.html.erb
@@ -136,7 +156,7 @@ files:
136
156
  - lib/generators/draft/devise/views/views_generator.rb
137
157
  - lib/generators/draft/layout/USAGE
138
158
  - lib/generators/draft/layout/layout_generator.rb
139
- - lib/generators/draft/layout/templates/_bootstrapcdn_assets.html.erb
159
+ - lib/generators/draft/layout/templates/_cdn_assets.html.erb
140
160
  - lib/generators/draft/layout/templates/_flashes.html.erb
141
161
  - lib/generators/draft/layout/templates/_navbar.html.erb
142
162
  - lib/generators/draft/layout/templates/layout.html.erb
@@ -189,8 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
209
  - !ruby/object:Gem::Version
190
210
  version: '0'
191
211
  requirements: []
192
- rubyforge_project:
193
- rubygems_version: 2.7.8
212
+ rubygems_version: 3.1.6
194
213
  signing_key:
195
214
  specification_version: 4
196
215
  summary: Generators that help beginners learn to program.
@@ -1,10 +0,0 @@
1
- <% if bootswatch? -%>
2
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootswatch/4.0.0-beta.3/<%= theme_name %>/bootstrap.min.css">
3
- <% else -%>
4
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
5
- <% end -%>
6
- <link rel="stylesheet"href="https://use.fontawesome.com/releases/v5.0.6/css/all.css" >
7
-
8
- <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
9
- <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
10
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>