draft_generators 0.0.3 → 0.0.5
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/Gemfile +1 -0
- data/VERSION +1 -1
- data/draft_generators.gemspec +21 -20
- data/lib/draft_generators.rb +1 -0
- data/lib/generators/draft/account/account_generator.rb +189 -0
- data/lib/generators/draft/account/templates/controllers/authentication_controller.rb +96 -0
- data/lib/generators/draft/account/templates/views/authentication/edit_profile.html.erb +38 -0
- data/lib/generators/draft/account/templates/views/authentication/edit_profile_with_errors.html.erb +44 -0
- data/lib/generators/draft/account/templates/views/authentication/sign_in.html.erb +23 -0
- data/lib/generators/draft/account/templates/views/authentication/sign_up.html.erb +43 -0
- data/lib/generators/draft/layout/layout_generator.rb +3 -3
- data/lib/generators/draft/layout/templates/_cdn_assets.html.erb +13 -0
- data/lib/generators/draft/layout/templates/_navbar.html.erb +1 -1
- data/lib/generators/draft/layout/templates/layout.html.erb +13 -12
- data/lib/generators/draft/resource/resource_generator.rb +14 -12
- data/lib/generators/draft/resource/templates/controllers/controller.rb +45 -44
- data/lib/generators/draft/resource/templates/controllers/read_only_controller.rb +2 -2
- data/lib/generators/draft/resource/templates/views/association_new_form.html.erb +6 -6
- data/lib/generators/draft/resource/templates/views/edit_form.html.erb +7 -7
- 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 +54 -90
- data/lib/generators/draft/resource/templates/views/new_form.html.erb +7 -7
- 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 +89 -54
- metadata +24 -8
- 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
|
|
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
|
|
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 %>"
|
|
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 %>"
|
|
43
|
+
<label for="<%= attribute.column_name %>">
|
|
44
44
|
<%= attribute.column_name.humanize %>
|
|
45
45
|
</label>
|
|
46
46
|
</div>
|
|
47
47
|
<% else -%>
|
|
48
|
-
<div
|
|
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 %>"
|
|
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 %>"
|
|
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
|
|
77
|
+
<button>
|
|
78
78
|
Create <%= singular_table_name.humanize.downcase %>
|
|
79
79
|
</button>
|
|
80
80
|
</form>
|
|
@@ -1,90 +1,125 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
<%= singular_table_name.humanize %> #<%%= @<%= 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
|
-
|
|
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 -%>
|
|
5
|
+
<article>
|
|
6
|
+
<div>
|
|
7
|
+
<a href="/<%= plural_table_name %>">
|
|
8
|
+
Go back
|
|
9
|
+
</a>
|
|
10
|
+
</div>
|
|
25
11
|
|
|
26
12
|
<% unless read_only? -%>
|
|
27
13
|
<% if with_sentinels? -%>
|
|
28
14
|
<!-- Delete link <%= singular_table_name %> start -->
|
|
29
15
|
<% end -%>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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>
|
|
35
21
|
<% if with_sentinels? -%>
|
|
36
22
|
<!-- Delete link <%= singular_table_name %> end -->
|
|
37
23
|
<% end -%>
|
|
38
24
|
<% end -%>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<dl>
|
|
25
|
+
<dl>
|
|
42
26
|
<% attributes.each do |attribute| -%>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
27
|
+
<dt>
|
|
28
|
+
<%= attribute.human_name %>
|
|
29
|
+
</dt>
|
|
46
30
|
<% if with_sentinels? -%>
|
|
47
|
-
<!-- Display <%= attribute.column_name %> start -->
|
|
31
|
+
<!-- Display the_<%= attribute.column_name %> start -->
|
|
48
32
|
<% end -%>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
33
|
+
<dd>
|
|
34
|
+
<%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>
|
|
35
|
+
</dd>
|
|
52
36
|
<% if with_sentinels? -%>
|
|
53
|
-
<!-- Display <%= attribute.column_name %> end -->
|
|
37
|
+
<!-- Display the_<%= attribute.column_name %> end -->
|
|
54
38
|
<% end -%>
|
|
55
39
|
|
|
56
40
|
<% end -%>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
41
|
+
<dt>
|
|
42
|
+
Created at
|
|
43
|
+
</dt>
|
|
60
44
|
<% if with_sentinels? -%>
|
|
61
45
|
<!-- Display created_at start -->
|
|
62
46
|
<% end -%>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
47
|
+
<dd>
|
|
48
|
+
<%%= time_ago_in_words(@the_<%= singular_table_name %>.created_at) %> ago
|
|
49
|
+
</dd>
|
|
66
50
|
<% if with_sentinels? -%>
|
|
67
51
|
<!-- Display created_at end -->
|
|
68
52
|
<% end -%>
|
|
69
53
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
54
|
+
<dt>
|
|
55
|
+
Updated at
|
|
56
|
+
</dt>
|
|
73
57
|
<% if with_sentinels? -%>
|
|
74
58
|
<!-- Display updated_at start -->
|
|
75
59
|
<% end -%>
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
60
|
+
<dd>
|
|
61
|
+
<%%= time_ago_in_words(@the_<%= singular_table_name %>.updated_at) %> ago
|
|
62
|
+
</dd>
|
|
79
63
|
<% if with_sentinels? -%>
|
|
80
64
|
<!-- Display updated_at end -->
|
|
81
65
|
<% end -%>
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
66
|
+
</dl>
|
|
67
|
+
</article>
|
|
68
|
+
|
|
69
|
+
<hr>
|
|
85
70
|
|
|
86
71
|
<% if with_sentinels? -%>
|
|
87
72
|
<!-- Show Page Customization starts -->
|
|
88
73
|
|
|
89
74
|
<!-- Show Page Customization end -->
|
|
90
75
|
<% end -%>
|
|
76
|
+
|
|
77
|
+
<article>
|
|
78
|
+
<header>
|
|
79
|
+
<h2>
|
|
80
|
+
Edit <%= singular_table_name.humanize.downcase %>
|
|
81
|
+
</h2>
|
|
82
|
+
</header>
|
|
83
|
+
|
|
84
|
+
<form action="/modify_<%= singular_table_name %>/<%%= @the_<%= singular_table_name %>.id %>" <% unless skip_post? -%> method="post" <% end -%>>
|
|
85
|
+
<% attributes.each do |attribute| -%>
|
|
86
|
+
<% if attribute.field_type == :check_box -%>
|
|
87
|
+
<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 %> %>>
|
|
89
|
+
|
|
90
|
+
<label for="<%= attribute.column_name %>_box">
|
|
91
|
+
<%= attribute.column_name.humanize %>
|
|
92
|
+
</label>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<% else -%>
|
|
96
|
+
<div>
|
|
97
|
+
<label for="<%= attribute.column_name %>_box">
|
|
98
|
+
<%= attribute.column_name.humanize %>
|
|
99
|
+
</label>
|
|
100
|
+
|
|
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>
|
|
103
|
+
<% 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 %> %>">
|
|
106
|
+
<% 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 %> %>">
|
|
108
|
+
<% 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 %> %>">
|
|
112
|
+
<% else -%>
|
|
113
|
+
<input type="text" id="<%= attribute.column_name %>_box" name="query_<%= attribute.column_name %>" value="<%%= @the_<%= singular_table_name %>.<%= attribute.column_name %> %>">
|
|
114
|
+
<% end -%>
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
<% end -%>
|
|
118
|
+
<% end -%>
|
|
119
|
+
<button type="submit">
|
|
120
|
+
Update <%= singular_table_name.humanize.downcase %>
|
|
121
|
+
</button>
|
|
122
|
+
</form>
|
|
123
|
+
</article>
|
|
124
|
+
|
|
125
|
+
<hr>
|
metadata
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
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.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Raghu Betina
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 2023-05-30 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: indefinite_article
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '0'
|
|
13
26
|
- !ruby/object:Gem::Dependency
|
|
14
27
|
name: devise
|
|
15
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -117,6 +130,12 @@ files:
|
|
|
117
130
|
- draft_generators.gemspec
|
|
118
131
|
- lib/devise_customization_service.rb
|
|
119
132
|
- lib/draft_generators.rb
|
|
133
|
+
- lib/generators/draft/account/account_generator.rb
|
|
134
|
+
- lib/generators/draft/account/templates/controllers/authentication_controller.rb
|
|
135
|
+
- lib/generators/draft/account/templates/views/authentication/edit_profile.html.erb
|
|
136
|
+
- lib/generators/draft/account/templates/views/authentication/edit_profile_with_errors.html.erb
|
|
137
|
+
- lib/generators/draft/account/templates/views/authentication/sign_in.html.erb
|
|
138
|
+
- lib/generators/draft/account/templates/views/authentication/sign_up.html.erb
|
|
120
139
|
- lib/generators/draft/devise/devise_generator.rb
|
|
121
140
|
- lib/generators/draft/devise/views/templates/confirmations/new.html.erb
|
|
122
141
|
- lib/generators/draft/devise/views/templates/mailer/confirmation_instructions.html.erb
|
|
@@ -136,7 +155,7 @@ files:
|
|
|
136
155
|
- lib/generators/draft/devise/views/views_generator.rb
|
|
137
156
|
- lib/generators/draft/layout/USAGE
|
|
138
157
|
- lib/generators/draft/layout/layout_generator.rb
|
|
139
|
-
- lib/generators/draft/layout/templates/
|
|
158
|
+
- lib/generators/draft/layout/templates/_cdn_assets.html.erb
|
|
140
159
|
- lib/generators/draft/layout/templates/_flashes.html.erb
|
|
141
160
|
- lib/generators/draft/layout/templates/_navbar.html.erb
|
|
142
161
|
- lib/generators/draft/layout/templates/layout.html.erb
|
|
@@ -174,7 +193,6 @@ homepage: http://github.com/raghubetina/draft_generators
|
|
|
174
193
|
licenses:
|
|
175
194
|
- MIT
|
|
176
195
|
metadata: {}
|
|
177
|
-
post_install_message:
|
|
178
196
|
rdoc_options: []
|
|
179
197
|
require_paths:
|
|
180
198
|
- lib
|
|
@@ -189,9 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
189
207
|
- !ruby/object:Gem::Version
|
|
190
208
|
version: '0'
|
|
191
209
|
requirements: []
|
|
192
|
-
|
|
193
|
-
rubygems_version: 2.7.8
|
|
194
|
-
signing_key:
|
|
210
|
+
rubygems_version: 3.6.5
|
|
195
211
|
specification_version: 4
|
|
196
212
|
summary: Generators that help beginners learn to program.
|
|
197
213
|
test_files: []
|
|
@@ -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>
|