devise_template 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +12 -0
  4. data/CODE_OF_CONDUCT.md +84 -0
  5. data/LICENSE +21 -0
  6. data/README.md +53 -0
  7. data/Rakefile +12 -0
  8. data/Screenshot.png +0 -0
  9. data/app/views/devise/bootstrap/confirmations/new.html.erb +23 -0
  10. data/app/views/devise/bootstrap/passwords/edit.html.erb +34 -0
  11. data/app/views/devise/bootstrap/passwords/new.html.erb +23 -0
  12. data/app/views/devise/bootstrap/registrations/edit.html.erb +55 -0
  13. data/app/views/devise/bootstrap/registrations/new.html.erb +38 -0
  14. data/app/views/devise/bootstrap/sessions/new.html.erb +34 -0
  15. data/app/views/devise/bootstrap/shared/_alert_messages.html.erb +3 -0
  16. data/app/views/devise/bootstrap/shared/_error_messages.html.erb +15 -0
  17. data/app/views/devise/bootstrap/shared/_links.html.erb +49 -0
  18. data/app/views/devise/bootstrap/unlocks/new.html.erb +23 -0
  19. data/app/views/devise/tailwind/confirmations/new.html.erb +21 -0
  20. data/app/views/devise/tailwind/passwords/edit.html.erb +30 -0
  21. data/app/views/devise/tailwind/passwords/new.html.erb +21 -0
  22. data/app/views/devise/tailwind/registrations/edit.html.erb +47 -0
  23. data/app/views/devise/tailwind/registrations/new.html.erb +34 -0
  24. data/app/views/devise/tailwind/sessions/new.html.erb +32 -0
  25. data/app/views/devise/tailwind/shared/_alert_messages.html.erb +1 -0
  26. data/app/views/devise/tailwind/shared/_error_messages.html.erb +15 -0
  27. data/app/views/devise/tailwind/shared/_links.html.erb +49 -0
  28. data/app/views/devise/tailwind/unlocks/new.html.erb +21 -0
  29. data/devise_template.gemspec +29 -0
  30. data/lib/devise_template/version.rb +5 -0
  31. data/lib/devise_template.rb +7 -0
  32. data/lib/generators/devise_template/bootstrap_generator.rb +13 -0
  33. data/lib/generators/devise_template/tailwind_generator.rb +13 -0
  34. data/sig/devise_template.rbs +4 -0
  35. metadata +79 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0fda134aba463020869fe6eb24693527fb555aa2e7b5036fbeedad3d07452dbd
4
+ data.tar.gz: bc8d48e1c5fe6e3efaeb9aa9a457f74f9765bf4449d818be21f3f9960c826b5d
5
+ SHA512:
6
+ metadata.gz: 1b6f4beed991c50d84a5478de77f05a0cd7809e29daadf1c883cfe4891167ae7b016c112df5816fc859d107b89ef10f281fb0f2430b94750ee22f18432b1df15
7
+ data.tar.gz: 228f2755a4d06eb775f50b0a1da50b5e7e84da0af9539f204c6ca0153fcacb68b0bcff26e6a2611974b16b95be09ad28575c9fe3918b1780ab2c02d1350fc3c2
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,12 @@
1
+ require:
2
+ - rubocop-rake
3
+ - rubocop-rspec
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 2.6
7
+
8
+ Style/Documentation:
9
+ Enabled: false
10
+
11
+ Layout/LineLength:
12
+ Max: 200
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at yuto.yasunaga@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Yuto Yasunaga
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # DeviseTemplate
2
+
3
+ Generate Devise views styled with either TailwindCSS 3 or Bootstrap 5 easily.
4
+
5
+ ![DeviseTemplate](./Screenshot.png)
6
+
7
+ ## Installation
8
+
9
+ 1. Add the gem to your Rails application's Gemfile:
10
+
11
+ ```ruby:Gemfile
12
+ gem 'devise_template'
13
+ ```
14
+
15
+ 2. Then execute
16
+
17
+ ```
18
+ bundle install
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ Make sure TailwindCSS 3 / Bootstrap 5 is installed.
24
+
25
+ Once installed, you can generate Devise views styled with TailwindCSS or Bootstrap using the following commands:
26
+
27
+ ### For TailwindCSS 3
28
+
29
+ ```
30
+ rails generate devise_template:tailwind
31
+ ```
32
+
33
+ This will copy TailwindCSS-styled Devise views to your app/views/devise directory.
34
+
35
+ ### For Bootstrap 5
36
+
37
+ ```
38
+ rails generate devise_template:bootstrap
39
+ ```
40
+
41
+ This will copy Bootstrap-styled Devise views to your app/views/devise directory.
42
+
43
+ ## Contributing
44
+
45
+ 1. Fork it ( https://github.com/YutoYasunaga/devise_template/fork)
46
+ 2. Create your feature branch (git checkout -b my-new-feature)
47
+ 3. Commit your changes (git commit -am 'Add some feature')
48
+ 4. Push to the branch (git push origin my-new-feature)
49
+ 5. Create a new Pull Request
50
+
51
+ ## License
52
+
53
+ 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,12 @@
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 'rubocop/rake_task'
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[rubocop spec]
data/Screenshot.png ADDED
Binary file
@@ -0,0 +1,23 @@
1
+ <div class="card my-5 mx-auto shadow" style="max-width: 32rem;">
2
+ <div class="card-body p-4">
3
+
4
+ <h2 class="text-center font-weight-bold mb-4">Resend confirmation instructions</h2>
5
+
6
+ <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
7
+ <%= render "devise/shared/error_messages", resource: resource %>
8
+
9
+ <div class="mb-3">
10
+ <%= f.label :email, class: "form-label fw-bolder" %>
11
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email), class: "form-control mt-1" %>
12
+ </div>
13
+
14
+ <div class="actions d-grid gap-2">
15
+ <%= f.submit "Resend confirmation instructions", class: "btn btn-primary" %>
16
+ </div>
17
+ <% end %>
18
+
19
+ <div class="mt-4">
20
+ <%= render "devise/shared/links" %>
21
+ </div>
22
+ </div>
23
+ </div>
@@ -0,0 +1,34 @@
1
+ <div class="card my-5 mx-auto shadow" style="max-width: 32rem;">
2
+ <div class="card-body p-4">
3
+
4
+ <h2 class="text-center font-weight-bold mb-4">Change your password</h2>
5
+
6
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
7
+ <%= render "devise/shared/error_messages", resource: resource %>
8
+ <%= f.hidden_field :reset_password_token %>
9
+
10
+ <div class="mb-3">
11
+ <%= f.label :password, "New password", class: "form-label fw-bolder" %>
12
+ <% if @minimum_password_length %>
13
+ <div>
14
+ <em class="form-text text-muted">(<%= @minimum_password_length %> characters minimum)</em>
15
+ </div>
16
+ <% end %>
17
+ <%= f.password_field :password, autofocus: true, autocomplete: "new-password", class: "form-control" %>
18
+ </div>
19
+
20
+ <div class="mb-3">
21
+ <%= f.label :password_confirmation, "Confirm new password", class: "form-label fw-bolder" %>
22
+ <%= f.password_field :password_confirmation, autocomplete: "new-password", class: "form-control" %>
23
+ </div>
24
+
25
+ <div class="actions d-grid gap-2">
26
+ <%= f.submit "Change my password", class: "btn btn-primary" %>
27
+ </div>
28
+ <% end %>
29
+
30
+ <div class="mt-4">
31
+ <%= render "devise/shared/links" %>
32
+ </div>
33
+ </div>
34
+ </div>
@@ -0,0 +1,23 @@
1
+ <div class="card my-5 mx-auto shadow" style="max-width: 32rem;">
2
+ <div class="card-body p-4">
3
+
4
+ <h2 class="text-center font-weight-bold mb-4">Forgot your password?</h2>
5
+
6
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name)) do |f| %>
7
+ <%= render "devise/shared/error_messages", resource: resource %>
8
+
9
+ <div class="mb-3">
10
+ <%= f.label :email, class: "form-label fw-bolder" %>
11
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control" %>
12
+ </div>
13
+
14
+ <div class="actions d-grid gap-2">
15
+ <%= f.submit "Send me reset password instructions", class: "btn btn-primary" %>
16
+ </div>
17
+ <% end %>
18
+
19
+ <div class="mt-4">
20
+ <%= render "devise/shared/links" %>
21
+ </div>
22
+ </div>
23
+ </div>
@@ -0,0 +1,55 @@
1
+ <div class="card my-5 mx-auto shadow" style="max-width: 32rem;">
2
+ <div class="card-body p-4">
3
+
4
+ <h2 class="text-center font-weight-bold mb-4">Edit <%= resource_name.to_s.humanize %></h2>
5
+
6
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
7
+ <%= render "devise/shared/error_messages", resource: resource %>
8
+
9
+ <div class="mb-3">
10
+ <%= f.label :email, class: "form-label fw-bolder" %>
11
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control" %>
12
+ </div>
13
+
14
+ <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
15
+ <div class="text-muted mb-3">Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
16
+ <% end %>
17
+
18
+ <div class="mb-3">
19
+ <%= f.label :password, class: "form-label fw-bolder" %>
20
+ <div>
21
+ <small class="form-text text-muted">(leave blank if you don't want to change it)</small>
22
+ </div>
23
+ <%= f.password_field :password, autocomplete: "new-password", class: "form-control" %>
24
+ <% if @minimum_password_length %>
25
+ <small class="form-text text-muted"><%= @minimum_password_length %> characters minimum</small>
26
+ <% end %>
27
+ </div>
28
+
29
+ <div class="mb-3">
30
+ <%= f.label :password_confirmation, class: "form-label fw-bolder" %>
31
+ <%= f.password_field :password_confirmation, autocomplete: "new-password", class: "form-control" %>
32
+ </div>
33
+
34
+ <div class="mb-3">
35
+ <%= f.label :current_password, class: "form-label fw-bolder" %>
36
+ <div>
37
+ <small class="form-text text-muted">(we need your current password to confirm your changes)</small>
38
+ </div>
39
+ <%= f.password_field :current_password, autocomplete: "current-password", class: "form-control" %>
40
+ </div>
41
+
42
+ <div class="actions d-grid gap-2">
43
+ <%= f.submit "Update", class: "btn btn-primary" %>
44
+ </div>
45
+ <% end %>
46
+
47
+ <h3 class="mt-5 mb-2">Cancel my account</h3>
48
+
49
+ <div class="text-muted mb-4">
50
+ Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?", turbo_confirm: "Are you sure?" }, method: :delete, class: "btn btn-danger mt-2" %>
51
+ </div>
52
+
53
+ <%= link_to "Back", :back, class: "text-primary" %>
54
+ </div>
55
+ </div>
@@ -0,0 +1,38 @@
1
+ <div class="card my-5 mx-auto shadow rounded" style="max-width: 32rem;">
2
+ <div class="card-body p-3">
3
+
4
+ <h2 class="text-center font-weight-bold mb-4">Sign up</h2>
5
+
6
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
7
+ <%= render "devise/shared/error_messages", resource: resource %>
8
+
9
+ <div class="mb-3 field">
10
+ <%= f.label :email, class: "form-label fw-bolder" %>
11
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control" %>
12
+ </div>
13
+
14
+ <div class="mb-3 field">
15
+ <%= f.label :password, class: "form-label fw-bolder" %>
16
+ <% if @minimum_password_length %>
17
+ <div>
18
+ <em class="form-text text-muted">( <%= @minimum_password_length %> characters minimum)</em>
19
+ </div>
20
+ <% end %>
21
+ <%= f.password_field :password, autocomplete: "new-password", class: "form-control" %>
22
+ </div>
23
+
24
+ <div class="mb-3 field">
25
+ <%= f.label :password_confirmation, class: "form-label fw-bolder" %>
26
+ <%= f.password_field :password_confirmation, autocomplete: "new-password", class: "form-control" %>
27
+ </div>
28
+
29
+ <div class="actions">
30
+ <%= f.submit "Sign up", class: "btn btn-primary w-100 mt-2" %>
31
+ </div>
32
+ <% end %>
33
+
34
+ <div class="mt-4">
35
+ <%= render "devise/shared/links" %>
36
+ </div>
37
+ </div>
38
+ </div>
@@ -0,0 +1,34 @@
1
+ <div class="card my-5 mx-auto shadow" style="max-width: 32rem;">
2
+ <div class="card-body p-4">
3
+ <h2 class="text-center font-weight-bold mb-4">Log in</h2>
4
+
5
+ <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
6
+ <%= render 'devise/shared/alert_messages' %>
7
+
8
+ <div class="mb-3">
9
+ <%= f.label :email, class: "form-label fw-bolder" %>
10
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control" %>
11
+ </div>
12
+
13
+ <div class="mb-3">
14
+ <%= f.label :password, class: "form-label fw-bolder" %>
15
+ <%= f.password_field :password, autocomplete: "current-password", class: "form-control" %>
16
+ </div>
17
+
18
+ <% if devise_mapping.rememberable? %>
19
+ <div class="mb-3 form-check">
20
+ <%= f.check_box :remember_me, class: "form-check-input" %>
21
+ <%= f.label :remember_me, class: "form-check-label" %>
22
+ </div>
23
+ <% end %>
24
+
25
+ <div class="actions d-grid gap-2">
26
+ <%= f.submit "Log in", class: "btn btn-primary" %>
27
+ </div>
28
+ <% end %>
29
+
30
+ <div class="mt-4">
31
+ <%= render "devise/shared/links" %>
32
+ </div>
33
+ </div>
34
+ </div>
@@ -0,0 +1,3 @@
1
+ <% if alert %>
2
+ <div class="alert alert-danger mb-4" role="alert"><%= alert %></div>
3
+ <% end %>
@@ -0,0 +1,15 @@
1
+ <% if resource.errors.any? %>
2
+ <div id="error_explanation" class="alert alert-danger mb-4 text-danger" data-turbo-cache="false">
3
+ <h2 class="font-weight-bold">
4
+ <%= I18n.t("errors.messages.not_saved",
5
+ count: resource.errors.count,
6
+ resource: resource.class.model_name.human.downcase)
7
+ %>
8
+ </h2>
9
+ <ul class="mb-0">
10
+ <% resource.errors.full_messages.each do |message| %>
11
+ <li><%= message %></li>
12
+ <% end %>
13
+ </ul>
14
+ </div>
15
+ <% end %>
@@ -0,0 +1,49 @@
1
+ <div class="mb-2">
2
+
3
+ <!-- Sessions (Login) -->
4
+ <%- if controller_name != 'sessions' %>
5
+ <div class="mb-2">
6
+ <%= link_to "Log in", new_session_path(resource_name), class: "text-primary" %>
7
+ </div>
8
+ <% end %>
9
+
10
+ <!-- Registrations (Sign Up) -->
11
+ <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
12
+ <div class="mb-2">
13
+ <%= link_to "Sign up", new_registration_path(resource_name), class: "text-primary" %>
14
+ </div>
15
+ <% end %>
16
+
17
+ <!-- Password Recovery -->
18
+ <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
19
+ <div class="mb-2">
20
+ <%= link_to "Forgot your password?", new_password_path(resource_name), class: "text-primary" %>
21
+ </div>
22
+ <% end %>
23
+
24
+ <!-- Confirmation -->
25
+ <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
26
+ <div class="mb-2">
27
+ <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name), class: "text-primary" %>
28
+ </div>
29
+ <% end %>
30
+
31
+ <!-- Unlock -->
32
+ <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
33
+ <div class="mb-2">
34
+ <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name), class: "text-primary" %>
35
+ </div>
36
+ <% end %>
37
+
38
+ <!-- OmniAuth Providers -->
39
+ <%- if devise_mapping.omniauthable? %>
40
+ <div class="mt-4 mb-2">
41
+ <%- resource_class.omniauth_providers.each do |provider| %>
42
+ <div class="mb-2">
43
+ <%= button_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), data: { turbo: false }, class: "btn btn-primary" %>
44
+ </div>
45
+ <% end %>
46
+ </div>
47
+ <% end %>
48
+
49
+ </div>
@@ -0,0 +1,23 @@
1
+ <div class="card my-5 mx-auto shadow" style="max-width: 42rem;">
2
+ <div class="card-body p-4">
3
+
4
+ <h2 class="text-center font-weight-bold mb-4">Resend unlock instructions</h2>
5
+
6
+ <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
7
+ <%= render "devise/shared/error_messages", resource: resource %>
8
+
9
+ <div class="mb-3">
10
+ <%= f.label :email, class: "form-label fw-bolder" %>
11
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control" %>
12
+ </div>
13
+
14
+ <div class="actions d-grid gap-2">
15
+ <%= f.submit "Resend unlock instructions", class: "btn btn-primary" %>
16
+ </div>
17
+ <% end %>
18
+
19
+ <div class="mt-4">
20
+ <%= render "devise/shared/links" %>
21
+ </div>
22
+ </div>
23
+ </div>
@@ -0,0 +1,21 @@
1
+ <div class="my-8 p-4 w-full max-w-xl mx-auto shadow-xl rounded-md">
2
+
3
+ <h2 class="text-2xl text-center font-semibold mb-4">Resend confirmation instructions</h2>
4
+
5
+ <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post, class: "flex flex-col space-y-4" }) do |f| %>
6
+ <%= render "devise/shared/error_messages", resource: resource %>
7
+
8
+ <div class="field">
9
+ <%= f.label :email, class: "block font-bold text-gray-700" %>
10
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email), class: "mt-1 p-2 w-full border rounded-md" %>
11
+ </div>
12
+
13
+ <div class="actions">
14
+ <%= f.submit "Resend confirmation instructions", class: "w-full px-4 py-2 text-white bg-indigo-600 rounded hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 cursor-pointer" %>
15
+ </div>
16
+ <% end %>
17
+
18
+ <div class="mt-4">
19
+ <%= render "devise/shared/links" %>
20
+ </div>
21
+ </div>
@@ -0,0 +1,30 @@
1
+ <div class="my-8 p-4 w-full max-w-xl mx-auto shadow-xl rounded-md">
2
+
3
+ <h2 class="text-2xl text-center font-semibold mb-4">Change your password</h2>
4
+
5
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put, class: "flex flex-col space-y-4" }) do |f| %>
6
+ <%= render "devise/shared/error_messages", resource: resource %>
7
+ <%= f.hidden_field :reset_password_token %>
8
+
9
+ <div class="field">
10
+ <%= f.label :password, "New password", class: "block font-bold text-gray-700" %>
11
+ <% if @minimum_password_length %>
12
+ <em class="test-sm text-gray-600">(<%= @minimum_password_length %> characters minimum)</em>
13
+ <% end %>
14
+ <%= f.password_field :password, autofocus: true, autocomplete: "new-password", class: "mt-1 p-2 w-full border rounded-md" %>
15
+ </div>
16
+
17
+ <div class="field">
18
+ <%= f.label :password_confirmation, "Confirm new password", class: "block font-bold text-gray-700" %>
19
+ <%= f.password_field :password_confirmation, autocomplete: "new-password", class: "mt-1 p-2 w-full border rounded-md" %>
20
+ </div>
21
+
22
+ <div class="actions">
23
+ <%= f.submit "Change my password", class: "w-full px-4 py-2 text-white bg-indigo-600 rounded hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 cursor-pointer" %>
24
+ </div>
25
+ <% end %>
26
+
27
+ <div class="mt-4">
28
+ <%= render "devise/shared/links" %>
29
+ </div>
30
+ </div>
@@ -0,0 +1,21 @@
1
+ <div class="my-8 p-4 w-full max-w-xl mx-auto shadow-xl rounded-md">
2
+
3
+ <h2 class="text-2xl text-center font-semibold mb-4">Forgot your password?</h2>
4
+
5
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post, class: "flex flex-col space-y-4" }) do |f| %>
6
+ <%= render "devise/shared/error_messages", resource: resource %>
7
+
8
+ <div class="field">
9
+ <%= f.label :email, class: "block font-bold text-gray-700" %>
10
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "mt-1 p-2 w-full border rounded-md" %>
11
+ </div>
12
+
13
+ <div class="actions">
14
+ <%= f.submit "Send me reset password instructions", class: "w-full px-4 py-2 text-white bg-indigo-600 rounded hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 cursor-pointer" %>
15
+ </div>
16
+ <% end %>
17
+
18
+ <div class="mt-4">
19
+ <%= render "devise/shared/links" %>
20
+ </div>
21
+ </div>
@@ -0,0 +1,47 @@
1
+ <div class="my-8 p-4 w-full max-w-xl mx-auto shadow-xl rounded-md">
2
+
3
+ <h2 class="text-2xl text-center font-semibold mb-4">Edit <%= resource_name.to_s.humanize %></h2>
4
+
5
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put, class: "flex flex-col space-y-4" }) do |f| %>
6
+ <%= render "devise/shared/error_messages", resource: resource %>
7
+
8
+ <div class="field">
9
+ <%= f.label :email, class: "block font-bold text-gray-700" %>
10
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "mt-1 p-2 w-full border rounded-md" %>
11
+ </div>
12
+
13
+ <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
14
+ <div class="text-sm text-gray-600">Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
15
+ <% end %>
16
+
17
+ <div class="field">
18
+ <%= f.label :password, class: "block font-bold text-gray-700" %>
19
+ <span class="text-sm text-gray-600">(leave blank if you don't want to change it)</span>
20
+ <%= f.password_field :password, autocomplete: "new-password", class: "mt-1 p-2 w-full border rounded-md" %>
21
+ <% if @minimum_password_length %>
22
+ <span class="block text-sm text-gray-600 mt-1"><%= @minimum_password_length %> characters minimum</span>
23
+ <% end %>
24
+ </div>
25
+
26
+ <div class="field">
27
+ <%= f.label :password_confirmation, class: "block font-bold text-gray-700" %>
28
+ <%= f.password_field :password_confirmation, autocomplete: "new-password", class: "mt-1 p-2 w-full border rounded-md" %>
29
+ </div>
30
+
31
+ <div class="field">
32
+ <%= f.label :current_password, class: "block font-bold text-gray-700" %>
33
+ <span class="text-sm text-gray-600">(we need your current password to confirm your changes)</span>
34
+ <%= f.password_field :current_password, autocomplete: "current-password", class: "mt-1 p-2 w-full border rounded-md" %>
35
+ </div>
36
+
37
+ <div class="actions">
38
+ <%= f.submit "Update", class: "w-full px-4 py-2 text-white bg-indigo-600 rounded hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 cursor-pointer" %>
39
+ </div>
40
+ <% end %>
41
+
42
+ <h3 class="text-xl mt-6 mb-2">Cancel my account</h3>
43
+
44
+ <div class="text-gray-700 mb-4">Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?", turbo_confirm: "Are you sure?" }, method: :delete, class: "mt-1 px-4 py-2 bg-red-500 text-white rounded hover:bg-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 cursor-pointer" %></div>
45
+
46
+ <%= link_to "Back", :back, class: "text-indigo-600 hover:text-indigo-800 hover:underline transition" %>
47
+ </div>
@@ -0,0 +1,34 @@
1
+ <div class="my-8 p-4 w-full max-w-xl mx-auto shadow-xl rounded-md">
2
+
3
+ <h2 class="text-2xl text-center font-semibold mb-4">Sign up</h2>
4
+
5
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { class: "flex flex-col space-y-4" }) do |f| %>
6
+ <%= render "devise/shared/error_messages", resource: resource %>
7
+
8
+ <div class="field">
9
+ <%= f.label :email, class: "block font-bold text-gray-700" %>
10
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "mt-1 p-2 w-full border rounded-md" %>
11
+ </div>
12
+
13
+ <div class="field">
14
+ <%= f.label :password, class: "block font-bold text-gray-700" %>
15
+ <% if @minimum_password_length %>
16
+ <em class="test-sm text-gray-600">(<%= @minimum_password_length %> characters minimum)</em>
17
+ <% end %>
18
+ <%= f.password_field :password, autocomplete: "new-password", class: "mt-1 p-2 w-full border rounded-md" %>
19
+ </div>
20
+
21
+ <div class="field">
22
+ <%= f.label :password_confirmation, class: "block font-bold text-gray-700" %>
23
+ <%= f.password_field :password_confirmation, autocomplete: "new-password", class: "mt-1 p-2 w-full border rounded-md" %>
24
+ </div>
25
+
26
+ <div class="actions">
27
+ <%= f.submit "Sign up", class: "w-full px-4 py-2 text-white bg-indigo-600 rounded hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 cursor-pointer" %>
28
+ </div>
29
+ <% end %>
30
+
31
+ <div class="mt-4">
32
+ <%= render "devise/shared/links" %>
33
+ </div>
34
+ </div>
@@ -0,0 +1,32 @@
1
+ <div class="my-8 p-4 w-full max-w-xl mx-auto shadow-xl rounded-md">
2
+ <h2 class="text-2xl text-center font-semibold mb-4">Log in</h2>
3
+
4
+ <%= form_for(resource, as: resource_name, url: session_path(resource_name), html: { class: "flex flex-col space-y-4" }) do |f| %>
5
+ <%= render 'devise/shared/alert_messages' %>
6
+
7
+ <div class="field">
8
+ <%= f.label :email, class: "block font-bold text-gray-700" %>
9
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "mt-1 p-2 w-full border rounded-md" %>
10
+ </div>
11
+
12
+ <div class="field">
13
+ <%= f.label :password, class: "block font-bold text-gray-700" %>
14
+ <%= f.password_field :password, autocomplete: "current-password", class: "mt-1 p-2 w-full border rounded-md" %>
15
+ </div>
16
+
17
+ <% if devise_mapping.rememberable? %>
18
+ <div class="field flex items-center">
19
+ <%= f.check_box :remember_me, class: "mr-2 h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded" %>
20
+ <%= f.label :remember_me, class: "text-gray-900" %>
21
+ </div>
22
+ <% end %>
23
+
24
+ <div class="actions">
25
+ <%= f.submit "Log in", class: "w-full px-4 py-2 text-white bg-indigo-600 rounded hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 cursor-pointer" %>
26
+ </div>
27
+ <% end %>
28
+
29
+ <div class="mt-4">
30
+ <%= render "devise/shared/links" %>
31
+ </div>
32
+ </div>
@@ -0,0 +1 @@
1
+ <div class="empty:hidden mb-4 p-4 rounded-md border border-solid border-red-600 bg-red-200 text-red-600"><%= alert %></div>
@@ -0,0 +1,15 @@
1
+ <% if resource.errors.any? %>
2
+ <div id="error_explanation" class="empty:hidden mb-4 p-4 rounded-md border border-solid border-red-600 bg-red-200 text-red-600" data-turbo-cache="false">
3
+ <h2 class="font-bold">
4
+ <%= I18n.t("errors.messages.not_saved",
5
+ count: resource.errors.count,
6
+ resource: resource.class.model_name.human.downcase)
7
+ %>
8
+ </h2>
9
+ <ul>
10
+ <% resource.errors.full_messages.each do |message| %>
11
+ <li><%= message %></li>
12
+ <% end %>
13
+ </ul>
14
+ </div>
15
+ <% end %>
@@ -0,0 +1,49 @@
1
+ <div class="space-y-2">
2
+
3
+ <!-- Sessions (Login) -->
4
+ <%- if controller_name != 'sessions' %>
5
+ <div>
6
+ <%= link_to "Log in", new_session_path(resource_name), class: "text-indigo-600 hover:text-indigo-800 hover:underline transition" %>
7
+ </div>
8
+ <% end %>
9
+
10
+ <!-- Registrations (Sign Up) -->
11
+ <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
12
+ <div>
13
+ <%= link_to "Sign up", new_registration_path(resource_name), class: "text-indigo-600 hover:text-indigo-800 hover:underline transition" %>
14
+ </div>
15
+ <% end %>
16
+
17
+ <!-- Password Recovery -->
18
+ <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
19
+ <div>
20
+ <%= link_to "Forgot your password?", new_password_path(resource_name), class: "text-indigo-600 hover:text-indigo-800 hover:underline transition" %>
21
+ </div>
22
+ <% end %>
23
+
24
+ <!-- Confirmation -->
25
+ <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
26
+ <div>
27
+ <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name), class: "text-indigo-600 hover:text-indigo-800 hover:underline transition" %>
28
+ </div>
29
+ <% end %>
30
+
31
+ <!-- Unlock -->
32
+ <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
33
+ <div>
34
+ <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name), class: "text-indigo-600 hover:text-indigo-800 hover:underline transition" %>
35
+ </div>
36
+ <% end %>
37
+
38
+ <!-- OmniAuth Providers -->
39
+ <%- if devise_mapping.omniauthable? %>
40
+ <div class="space-y-2 mt-4">
41
+ <%- resource_class.omniauth_providers.each do |provider| %>
42
+ <div>
43
+ <%= button_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), data: { turbo: false }, class: "px-4 py-2 text-white bg-blue-600 hover:bg-blue-700 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 cursor-pointer" %>
44
+ </div>
45
+ <% end %>
46
+ </div>
47
+ <% end %>
48
+
49
+ </div>
@@ -0,0 +1,21 @@
1
+ <div class="my-8 p-4 w-full max-w-xl mx-auto shadow-xl rounded-md">
2
+
3
+ <h2 class="text-2xl text-center font-semibold mb-4">Resend unlock instructions</h2>
4
+
5
+ <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post, class: "flex flex-col space-y-4" }) do |f| %>
6
+ <%= render "devise/shared/error_messages", resource: resource %>
7
+
8
+ <div class="field">
9
+ <%= f.label :email, class: "block font-bold text-gray-700" %>
10
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "mt-1 p-2 w-full border rounded-md" %>
11
+ </div>
12
+
13
+ <div class="actions">
14
+ <%= f.submit "Resend unlock instructions", class: "w-full px-4 py-2 text-white bg-indigo-600 rounded hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 cursor-pointer" %>
15
+ </div>
16
+ <% end %>
17
+
18
+ <div class="mt-4">
19
+ <%= render "devise/shared/links" %>
20
+ </div>
21
+ </div>
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/devise_template/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'devise_template'
7
+ spec.version = DeviseTemplate::VERSION
8
+ spec.authors = ['YutoYasunaga']
9
+ spec.email = ['yuto.yasunaga@gmail.com']
10
+
11
+ spec.summary = 'Generate Devise views styled with TailwindCSS or Bootstrap'
12
+ spec.description = 'A Rails gem to easily generate Devise views that are styled using either TailwindCSS or Bootstrap.'
13
+ spec.homepage = 'https://github.com/YutoYasunaga/devise_template'
14
+ spec.license = 'MIT'
15
+ spec.required_ruby_version = '>= 2.6.0'
16
+
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = spec.homepage
19
+
20
+ spec.files = Dir.chdir(__dir__) do
21
+ `git ls-files -z`.split("\x0").reject do |f|
22
+ (File.expand_path(f) == __FILE__) ||
23
+ f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile])
24
+ end
25
+ end
26
+ spec.bindir = 'exe'
27
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ['lib']
29
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DeviseTemplate
4
+ VERSION = '0.1.0'
5
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'devise_template/version'
4
+
5
+ module DeviseTemplate
6
+ class Error < StandardError; end
7
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DeviseTemplate
4
+ module Generators
5
+ class BootstrapGenerator < Rails::Generators::Base
6
+ source_root File.expand_path('../../../app/views/devise', __dir__)
7
+
8
+ def copy_views
9
+ directory 'bootstrap', 'app/views/devise'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DeviseTemplate
4
+ module Generators
5
+ class TailwindGenerator < Rails::Generators::Base
6
+ source_root File.expand_path('../../../app/views/devise', __dir__)
7
+
8
+ def copy_views
9
+ directory 'tailwind', 'app/views/devise'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,4 @@
1
+ module DeviseTemplate
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: devise_template
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - YutoYasunaga
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-09-02 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A Rails gem to easily generate Devise views that are styled using either
14
+ TailwindCSS or Bootstrap.
15
+ email:
16
+ - yuto.yasunaga@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - ".rspec"
22
+ - ".rubocop.yml"
23
+ - CODE_OF_CONDUCT.md
24
+ - LICENSE
25
+ - README.md
26
+ - Rakefile
27
+ - Screenshot.png
28
+ - app/views/devise/bootstrap/confirmations/new.html.erb
29
+ - app/views/devise/bootstrap/passwords/edit.html.erb
30
+ - app/views/devise/bootstrap/passwords/new.html.erb
31
+ - app/views/devise/bootstrap/registrations/edit.html.erb
32
+ - app/views/devise/bootstrap/registrations/new.html.erb
33
+ - app/views/devise/bootstrap/sessions/new.html.erb
34
+ - app/views/devise/bootstrap/shared/_alert_messages.html.erb
35
+ - app/views/devise/bootstrap/shared/_error_messages.html.erb
36
+ - app/views/devise/bootstrap/shared/_links.html.erb
37
+ - app/views/devise/bootstrap/unlocks/new.html.erb
38
+ - app/views/devise/tailwind/confirmations/new.html.erb
39
+ - app/views/devise/tailwind/passwords/edit.html.erb
40
+ - app/views/devise/tailwind/passwords/new.html.erb
41
+ - app/views/devise/tailwind/registrations/edit.html.erb
42
+ - app/views/devise/tailwind/registrations/new.html.erb
43
+ - app/views/devise/tailwind/sessions/new.html.erb
44
+ - app/views/devise/tailwind/shared/_alert_messages.html.erb
45
+ - app/views/devise/tailwind/shared/_error_messages.html.erb
46
+ - app/views/devise/tailwind/shared/_links.html.erb
47
+ - app/views/devise/tailwind/unlocks/new.html.erb
48
+ - devise_template.gemspec
49
+ - lib/devise_template.rb
50
+ - lib/devise_template/version.rb
51
+ - lib/generators/devise_template/bootstrap_generator.rb
52
+ - lib/generators/devise_template/tailwind_generator.rb
53
+ - sig/devise_template.rbs
54
+ homepage: https://github.com/YutoYasunaga/devise_template
55
+ licenses:
56
+ - MIT
57
+ metadata:
58
+ homepage_uri: https://github.com/YutoYasunaga/devise_template
59
+ source_code_uri: https://github.com/YutoYasunaga/devise_template
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 2.6.0
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubygems_version: 3.4.18
76
+ signing_key:
77
+ specification_version: 4
78
+ summary: Generate Devise views styled with TailwindCSS or Bootstrap
79
+ test_files: []