rails_app 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.ruby-version +1 -0
  4. data/.standard.yml +3 -0
  5. data/CHANGELOG.md +5 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +42 -0
  8. data/Rakefile +10 -0
  9. data/bin/rails_app +5 -0
  10. data/lib/rails_app/cli.rb +16 -0
  11. data/lib/rails_app/command.rb +41 -0
  12. data/lib/rails_app/error.rb +6 -0
  13. data/lib/rails_app/rails_app.rb +9 -0
  14. data/lib/rails_app/template/.rspec +3 -0
  15. data/lib/rails_app/template/.rubocop.yml +5 -0
  16. data/lib/rails_app/template/.rubocop_todo.yml +0 -0
  17. data/lib/rails_app/template/Brewfile +11 -0
  18. data/lib/rails_app/template/app_bootstrap/assets/stylesheets/_customized_bootstrap.scss +20 -0
  19. data/lib/rails_app/template/app_bootstrap/assets/stylesheets/application.bootstrap.scss +4 -0
  20. data/lib/rails_app/template/app_bootstrap/assets/stylesheets/custom.scss +140 -0
  21. data/lib/rails_app/template/app_bootstrap/helpers/application_helper.rb +2 -0
  22. data/lib/rails_app/template/app_bootstrap/helpers/bootstrap_helper.rb +10 -0
  23. data/lib/rails_app/template/app_bootstrap/views/devise/confirmations/new.html.erb +22 -0
  24. data/lib/rails_app/template/app_bootstrap/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  25. data/lib/rails_app/template/app_bootstrap/views/devise/mailer/email_changed.html.erb +7 -0
  26. data/lib/rails_app/template/app_bootstrap/views/devise/mailer/password_change.html.erb +3 -0
  27. data/lib/rails_app/template/app_bootstrap/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  28. data/lib/rails_app/template/app_bootstrap/views/devise/mailer/unlock_instructions.html.erb +7 -0
  29. data/lib/rails_app/template/app_bootstrap/views/devise/passwords/edit.html.erb +29 -0
  30. data/lib/rails_app/template/app_bootstrap/views/devise/passwords/new.html.erb +20 -0
  31. data/lib/rails_app/template/app_bootstrap/views/devise/registrations/edit.html.erb +45 -0
  32. data/lib/rails_app/template/app_bootstrap/views/devise/registrations/new.html.erb +29 -0
  33. data/lib/rails_app/template/app_bootstrap/views/devise/sessions/new.html.erb +32 -0
  34. data/lib/rails_app/template/app_bootstrap/views/devise/shared/_error_messages.html.erb +15 -0
  35. data/lib/rails_app/template/app_bootstrap/views/devise/shared/_links.html.erb +25 -0
  36. data/lib/rails_app/template/app_bootstrap/views/devise/unlocks/new.html.erb +20 -0
  37. data/lib/rails_app/template/app_bootstrap/views/layouts/application.html.erb +32 -0
  38. data/lib/rails_app/template/app_bootstrap/views/layouts/mailer.html.erb +13 -0
  39. data/lib/rails_app/template/app_bootstrap/views/layouts/mailer.text.erb +1 -0
  40. data/lib/rails_app/template/app_bootstrap/views/shared/_footer.html.erb +5 -0
  41. data/lib/rails_app/template/app_bootstrap/views/shared/_form_errors.html.erb +7 -0
  42. data/lib/rails_app/template/app_bootstrap/views/shared/_navbar.html.erb +18 -0
  43. data/lib/rails_app/template/app_bootstrap/views/shared/_notices.html.erb +8 -0
  44. data/lib/rails_app/template/app_bootstrap/views/static/home.html.erb +2 -0
  45. data/lib/rails_app/template/bin/ci +20 -0
  46. data/lib/rails_app/template/bin/setup +55 -0
  47. data/lib/rails_app/template/bin/yarn +18 -0
  48. data/lib/rails_app/template/config/gems/app.rb +16 -0
  49. data/lib/rails_app/template/config/gems/rspec_gemfile.rb +14 -0
  50. data/lib/rails_app/template/config/initializers/generators.rb +9 -0
  51. data/lib/rails_app/template/esbuild.config.mjs +89 -0
  52. data/lib/rails_app/template/spec/rails_helper.rb +56 -0
  53. data/lib/rails_app/template/spec/spec_helper.rb +92 -0
  54. data/lib/rails_app/template/spec/support/vcr_setup.rb +24 -0
  55. data/lib/rails_app/template/spec/support/webmock.rb +18 -0
  56. data/lib/rails_app/template/template.rb +146 -0
  57. data/lib/rails_app/version.rb +5 -0
  58. data/lib/rails_app.rb +10 -0
  59. data/rails_app.gemspec +36 -0
  60. metadata +159 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 36c17f77988b58a87e4316db69ccc49e857183fc86fbb6bd29b0cbec3f9074a4
4
+ data.tar.gz: 6a13aa68f3ad243da3578e59177eaa3c320147bddd3623b404820bd32e3f0d26
5
+ SHA512:
6
+ metadata.gz: '051813c1c44650894418ad7c8486ccf001f977a27dbf8b0aafb55d55a4b393046cd5b9446c94e8cb2d786b139215811c316e98ce9abd61f50bdafe85c76f8900'
7
+ data.tar.gz: d94d2918acbd20eae15a8ca93be081283d622a7db3e36efef52964489368ee31d68598048d526ce487e6b0d47a906ca2ffd9785210c48f8625a0b3eeeaaf9cf9
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.3.0
data/.standard.yml ADDED
@@ -0,0 +1,3 @@
1
+ # For available configuration options, see:
2
+ # https://github.com/standardrb/standard
3
+ ruby_version: 3.0
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2024-04-01
4
+
5
+ - Initial release
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Chuck Smith
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ ![GitHub License](https://img.shields.io/github/license/eclectic-coding/rails_app)
2
+ [![Tests](https://github.com/eclectic-coding/rails_app/actions/workflows/ci.yml/badge.svg)](https://github.com/eclectic-coding/rails_app/actions/workflows/ci.yml)
3
+ # RailsApp
4
+
5
+ RailsApp is a gem that provides a simple way to create a new Rails application with a pre-configured set of gems and settings, utilizing the Rails application templates feature.
6
+
7
+ The initial release of this gem is an opinionated template that includes the following dependencies and settings:
8
+ - Esbuild for JavaScript bundling
9
+ - Bootstrap for CSS styling
10
+ - RSpec for testing
11
+ - Code quality tools: RuboCop, Brakeman, and Bundler Audit
12
+
13
+ The initial release of this gem **v.0.1.0** is starting with my personal preferences and a Rails template I have developed locally. I plan to expand the template to include more options and configurations with future releases which will make this template less opinionated.
14
+
15
+ ## Installation
16
+ Install globally:
17
+ ```bash
18
+ gem install rails_app
19
+ ```
20
+
21
+ ## Usage
22
+ To bootstrap a new Rails application: `rails_app`
23
+
24
+ The user will be prompted to enter the name of the new Rails application, and the select the assets pipeline to use (propshaft or sprockets).
25
+
26
+ The template will then create a new Rails application with the selected options.
27
+
28
+ In addition, there is a custom binstub (`bin/ci`) that can be used to run the test suite and code quality tools (rubocop, brakeman, and bundle-audit).
29
+
30
+ ## Development
31
+
32
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
33
+
34
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
35
+
36
+ ## Contributing
37
+
38
+ Bug reports and pull requests are welcome on GitHub at https://github.com/eclectic-coding/rails_app.
39
+
40
+ ## License
41
+
42
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "standard/rake"
9
+
10
+ task default: %i[spec standard]
data/bin/rails_app ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "rails_app"
4
+
5
+ RailsApp::App.rails_app
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "tty-prompt"
4
+
5
+ module RailsApp
6
+ class CLI
7
+ def self.start
8
+ prompt = TTY::Prompt.new
9
+
10
+ app_name = prompt.ask("What is the name of your application?", required: true)
11
+ assets = prompt.select("How would you like to manage assets?", %w[propshaft sprockets])
12
+
13
+ Command.new(app_name: app_name, assets: assets).run
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RailsApp
4
+ class Command
5
+ attr_reader :app_name, :bundling, :assets
6
+
7
+ def initialize(app_name:, assets:)
8
+ @app_name = app_name
9
+ @assets = assets
10
+ end
11
+
12
+ def template
13
+ File.join(__dir__, "template", "template.rb")
14
+ end
15
+
16
+ def run
17
+ command = "rails new #{@app_name} --no-rc #{skip_spring} #{asset_management} #{javascript_bundling} #{styling_framework} #{testing_framework} -m #{template}"
18
+ system(command)
19
+ end
20
+
21
+ def skip_spring
22
+ "--skip-spring"
23
+ end
24
+
25
+ def javascript_bundling
26
+ "-j esbuild"
27
+ end
28
+
29
+ def asset_management
30
+ "-a propshaft" unless assets == "sprockets"
31
+ end
32
+
33
+ def styling_framework
34
+ "--css bootstrap"
35
+ end
36
+
37
+ def testing_framework
38
+ "-T"
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RailsApp
4
+ class Error < StandardError
5
+ end
6
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RailsApp
4
+ class App
5
+ def self.rails_app
6
+ RailsApp::CLI.start
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --format Fuubar
3
+ --color
@@ -0,0 +1,5 @@
1
+ # Omakase Ruby styling for Rails
2
+ inherit_gem:
3
+ rubocop-rails-omakase: rubocop.yml
4
+
5
+ # Your own specialized rules go here
File without changes
@@ -0,0 +1,11 @@
1
+ # Install non-ruby dependencies required
2
+
3
+ # Redis - For ActionCable support (and Sidekiq, caching, etc)
4
+ # brew "redis"
5
+
6
+ # Imagemagick or libvips - for processing images (avatars, file uploads, etc)
7
+ brew "vips"
8
+
9
+ # For local certs and SSL local development
10
+ brew "mkcert"
11
+ brew "nss"
@@ -0,0 +1,20 @@
1
+ /**
2
+ * 1 - Set SCSS variables below
3
+ */
4
+ //$primary: hsl(250,78%,63%);
5
+ //$secondary: hsl(216, 15%, 52%);
6
+ $link-decoration: none;
7
+ $form-label-margin-bottom: 0;
8
+
9
+ //New theme
10
+
11
+ /**
12
+ * 2 - Import bare minimum of bootstrap
13
+ */
14
+ @import "bootstrap/scss/functions";
15
+ @import "bootstrap/scss/variables";
16
+
17
+ /**
18
+ * 3 - Now you can refine Bootstrap here
19
+ */
20
+
@@ -0,0 +1,4 @@
1
+ @import "customized_bootstrap";
2
+ @import 'bootstrap/scss/bootstrap';
3
+ @import 'bootstrap-icons/font/bootstrap-icons';
4
+ @import "custom";
@@ -0,0 +1,140 @@
1
+ body {
2
+ font-size: 16px;
3
+
4
+ .application {
5
+ font-size: 20px;
6
+ }
7
+ }
8
+
9
+ .nav-pills {
10
+ & .nav-item {
11
+ margin: 0.13rem 0;
12
+ width: 100%;
13
+ }
14
+
15
+ & .nav-link {
16
+ @media (max-width: 981px) {
17
+ padding: 0.5rem 0.5rem;
18
+ }
19
+ padding-right: 0;
20
+
21
+ &:hover {
22
+ color: white;
23
+ background: rgba(white, 0.05);
24
+ width: 100%;
25
+ }
26
+
27
+ &.sidebar__active {
28
+ color: inherit;
29
+ background: rgba(white, 0.1);
30
+ padding-right: 0;
31
+ }
32
+ }
33
+ }
34
+
35
+ .icon {
36
+ font-size: 20px;
37
+ }
38
+
39
+ .sort {
40
+ position: absolute;
41
+ top: 1rem;
42
+ right: 0.5rem;
43
+ width: 0;
44
+ height: 0;
45
+ border-left: 6px solid transparent;
46
+ border-right: 6px solid transparent;
47
+ }
48
+
49
+ .sort-desc {
50
+ border-top: 8px solid #000000;
51
+ }
52
+
53
+ .sort-asc {
54
+ border-bottom: 8px solid #000000;
55
+ }
56
+
57
+ .pagy-bootstrap-nav .pagination {
58
+ margin-bottom: 0;
59
+ }
60
+
61
+ .trix-button-group--file-tools {
62
+ display: none !important;
63
+ margin-left: 0 !important;
64
+ }
65
+
66
+ .trix-button-group--history-tools,
67
+ .trix-button-group--block-tools {
68
+ margin-left: 0 !important;
69
+ }
70
+
71
+ .trix-button-group-spacer {
72
+ display: none !important;
73
+ }
74
+
75
+ .trix-button--icon-link,
76
+ .trix-button--icon-code,
77
+ .trix-button--icon-attach {
78
+ display: none;
79
+ }
80
+
81
+ .event-title {
82
+ a {
83
+ color: inherit;
84
+ text-decoration: none;
85
+
86
+ a:hover {
87
+ text-decoration: underline !important;
88
+ }
89
+ }
90
+ }
91
+
92
+ address {
93
+ font-size: 14px;
94
+
95
+ .event-venue {
96
+ font-weight: 700;
97
+ }
98
+ }
99
+
100
+ .title-area {
101
+ margin-top: 0.5rem;
102
+ padding-bottom: 0.25rem;
103
+ width: 18.75rem;
104
+ border-bottom: 3px solid $danger;
105
+ text-transform: uppercase;
106
+ }
107
+
108
+ .iframe-container {
109
+ position: relative;
110
+ overflow: hidden;
111
+ width: 100%;
112
+ padding-top: 56.25%;
113
+ }
114
+
115
+ .responsive-iframe {
116
+ position: absolute;
117
+ top: 0;
118
+ left: 0;
119
+ bottom: 0;
120
+ right: 0;
121
+ width: 100%;
122
+ height: 100%;
123
+ }
124
+
125
+ .info-card {
126
+ width: 50vw !important;
127
+
128
+ @media (max-width: 600px) {
129
+ width: 100vw !important;
130
+ }
131
+ }
132
+
133
+ .read-more {
134
+ font-size: 15px;
135
+ font-weight: 700;
136
+ text-transform: uppercase;
137
+ border-radius: 0;
138
+ border-bottom: 3px solid $danger;
139
+ }
140
+
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,10 @@
1
+ module BootstrapHelper
2
+ def bootstrap_class_for(flash_type)
3
+ {
4
+ success: "alert-success",
5
+ error: "alert-danger",
6
+ alert: "alert-warning",
7
+ notice: "alert-primary"
8
+ }.stringify_keys[flash_type.to_s] || flash_type.to_s
9
+ end
10
+ end
@@ -0,0 +1,22 @@
1
+ <div class="row">
2
+ <div class="col-lg-4 offset-lg-4">
3
+ <h2 class="text-center">Resend confirmation instructions</h2>
4
+
5
+ <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
6
+ <%= render "devise/shared/error_messages", resource: resource %>
7
+
8
+ <div class="mb-3">
9
+ <%= f.label :email, class: 'form-label' %><br />
10
+ <%= f.email_field :email, autofocus: true, class: 'form-control', value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
11
+ </div>
12
+
13
+ <div class="actions d-grid">
14
+ <%= f.submit "Resend confirmation instructions", class: 'btn btn-primary btn-lg' %>
15
+ </div>
16
+ <% end %>
17
+
18
+ <div class="text-center">
19
+ <%= render "devise/shared/links" %>
20
+ </div>
21
+ </div>
22
+ </div>
@@ -0,0 +1,5 @@
1
+ <p>Welcome <%= @email %>!</p>
2
+
3
+ <p>You can confirm your account email through the link below:</p>
4
+
5
+ <p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>
@@ -0,0 +1,7 @@
1
+ <p>Hello <%= @email %>!</p>
2
+
3
+ <% if @resource.try(:unconfirmed_email?) %>
4
+ <p>We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.</p>
5
+ <% else %>
6
+ <p>We're contacting you to notify you that your email has been changed to <%= @resource.email %>.</p>
7
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <p>Hello <%= @resource.email %>!</p>
2
+
3
+ <p>We're contacting you to notify you that your password has been changed.</p>
@@ -0,0 +1,8 @@
1
+ <p>Hello <%= @resource.email %>!</p>
2
+
3
+ <p>Someone has requested a link to change your password. You can do this through the link below.</p>
4
+
5
+ <p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
6
+
7
+ <p>If you didn't request this, please ignore this email.</p>
8
+ <p>Your password won't change until you access the link above and create a new one.</p>
@@ -0,0 +1,7 @@
1
+ <p>Hello <%= @resource.email %>!</p>
2
+
3
+ <p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
4
+
5
+ <p>Click the link below to unlock your account:</p>
6
+
7
+ <p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>
@@ -0,0 +1,29 @@
1
+ <div class="row">
2
+ <div class="col-lg-4 offset-lg-4">
3
+ <h2 class="text-center">Change your password</h2>
4
+
5
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
6
+ <%= render "devise/shared/error_messages", resource: resource %>
7
+ <%= f.hidden_field :reset_password_token %>
8
+
9
+ <div class="mb-3">
10
+ <%= f.password_field :password, autofocus: true, autocomplete: "off", class: 'form-control', placeholder: "Password" %>
11
+ <% if @minimum_password_length %>
12
+ <p class="text-muted"><small><%= @minimum_password_length %> characters minimum</small></p>
13
+ <% end %>
14
+ </div>
15
+
16
+ <div class="mb-3">
17
+ <%= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control', placeholder: "Confirm Password" %>
18
+ </div>
19
+
20
+ <div class="mb-3 d-grid">
21
+ <%= f.submit "Change my password", class: 'btn btn-primary btn-lg' %>
22
+ </div>
23
+ <% end %>
24
+
25
+ <div class="text-center">
26
+ <%= render "devise/shared/links" %>
27
+ </div>
28
+ </div>
29
+ </div>
@@ -0,0 +1,20 @@
1
+ <div class="row">
2
+ <div class="col-lg-4 offset-lg-4">
3
+ <h2 class="text-center">Reset your password</h2>
4
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
5
+ <%= render "devise/shared/error_messages", resource: resource %>
6
+ <p class="text-center">Enter your email address below and we will send you a link to reset your password.</p>
7
+
8
+ <div class="mb-3">
9
+ <%= f.email_field :email, autofocus: true, placeholder: 'Email address', class: 'form-control' %>
10
+ </div>
11
+
12
+ <div class="mb-3 d-grid">
13
+ <%= f.submit "Send password reset email", class: 'btn btn-primary btn-lg' %>
14
+ </div>
15
+ <% end %>
16
+ <div class="text-center">
17
+ <%= render "devise/shared/links" %>
18
+ </div>
19
+ </div>
20
+ </div>
@@ -0,0 +1,45 @@
1
+ <div class="row">
2
+ <div class="col-lg-4 offset-lg-4">
3
+ <h1 class="text-center">Account</h1>
4
+
5
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
6
+ <%= render "devise/shared/error_messages", resource: resource %>
7
+
8
+ <div class="mb-3">
9
+ <%= f.email_field :email, class: 'form-control', placeholder: 'Email Address' %>
10
+ </div>
11
+
12
+ <div class="mb-3">
13
+ <%= f.label :avatar, class: "form-label" %>
14
+ <%= f.file_field :avatar, accept:'image/*' %>
15
+ </div>
16
+
17
+ <%= image_tag avatar_path(f.object), class: "rounded border shadow-sm d-block mx-auto my-3" %>
18
+
19
+ <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
20
+ <div class="alert alert-warning">Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
21
+ <% end %>
22
+
23
+ <div class="mb-3">
24
+ <%= f.password_field :password, autocomplete: "off", class: 'form-control', placeholder: 'Password' %>
25
+ <p class="form-text text-muted"><small>Leave password blank if you don't want to change it</small></p>
26
+ </div>
27
+
28
+ <div class="mb-3">
29
+ <%= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control', placeholder: 'Confirm Password' %>
30
+ </div>
31
+
32
+ <div class="mb-3">
33
+ <%= f.password_field :current_password, autocomplete: "off", class: 'form-control', placeholder: 'Current Password' %>
34
+ <p class="form-text text-muted"><small>We need your current password to confirm your changes</small></p>
35
+ </div>
36
+
37
+ <div class="mb-3 d-grid">
38
+ <%= f.submit "Save Changes", class: 'btn btn-lg btn-primary' %>
39
+ </div>
40
+ <% end %>
41
+ <hr>
42
+
43
+ <p class="text-center"><%= link_to "Deactivate my account", registration_path(resource_name), data: { confirm: "Are you sure? You cannot undo this." }, method: :delete %></p>
44
+ </div>
45
+ </div>
@@ -0,0 +1,29 @@
1
+ <div class="row">
2
+ <div class="col-lg-4 offset-lg-4">
3
+ <h1 class="text-center">Sign Up</h1>
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="mb-3">
9
+ <%= f.email_field :email, autofocus: false, class: 'form-control', placeholder: "Email Address" %>
10
+ </div>
11
+
12
+ <div class="mb-3">
13
+ <%= f.password_field :password, autocomplete: "off", class: 'form-control', placeholder: 'Password' %>
14
+ </div>
15
+
16
+ <div class="mb-3">
17
+ <%= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control', placeholder: 'Confirm Password' %>
18
+ </div>
19
+
20
+ <div class="mb-3 d-grid">
21
+ <%= f.submit "Sign up", class: "btn btn-primary btn-lg" %>
22
+ </div>
23
+ <% end %>
24
+
25
+ <div class="text-center">
26
+ <%= render "devise/shared/links" %>
27
+ </div>
28
+ </div>
29
+ </div>
@@ -0,0 +1,32 @@
1
+ <div class="row">
2
+ <div class="col-lg-4 offset-lg-4">
3
+ <h1 class="text-center">Log in</h1>
4
+
5
+ <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
6
+ <div class="mb-3">
7
+ <%= f.email_field :email, autofocus: true, placeholder: 'Email Address', class: 'form-control' %>
8
+ </div>
9
+
10
+ <div class="mb-3">
11
+ <%= f.password_field :password, autocomplete: "off", placeholder: 'Password', class: 'form-control' %>
12
+ </div>
13
+
14
+ <% if devise_mapping.rememberable? -%>
15
+ <div class="form-check">
16
+ <label class="form-check-label">
17
+ <%= f.check_box :remember_me, class: "form-check-input" %>
18
+ Remember me
19
+ </label>
20
+ </div>
21
+ <% end -%>
22
+
23
+ <div class="mb-3 d-grid">
24
+ <%= f.submit "Log in", class: "btn btn-primary btn-lg" %>
25
+ </div>
26
+ <% end %>
27
+
28
+ <div class="text-center">
29
+ <%= render "devise/shared/links" %>
30
+ </div>
31
+ </div>
32
+ </div>
@@ -0,0 +1,15 @@
1
+ <% if resource.errors.any? %>
2
+ <div id="error_explanation" class="alert alert-danger">
3
+ <h6>
4
+ <%= I18n.t("errors.messages.not_saved",
5
+ count: resource.errors.count,
6
+ resource: resource.class.model_name.human.downcase)
7
+ %>
8
+ </h6>
9
+ <ul>
10
+ <% resource.errors.full_messages.each do |message| %>
11
+ <li><%= message %></li>
12
+ <% end %>
13
+ </ul>
14
+ </div>
15
+ <% end %>