rails_app_generator 0.2.20 → 0.2.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/.builders/generators/project-plan.rb +19 -5
  3. data/CHANGELOG.md +22 -0
  4. data/after_templates/addons/annotate/_.rb +27 -0
  5. data/after_templates/addons/annotate/app/controllers/home_controller.rb +4 -0
  6. data/after_templates/addons/annotate/app/views/home/index.html.erb +20 -0
  7. data/after_templates/addons/annotate/app/views/layouts/_footer.html.erb +3 -0
  8. data/after_templates/addons/annotate/app/views/layouts/_navbar.html.erb +5 -0
  9. data/after_templates/addons/annotate/app/views/layouts/application.html.erb +23 -0
  10. data/after_templates/addons/avo/_.rb +54 -0
  11. data/after_templates/addons/avo/app/controllers/home_controller.rb +4 -0
  12. data/after_templates/addons/avo/app/views/home/index.html.erb +3 -0
  13. data/after_templates/addons/avo/app/views/layouts/_footer.html.erb +3 -0
  14. data/after_templates/addons/avo/app/views/layouts/_navbar.html.erb +8 -0
  15. data/after_templates/addons/avo/app/views/layouts/application.html.erb +23 -0
  16. data/after_templates/addons/avo/db/seeds.rb +132 -0
  17. data/after_templates/addons/devise/_.rb +70 -0
  18. data/after_templates/addons/devise/app/controllers/home_controller.rb +4 -0
  19. data/after_templates/addons/devise/app/controllers/posts_controller.rb +81 -0
  20. data/after_templates/addons/devise/app/models/post.rb +11 -0
  21. data/after_templates/addons/devise/app/models/user.rb +17 -0
  22. data/after_templates/addons/devise/app/views/home/index.html.erb +40 -0
  23. data/after_templates/addons/devise/app/views/layouts/_footer.html.erb +1 -0
  24. data/after_templates/addons/devise/app/views/layouts/_navbar.html.erb +10 -0
  25. data/after_templates/addons/devise/app/views/layouts/application.html.erb +38 -0
  26. data/after_templates/addons/devise/app/views/posts/_form.html.erb +27 -0
  27. data/after_templates/addons/devise/app/views/posts/_post.html.erb +14 -0
  28. data/after_templates/addons/devise/app/views/posts/index.html.erb +12 -0
  29. data/after_templates/addons/devise/app/views/posts/show.html.erb +8 -0
  30. data/after_templates/addons/devise/db/seeds.rb +11 -0
  31. data/after_templates/rag/devise/_.rb +14 -17
  32. data/after_templates/rag/devise/app/controllers/home_controller.rb +4 -0
  33. data/after_templates/rag/devise/{post → app/controllers}/posts_controller.rb +0 -0
  34. data/after_templates/rag/devise/{post → app/models}/post.rb +0 -0
  35. data/after_templates/rag/devise/app/views/home/index.html.erb +3 -0
  36. data/after_templates/rag/devise/app/views/layouts/_footer.html.erb +3 -0
  37. data/after_templates/rag/devise/app/views/layouts/_navbar.html.erb +8 -0
  38. data/after_templates/rag/devise/app/views/layouts/application.html.erb +24 -0
  39. data/after_templates/rag/devise/{post → app/views/post}/_post.html.erb +0 -0
  40. data/after_templates/rag/test/_.rb +64 -0
  41. data/after_templates/rag/test/app/controllers/home_controller.rb +4 -0
  42. data/after_templates/rag/test/app/views/home/index.html.erb +3 -0
  43. data/after_templates/rag/test/app/views/layouts/_footer.html.erb +1 -0
  44. data/after_templates/rag/test/app/views/layouts/_navbar.html.erb +5 -0
  45. data/after_templates/rag/test/app/views/layouts/application.html.erb +29 -0
  46. data/after_templates/rag/test/db/seeds.rb +7 -0
  47. data/after_templates/rag/testy/_.rb +64 -0
  48. data/after_templates/rag/testy/app/controllers/home_controller.rb +4 -0
  49. data/after_templates/rag/testy/app/views/home/index.html.erb +3 -0
  50. data/after_templates/rag/testy/app/views/layouts/_footer.html.erb +1 -0
  51. data/after_templates/rag/testy/app/views/layouts/_navbar.html.erb +5 -0
  52. data/after_templates/rag/testy/app/views/layouts/application.html.erb +29 -0
  53. data/after_templates/rag/testy/db/seeds.rb +7 -0
  54. data/docs/last_run/app_generator_class.json +42 -34
  55. data/docs/last_run/app_generator_data.json +11 -10
  56. data/docs/last_run/rails_options_class.json +32 -24
  57. data/docs/last_run/rails_options_data.json +11 -10
  58. data/docs/project-plan/project.drawio +65 -59
  59. data/docs/project-plan/project_done.svg +1 -1
  60. data/lib/rails_app_generator/addon.rb +20 -2
  61. data/lib/rails_app_generator/addons/avo.rb +27 -0
  62. data/lib/rails_app_generator/addons/devise.rb +78 -28
  63. data/lib/rails_app_generator/addons/devise_old.rb +22 -0
  64. data/lib/rails_app_generator/app_generator.rb +40 -22
  65. data/lib/rails_app_generator/gem_query.rb +34 -0
  66. data/lib/rails_app_generator/rag_initializer.rb +22 -8
  67. data/lib/rails_app_generator/version.rb +1 -1
  68. data/lib/rails_app_generator.rb +1 -0
  69. data/package-lock.json +2 -2
  70. data/package.json +1 -1
  71. data/profiles/addons/annotate.json +12 -0
  72. data/profiles/addons/avo.json +16 -0
  73. data/profiles/addons/devise.json +16 -0
  74. data/profiles/addons/{rails-html-sanitizer.json → rails_html_sanitizer.json} +0 -0
  75. data/profiles/rag/testy.json +12 -0
  76. data/tasks/addon.thor +7 -3
  77. data/tasks/profile.thor +3 -3
  78. data/templates/Gemfile.erb +1 -0
  79. data/{after_templates/rag/devise/turbo_controller.rb → templates/addons/devise/app/controllers/turbo_devise_controller.rb} +4 -10
  80. data/templates/addons/devise/app/controllers/users/registrations_controller.rb +62 -0
  81. data/templates/addons/devise/app/views/devise/registrations/edit.html.erb +40 -54
  82. data/templates/addons/devise/app/views/devise/registrations/new.html.erb +32 -43
  83. data/templates/addons/devise/app/views/layouts/_alerts.html.erb +2 -0
  84. data/{after_templates/rag → templates/addons}/devise/config/initializers/devise_turbo.rb +1 -1
  85. data/templates/thor_task/profile/after_template.rb +3 -2
  86. data/templates/thor_task/profile/app/views/layouts/_footer.html.erb.tt +1 -3
  87. data/templates/thor_task/profile/app/views/layouts/_navbar.html.erb +5 -8
  88. data/templates/thor_task/profile/app/views/layouts/application.html.erb.tt +8 -2
  89. data/templates/thor_task/profile/db/seeds.rb +2 -11
  90. metadata +63 -18
  91. data/after_templates/rag/devise/application.html.erb +0 -20
  92. data/tasks/gem_info.rb +0 -47
  93. data/templates/addons/devise/app/views/devise/confirmations/new.html.erb +0 -24
  94. data/templates/addons/devise/app/views/devise/passwords/edit.html.erb +0 -34
  95. data/templates/addons/devise/app/views/devise/passwords/new.html.erb +0 -23
  96. data/templates/addons/devise/app/views/devise/sessions/new.html.erb +0 -33
  97. data/templates/addons/devise/app/views/devise/shared/_error_messages.html.erb +0 -15
  98. data/templates/addons/devise/app/views/devise/shared/_form_wrap.html.erb +0 -5
  99. data/templates/addons/devise/app/views/devise/shared/_links.html.erb +0 -25
  100. data/templates/addons/devise/app/views/devise/unlocks/new.html.erb +0 -22
@@ -86,17 +86,12 @@ KConfig.configure do |config|
86
86
 
87
87
  # rag.add_option :add_irbrc , type: :boolean, default: false
88
88
  # rag.add_option :add_foreman , type: :boolean, default: false
89
- rag.add_option :add_devise , type: :boolean, default: false
90
- rag.add_option :add_dotenv , type: :boolean, default: false
91
89
  # rag.add_option :add_docker , type: :boolean, default: false
92
90
  # rag.add_option :add_docker_compose , type: :boolean, default: false
93
- rag.add_option :add_rubocop , type: :boolean, default: false
94
- rag.add_option :add_annotate , type: :boolean, default: false
95
91
  # rag.add_option :add_continuous_integration , type: :boolean, default: false
96
92
  # rag.add_option :add_high_voltage , type: :boolean, default: false
97
93
  # rag.add_option :add_generators , type: :boolean, default: false
98
- rag.add_option :add_lograge , type: :boolean, default: false
99
- # rag.add_option :add_pundit , type: :boolean, default: false
94
+ # rag.add_option :add_pundit , type: :boolean, default: false # cancancan vs action_policy vs pundit
100
95
  # rag.add_option :add_services , type: :boolean, default: false
101
96
  # rag.add_option :add_sidekiq , type: :boolean, default: false
102
97
  # rag.add_option :add_views , type: :boolean, default: false
@@ -104,24 +99,43 @@ KConfig.configure do |config|
104
99
  # rag.add_option :add_scaffold , type: :boolean, default: false
105
100
  # rag.add_option :add_factory_bot , type: :boolean, default: false
106
101
  # rag.add_option :add_shoulda , type: :boolean, default: false
102
+ # letter_opener
107
103
 
108
104
  # NEW GEM ADDONS
109
105
  rag.add_option :add_acts_as_list , type: :boolean, default: false
110
106
  rag.add_option :add_administrate , type: :boolean, default: false
111
- rag.add_option :add_browser , type: :boolean, default: false
107
+ rag.add_option :add_annotate , type: :boolean, default: false
108
+ rag.add_option :add_avo , type: :boolean, default: false
112
109
  rag.add_option :add_bcrypt , type: :boolean, default: false
110
+ rag.add_option :add_browser , type: :boolean, default: false
113
111
  rag.add_option :add_chartkick , type: :boolean, default: false
112
+ # continuous_integration
113
+ rag.add_option :add_devise , type: :boolean, default: false
114
+ # docker_compose
115
+ # docker
116
+ rag.add_option :add_dotenv , type: :boolean, default: false
117
+ # factory_bot
114
118
  rag.add_option :add_faker , type: :boolean, default: false
119
+ # generators
115
120
  rag.add_option :add_groupdate , type: :boolean, default: false
116
121
  rag.add_option :add_hexapdf , type: :boolean, default: false
117
122
  rag.add_option :add_httparty , type: :boolean, default: false
123
+ # high_voltage
118
124
  rag.add_option :add_honeybadger , type: :boolean, default: false
125
+ rag.add_option :add_lograge , type: :boolean, default: false
119
126
  rag.add_option :add_mini_magick , type: :boolean, default: false
120
127
  rag.add_option :add_motor_admin , type: :boolean, default: false
121
- rag.add_option :add_phony_rails , type: :boolean, default: false
122
128
  rag.add_option :add_public_suffix , type: :boolean, default: false
129
+ rag.add_option :add_phony_rails , type: :boolean, default: false
130
+ # pundit
123
131
  rag.add_option :add_rails_html_sanitizer , type: :boolean, default: false
132
+ # rails_app_generator
133
+ # RANSACK
124
134
  rag.add_option :add_redcarpet , type: :boolean, default: false
135
+ # services
136
+ # shoulda
137
+ # sidekiq
138
+ rag.add_option :add_rubocop , type: :boolean, default: false
125
139
  rag.add_option :add_twilio_ruby , type: :boolean, default: false
126
140
  end
127
141
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsAppGenerator
4
- VERSION = '0.2.20'
4
+ VERSION = '0.2.23'
5
5
  end
@@ -28,6 +28,7 @@ require 'rails_app_generator/options/options_builder'
28
28
  require 'rails_app_generator/options/rails_options'
29
29
  require 'rails_app_generator/context'
30
30
  require 'rails_app_generator/dependencies'
31
+ require 'rails_app_generator/gem_query'
31
32
  require 'rails_app_generator/addon'
32
33
  require 'rails_app_generator/addon_util'
33
34
  require 'rails_app_generator/formatted_gem_entry'
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "rails_app_generator",
3
- "version": "0.2.20",
3
+ "version": "0.2.23",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "rails_app_generator",
9
- "version": "0.2.20",
9
+ "version": "0.2.23",
10
10
  "dependencies": {
11
11
  "daisyui": "^2.20.0"
12
12
  },
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rails_app_generator",
3
- "version": "0.2.20",
3
+ "version": "0.2.23",
4
4
  "description": "Create new Rails Application with custom opinions",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
@@ -0,0 +1,12 @@
1
+ {
2
+ "args": {
3
+ "app_path": "annotate",
4
+ "destination_root": "/Users/davidcruwys/dev/kgems/rails_app_generator/a/addons"
5
+ },
6
+ "opts": {
7
+ "skip_git": true,
8
+ "skip_test": true,
9
+ "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/annotate/_.rb",
10
+ "add_annotate": true
11
+ }
12
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "args": {
3
+ "app_path": "avo",
4
+ "destination_root": "/Users/davidcruwys/dev/kgems/rails_app_generator/a/addons"
5
+ },
6
+ "opts": {
7
+ "skip_git": true,
8
+ "skip_test": true,
9
+ "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/avo/_.rb",
10
+ "add_annotate": true,
11
+ "add_avo": true,
12
+ "add_devise": true,
13
+ "add_faker": true,
14
+ "add_rubocop": true
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "args": {
3
+ "app_path": "devise",
4
+ "destination_root": "/Users/davidcruwys/dev/kgems/rails_app_generator/a/addons"
5
+ },
6
+ "opts": {
7
+ "skip_git": true,
8
+ "skip_test": true,
9
+ "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/devise/_.rb",
10
+ "notes": "javascript: esbuild is used for the demonstration of this addon so that the destroy_user_session_path can be used as a link using turbo_method: :delete",
11
+ "javascript": "esbuild",
12
+ "add_annotate": true,
13
+ "add_devise": true,
14
+ "add_faker": true
15
+ }
16
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "args": {
3
+ "app_path": "testy",
4
+ "destination_root": "/Users/davidcruwys/dev/kgems/rails_app_generator/a/rag"
5
+ },
6
+ "opts": {
7
+ "skip_git": true,
8
+ "skip_test": true,
9
+ "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/rag/testy/_.rb",
10
+ "javascript": "esbuild"
11
+ }
12
+ }
data/tasks/addon.thor CHANGED
@@ -4,7 +4,9 @@
4
4
 
5
5
  require 'net/http'
6
6
  require 'json'
7
- require_relative 'gem_info'
7
+ require 'pry'
8
+ require 'cmdlet'
9
+ require 'rails_app_generator'
8
10
 
9
11
  # Thor task to create a new Addon for Rails App Generator
10
12
  class Addon < Thor
@@ -46,9 +48,11 @@ class Addon < Thor
46
48
  end
47
49
 
48
50
  def build_required_gem_code
51
+ return nil unless options[:gem]
52
+
49
53
  info = gem_info
50
54
 
51
- " required_gem gem.version('#{info.name}', '#{info.version}', '#{info.description}')"
55
+ " required_gem gem.version('#{info.name}', '#{info.version}', '#{info.comment}')"
52
56
  end
53
57
 
54
58
  # example: 'https://rubygems.org/api/v1/gems/draper.json'
@@ -57,7 +61,7 @@ class Addon < Thor
57
61
 
58
62
  gem_name = options[:gem] == 'gem' ? name : options[:gem]
59
63
 
60
- ::GemInfo.get(gem_name)
64
+ RailsAppGenerator::GemQuery.get(gem_name)
61
65
  end
62
66
 
63
67
  def build_data
data/tasks/profile.thor CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  # https://codecrate.com/2014/01/replace-rake-with-thor.html
4
4
 
5
- require_relative 'gem_info'
6
5
  require 'cmdlet'
6
+ require 'rails_app_generator'
7
7
 
8
8
  # Thor task to create a new Profile for Rails App Generator
9
9
  class Profile < Thor
@@ -70,7 +70,7 @@ class Profile < Thor
70
70
  def build_data
71
71
  gi = gem_info(name)
72
72
 
73
- description = gi ? gi.description : 'Description goes here'
73
+ description = gi ? gi.comment : 'Description goes here'
74
74
 
75
75
  Data.new(
76
76
  name: name,
@@ -104,7 +104,7 @@ class Profile < Thor
104
104
 
105
105
  gem_name = options[:gem] == 'gem' ? name : options[:gem]
106
106
 
107
- GemInfo.get(gem_name)
107
+ RailsAppGenerator::GemQuery.get(gem_name)
108
108
  end
109
109
 
110
110
  def human(value)
@@ -1,6 +1,7 @@
1
1
  source "https://rubygems.org"
2
2
  git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
3
 
4
+ # xmen
4
5
  ruby <%= "'#{RUBY_VERSION}'" -%>
5
6
 
6
7
  <% gems.each do |gem| %><%= gem %>
@@ -1,16 +1,10 @@
1
- class TurboController < ApplicationController
2
-
3
- # This is required for Devise to work.
4
- # See: https://youtu.be/m3uhldUGVes?t=1432
5
- #
6
- # Having issues with devise/turbo.
7
- # See: https://gorails.com/episodes/devise-hotwire-turbo
1
+ class TurboDeviseController < ApplicationController
8
2
  class Responder < ActionController::Responder
9
3
  def to_turbo_stream
10
4
  controller.render(options.merge(formats: :html))
11
- rescue ActionView::MissingTemplate => error
5
+ rescue ActionView::MissingTemplate => e
12
6
  if get?
13
- raise error
7
+ raise e
14
8
  elsif has_errors? && default_action
15
9
  render rendering_options.merge(formats: :html, status: :unprocessable_entity)
16
10
  else
@@ -21,4 +15,4 @@ class TurboController < ApplicationController
21
15
 
22
16
  self.responder = Responder
23
17
  respond_to :html, :turbo_stream
24
- end
18
+ end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Users::RegistrationsController < Devise::RegistrationsController
4
+ before_action :configure_sign_up_params, only: [:create]
5
+ before_action :configure_account_update_params, only: [:update]
6
+
7
+ # GET /resource/sign_up
8
+ # def new
9
+ # super
10
+ # end
11
+
12
+ # POST /resource
13
+ # def create
14
+ # super
15
+ # end
16
+
17
+ # GET /resource/edit
18
+ # def edit
19
+ # super
20
+ # end
21
+
22
+ # PUT /resource
23
+ # def update
24
+ # super
25
+ # end
26
+
27
+ # DELETE /resource
28
+ # def destroy
29
+ # super
30
+ # end
31
+
32
+ # GET /resource/cancel
33
+ # Forces the session data which is usually expired after sign
34
+ # in to be expired now. This is useful if the user wants to
35
+ # cancel oauth signing in/up in the middle of the process,
36
+ # removing all OAuth session data.
37
+ # def cancel
38
+ # super
39
+ # end
40
+
41
+ # protected
42
+
43
+ # If you have extra params to permit, append them to the sanitizer.
44
+ def configure_sign_up_params
45
+ devise_parameter_sanitizer.permit(:sign_up, keys: [:name])
46
+ end
47
+
48
+ # If you have extra params to permit, append them to the sanitizer.
49
+ def configure_account_update_params
50
+ devise_parameter_sanitizer.permit(:account_update, keys: [:name])
51
+ end
52
+
53
+ # The path used after sign up.
54
+ # def after_sign_up_path_for(resource)
55
+ # super(resource)
56
+ # end
57
+
58
+ # The path used after sign up for inactive accounts.
59
+ # def after_inactive_sign_up_path_for(resource)
60
+ # super(resource)
61
+ # end
62
+ end
@@ -1,62 +1,48 @@
1
- <% content_for :devise_form do %>
2
- <h2 class="pt-4 mb-8 text-4xl font-bold heading">Edit <%= resource_name.to_s.humanize %></h2>
3
-
4
- <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
5
-
6
- <%= render "devise/shared/error_messages", resource: resource %>
7
-
8
- <div class="input-group">
9
- <%= f.label :name, class:"label" %>
10
- <%= f.text_field :name, class:"input" %>
11
- </div>
12
-
13
- <div class="input-group">
14
- <%= f.label :email, class:"label" %>
15
- <%= f.email_field :email, autocomplete: "email", class:"input" %>
16
- </div>
17
-
18
- <div class="input-group">
19
- <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
20
- <div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
21
- <% end %>
22
- </div>
23
-
24
- <div class="input-group">
25
- <%= f.label :password, class:"label" %>
26
- <%= f.password_field :password, autocomplete: "new-password", class:"input" %>
27
- <p class="pt-1 text-sm italic text-grey-dark"> <% if @minimum_password_length %>
28
- <%= @minimum_password_length %> characters minimum <% end %> (leave blank if you don't want to change it) </p>
29
-
30
- </div>
31
-
32
- <div class="input-group">
33
- <%= f.label :password_confirmation, class: "label" %>
34
- <%= f.password_field :password_confirmation, autocomplete: "new-password", class: "input" %>
35
- </div>
36
-
37
- <div class="input-group">
38
- <%= f.label :current_password, class: "label" %>
39
- <%= f.password_field :current_password, autocomplete: "current-password", class: "input" %>
40
- <p class="pt-2 text-sm italic text-grey-dark">(we need your current password to confirm your changes)</p>
41
- </div>
42
-
43
- <div class="input-group">
44
- <%= f.submit "Update", class: "btn btn-default" %>
45
- </div>
46
- <% end %>
1
+ <h2>Edit <%= resource_name.to_s.humanize %></h2>
2
+
3
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
4
+ <%= render "devise/shared/error_messages", resource: resource %>
5
+
6
+ <div class="field">
7
+ <%= f.label :name %><br />
8
+ <%= f.text_field :name, autofocus: true %>
9
+ </div>
10
+
11
+ <div class="field">
12
+ <%= f.label :email %><br />
13
+ <%= f.email_field :email, autocomplete: "email" %>
14
+ </div>
47
15
 
48
- <hr class="mt-6 mb-3 border" />
16
+ <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
17
+ <div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
18
+ <% end %>
49
19
 
50
- <h3 class="mb-4 text-xl font-bold heading">Cancel my account</h3>
20
+ <div class="field">
21
+ <%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
22
+ <%= f.password_field :password, autocomplete: "new-password" %>
23
+ <% if @minimum_password_length %>
24
+ <br />
25
+ <em><%= @minimum_password_length %> characters minimum</em>
26
+ <% end %>
27
+ </div>
51
28
 
52
- <div class="flex items-center justify-between">
53
- <div class="flex-1">
54
- <p class="py-4">Unhappy?</p>
55
- </div>
29
+ <div class="field">
30
+ <%= f.label :password_confirmation %><br />
31
+ <%= f.password_field :password_confirmation, autocomplete: "new-password" %>
32
+ </div>
56
33
 
57
- <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete, class: "btn btn-red" %>
34
+ <div class="field">
35
+ <%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
36
+ <%= f.password_field :current_password, autocomplete: "current-password" %>
58
37
  </div>
59
38
 
39
+ <div class="actions">
40
+ <%= f.submit "Update" %>
41
+ </div>
60
42
  <% end %>
61
43
 
62
- <%= render 'devise/shared/form_wrap' %>
44
+ <h3>Cancel my account</h3>
45
+
46
+ <p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>
47
+
48
+ <%= link_to "Back", :back %>
@@ -1,45 +1,34 @@
1
- <% content_for :devise_form do %>
2
-
3
- <h2 class="pt-4 mb-8 text-4xl font-bold heading">Sign up</h2>
4
-
5
- <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
6
- <%= render "devise/shared/error_messages", resource: resource %>
7
-
8
- <div class="input-group">
9
- <%= f.label :name, class:"label" %>
10
- <%= f.text_field :name, class:"input" %>
11
- </div>
12
-
13
- <div class="input-group">
14
- <%= f.label :email, class:"label" %>
15
- <%= f.email_field :email, autocomplete: "email", class:"input" %>
16
- </div>
17
-
18
- <div class="input-group">
19
- <div class="flex">
20
- <%= f.label :password, class: "label" %>
21
- <% if @minimum_password_length %>
22
- <span class="pl-1 text-xs text-grey-dark"><em>(<%= @minimum_password_length %> characters minimum)</em></span>
23
- <% end %>
24
- </div>
25
- <%= f.password_field :password, autocomplete: "new-password", class: "input" %>
26
- </div>
27
-
28
- <div class="input-group">
29
- <%= f.label :password_confirmation, class:"label" %>
30
- <%= f.password_field :password_confirmation, autocomplete: "new-password", class: "input" %>
31
- </div>
32
-
33
- <div class="input-group">
34
- <%= f.submit "Sign up", class: "btn btn-default" %>
35
- </div>
36
-
37
- <hr class="mt-6 border" />
38
-
39
- <% end %>
40
-
41
- <%= render "devise/shared/links" %>
42
-
1
+ <h2>Sign up</h2>
2
+
3
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
4
+ <%= render "devise/shared/error_messages", resource: resource %>
5
+
6
+ <div class="field">
7
+ <%= f.label :name %><br />
8
+ <%= f.text_field :name, autofocus: true %>
9
+ </div>
10
+
11
+ <div class="field">
12
+ <%= f.label :email %><br />
13
+ <%= f.email_field :email, autocomplete: "email" %>
14
+ </div>
15
+
16
+ <div class="field">
17
+ <%= f.label :password %>
18
+ <% if @minimum_password_length %>
19
+ <em>(<%= @minimum_password_length %> characters minimum)</em>
20
+ <% end %><br />
21
+ <%= f.password_field :password, autocomplete: "new-password" %>
22
+ </div>
23
+
24
+ <div class="field">
25
+ <%= f.label :password_confirmation %><br />
26
+ <%= f.password_field :password_confirmation, autocomplete: "new-password" %>
27
+ </div>
28
+
29
+ <div class="actions">
30
+ <%= f.submit "Sign up" %>
31
+ </div>
43
32
  <% end %>
44
33
 
45
- <%= render "devise/shared/form_wrap" %>
34
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,2 @@
1
+ <% flash.each do |type, msg| %><div class="<%= type %>"><%= msg %></div><% end %>
2
+ <% if flash.any? %><hr /><% end %>
@@ -19,7 +19,7 @@ end
19
19
  Devise.setup do |config|
20
20
  # ==> Controller configuration
21
21
  # Configure the parent class to the devise controllers.
22
- config.parent_controller = 'TurboController'
22
+ config.parent_controller = 'TurboDeviseController'
23
23
 
24
24
  config.navigational_formats = ['*/*', :html, :turbo_stream]
25
25
 
@@ -8,7 +8,7 @@ self.local_template_path = File.dirname(__FILE__)
8
8
 
9
9
  gac 'base rails 7 image created'
10
10
 
11
- bundle_install
11
+ prepare_environment
12
12
 
13
13
  add_controller('home', 'index')
14
14
 
@@ -28,7 +28,7 @@ after_bundle do
28
28
  end
29
29
 
30
30
  def setup_db
31
- # add_scaffold('post', 'title', 'body:text')
31
+ # add_scaffold('post', 'title', 'body:text', 'user:references')
32
32
  # add_scaffold('people', 'first_name', 'last_name', 'age:integer', 'address:text')
33
33
  # add_scaffold('product', 'name', 'price:integer')
34
34
 
@@ -37,6 +37,7 @@ def setup_db
37
37
  end
38
38
 
39
39
  # Other template command examples
40
+ # prepare_environment
40
41
  # bundle_install
41
42
  # css_install('tailwind')
42
43
  # rails_command('db:migrate')
@@ -1,3 +1 @@
1
- <footer>
2
- <hr />
3
- </footer>
1
+ <hr />
@@ -1,8 +1,5 @@
1
- <header>
2
- <%= link_to 'Home', root_path %> |
3
- <%# link_to 'Some Action', home_some_action_path %> |
4
- <%# link_to 'Products', products_path %> |
5
- <%# link_to 'Posts', posts_path %> |
6
- <%# link_to 'People', people_path %>
7
- <hr />
8
- </header>
1
+ <%= link_to 'Home', root_path %>
2
+ <%# link_to 'Products', products_path %>
3
+ <%# link_to 'Posts', posts_path %>
4
+ <%# link_to 'People', people_path %>
5
+ <hr />
@@ -14,10 +14,16 @@
14
14
  </head>
15
15
 
16
16
  <body>
17
- <%%= render 'layouts/navbar' %>
17
+ <header>
18
+ <%%= render 'layouts/navbar' %>
19
+ <hr />
20
+ </header>
18
21
  <main>
19
22
  <%%= yield %>
20
23
  </main>
21
- <%%= render 'layouts/footer' %>
24
+ <footer>
25
+ <%%= render 'layouts/footer' %>
26
+ </footer>
22
27
  </body>
23
28
  </html>
29
+
@@ -1,15 +1,6 @@
1
- # This file should contain all the record creation needed to seed the database with its default values.
2
- # The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
3
- #
4
- # User.find_or_create_by(email: "admin@admin.com") do |user|
5
- # user.name = 'Admin'
6
- # user.password = 'password'
7
- # user.admin = true
8
- # end
9
-
10
1
  # david = User.create(email: 'david@site.com', name: 'david', password: 'password')
11
- # bob = User.create(email: 'bob@site.com', name: 'bob', password: 'password')
12
- # lisa = User.create(email: 'lisa@site.com', name: 'lisa', password: 'password')
2
+ # james = User.create(email: 'james@site.com', name: 'james', password: 'password')
3
+ # sally = User.create(email: 'sally@site.com', name: 'sally', password: 'password')
13
4
 
14
5
  # 10.times do |i|
15
6
  # Post.create(title: "Post #{i}", body: "This is the body of post #{i}", user: User.all.sample)