tailwind_views_generator 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.fasterer.yml +23 -0
- data/.gitignore +11 -0
- data/.rubocop.yml +34 -0
- data/.simplecov +9 -0
- data/.tool-versions +1 -0
- data/.yardopts +12 -0
- data/CHANGELOG.md +10 -0
- data/CODE_OF_CONDUCT.md +22 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +98 -0
- data/LICENSE.txt +21 -0
- data/README.md +121 -0
- data/Rakefile +16 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/generators/tailwind_views/devise_generator.rb +52 -0
- data/lib/generators/tailwind_views/install_generator.rb +134 -0
- data/lib/tailwind_views_generator.rb +10 -0
- data/lib/tailwind_views_generator/helpers.rb +15 -0
- data/lib/tailwind_views_generator/version.rb +6 -0
- data/lib/templates/.DS_Store +0 -0
- data/lib/templates/devise/.DS_Store +0 -0
- data/lib/templates/devise/erb/confirmations/new.html.erb.tt +25 -0
- data/lib/templates/devise/erb/mailer/confirmation_instructions.html.erb +5 -0
- data/lib/templates/devise/erb/mailer/email_changed.html.erb +7 -0
- data/lib/templates/devise/erb/mailer/password_change.html.erb +3 -0
- data/lib/templates/devise/erb/mailer/reset_password_instructions.html.erb +8 -0
- data/lib/templates/devise/erb/mailer/unlock_instructions.html.erb +7 -0
- data/lib/templates/devise/erb/passwords/edit.html.erb.tt +33 -0
- data/lib/templates/devise/erb/passwords/new.html.erb.tt +23 -0
- data/lib/templates/devise/erb/registrations/edit.html.erb.tt +53 -0
- data/lib/templates/devise/erb/registrations/new.html.erb.tt +37 -0
- data/lib/templates/devise/erb/sessions/new.html.erb.tt +36 -0
- data/lib/templates/devise/erb/shared/_error_messages.html.erb +15 -0
- data/lib/templates/devise/erb/shared/_links.html.erb +28 -0
- data/lib/templates/devise/erb/unlocks/new.html.erb.tt +24 -0
- data/lib/templates/devise/haml/confirmations/new.html.haml.tt +15 -0
- data/lib/templates/devise/haml/mailer/confirmation_instructions.html.haml +3 -0
- data/lib/templates/devise/haml/mailer/email_changed.html.haml +7 -0
- data/lib/templates/devise/haml/mailer/password_change.html.haml +2 -0
- data/lib/templates/devise/haml/mailer/reset_password_instructions.html.haml +5 -0
- data/lib/templates/devise/haml/mailer/unlock_instructions.html.haml +4 -0
- data/lib/templates/devise/haml/passwords/edit.html.haml.tt +23 -0
- data/lib/templates/devise/haml/passwords/new.html.haml.tt +15 -0
- data/lib/templates/devise/haml/registrations/edit.html.haml.tt +42 -0
- data/lib/templates/devise/haml/registrations/new.html.haml.tt +27 -0
- data/lib/templates/devise/haml/sessions/new.html.haml.tt +25 -0
- data/lib/templates/devise/haml/shared/_error_messages.html.haml +6 -0
- data/lib/templates/devise/haml/shared/_links.html.haml +20 -0
- data/lib/templates/devise/haml/unlocks/new.html.haml.tt +16 -0
- data/lib/templates/devise/simple_form/erb/confirmations/new.html.erb.tt +18 -0
- data/lib/templates/devise/simple_form/erb/passwords/edit.html.erb.tt +20 -0
- data/lib/templates/devise/simple_form/erb/passwords/new.html.erb.tt +17 -0
- data/lib/templates/devise/simple_form/erb/registrations/edit.html.erb.tt +27 -0
- data/lib/templates/devise/simple_form/erb/registrations/new.html.erb.tt +19 -0
- data/lib/templates/devise/simple_form/erb/sessions/new.html.erb.tt +18 -0
- data/lib/templates/devise/simple_form/erb/unlocks/new.html.erb.tt +17 -0
- data/lib/templates/devise/simple_form/haml/confirmations/new.html.haml.tt +13 -0
- data/lib/templates/devise/simple_form/haml/passwords/edit.html.haml.tt +15 -0
- data/lib/templates/devise/simple_form/haml/passwords/new.html.haml.tt +12 -0
- data/lib/templates/devise/simple_form/haml/registrations/edit.html.haml.tt +21 -0
- data/lib/templates/devise/simple_form/haml/registrations/new.html.haml.tt +14 -0
- data/lib/templates/devise/simple_form/haml/sessions/new.html.haml.tt +13 -0
- data/lib/templates/devise/simple_form/haml/unlocks/new.html.haml.tt +12 -0
- data/lib/templates/devise/simple_form/slim/confirmations/new.html.slim.tt +13 -0
- data/lib/templates/devise/simple_form/slim/passwords/edit.html.slim.tt +15 -0
- data/lib/templates/devise/simple_form/slim/passwords/new.html.slim.tt +12 -0
- data/lib/templates/devise/simple_form/slim/registrations/edit.html.slim.tt +21 -0
- data/lib/templates/devise/simple_form/slim/registrations/new.html.slim.tt +14 -0
- data/lib/templates/devise/simple_form/slim/sessions/new.html.slim.tt +13 -0
- data/lib/templates/devise/simple_form/slim/unlocks/new.html.slim.tt +12 -0
- data/lib/templates/devise/slim/confirmations/new.html.slim.tt +16 -0
- data/lib/templates/devise/slim/mailer/confirmation_instructions.html.slim +3 -0
- data/lib/templates/devise/slim/mailer/email_changed.html.slim +5 -0
- data/lib/templates/devise/slim/mailer/password_change.html.slim +2 -0
- data/lib/templates/devise/slim/mailer/reset_password_instructions.html.slim +5 -0
- data/lib/templates/devise/slim/mailer/unlock_instructions.html.slim +4 -0
- data/lib/templates/devise/slim/passwords/edit.html.slim.tt +24 -0
- data/lib/templates/devise/slim/passwords/new.html.slim.tt +16 -0
- data/lib/templates/devise/slim/registrations/edit.html.slim.tt +43 -0
- data/lib/templates/devise/slim/registrations/new.html.slim.tt +28 -0
- data/lib/templates/devise/slim/sessions/new.html.slim.tt +26 -0
- data/lib/templates/devise/slim/shared/_error_messages.html.slim +6 -0
- data/lib/templates/devise/slim/shared/_links.html.slim +20 -0
- data/lib/templates/devise/slim/unlocks/new.html.slim.tt +17 -0
- data/lib/templates/layouts/application.html.erb.tt +36 -0
- data/lib/templates/layouts/application.html.haml.tt +32 -0
- data/lib/templates/layouts/application.html.slim.tt +31 -0
- data/lib/templates/scaffolds/erb/_form.html.erb +22 -0
- data/lib/templates/scaffolds/erb/edit.html.erb.tt +13 -0
- data/lib/templates/scaffolds/erb/index.html.erb.tt +38 -0
- data/lib/templates/scaffolds/erb/new.html.erb.tt +14 -0
- data/lib/templates/scaffolds/erb/show.html.erb.tt +20 -0
- data/lib/templates/scaffolds/haml/_form.html.haml +17 -0
- data/lib/templates/scaffolds/haml/edit.html.haml.tt +13 -0
- data/lib/templates/scaffolds/haml/index.html.haml.tt +29 -0
- data/lib/templates/scaffolds/haml/new.html.haml.tt +10 -0
- data/lib/templates/scaffolds/haml/show.html.haml.tt +18 -0
- data/lib/templates/scaffolds/simple_form/_form.html.erb +9 -0
- data/lib/templates/scaffolds/simple_form/_form.html.haml +9 -0
- data/lib/templates/scaffolds/simple_form/_form.html.slim +9 -0
- data/lib/templates/scaffolds/slim/_form.html.slim +17 -0
- data/lib/templates/scaffolds/slim/edit.html.slim.tt +13 -0
- data/lib/templates/scaffolds/slim/index.html.slim.tt +29 -0
- data/lib/templates/scaffolds/slim/new.html.slim.tt +11 -0
- data/lib/templates/scaffolds/slim/show.html.slim.tt +18 -0
- data/lib/templates/shared/footer/_footer.html.erb.tt +5 -0
- data/lib/templates/shared/footer/_footer.html.haml.tt +3 -0
- data/lib/templates/shared/footer/_footer.html.slim.tt +3 -0
- data/lib/templates/shared/navigation/_navigation.html.erb.tt +32 -0
- data/lib/templates/shared/navigation/_navigation.html.haml.tt +23 -0
- data/lib/templates/shared/navigation/_navigation.html.slim.tt +23 -0
- data/lib/templates/shared/pagination/_pagination.html.erb +5 -0
- data/lib/templates/shared/pagination/_pagination.html.haml +3 -0
- data/lib/templates/shared/pagination/_pagination.html.slim +3 -0
- data/tailwind_views_generator.gemspec +38 -0
- metadata +223 -0
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails/generators'
|
4
|
+
|
5
|
+
module TailwindViews
|
6
|
+
module Generators
|
7
|
+
# Generator to run to add devise templates to the application
|
8
|
+
class DeviseGenerator < ::Rails::Generators::Base
|
9
|
+
include TailwindViewsGenerator::Helpers
|
10
|
+
hide!
|
11
|
+
desc 'Overwrite default devise views'
|
12
|
+
source_root ::File.expand_path('../../templates/devise', __dir__)
|
13
|
+
|
14
|
+
class_option :template_engine, type: :string, default: 'erb', aliases: '-t', enum: %w[erb slim haml],
|
15
|
+
desc: 'Set template engine to generate the views with'
|
16
|
+
|
17
|
+
class_option :metatags, type: :boolean, default: false, aliases: '-m',
|
18
|
+
desc: 'If views will assign pages title using metatags gem'
|
19
|
+
|
20
|
+
class_option :simpleform, type: :boolean, default: false, aliases: '-sf',
|
21
|
+
desc: 'Enable SimpleForms for the form generating'
|
22
|
+
|
23
|
+
def install
|
24
|
+
template "#{file_template_location('confirmations/new')}.tt", "app/views/devise/confirmations/new.html.#{options[:template_engine]}", force: true
|
25
|
+
directory "#{options[:template_engine]}/mailer", 'app/views/devise/mailer', force: true
|
26
|
+
|
27
|
+
%i[edit new].map do |file|
|
28
|
+
template "#{file_template_location("passwords/#{file}")}.tt", "app/views/devise/passwords/#{file}.html.#{options[:template_engine]}", force: true
|
29
|
+
template "#{file_template_location("registrations/#{file}")}.tt", "app/views/devise/registrations/#{file}.html.#{options[:template_engine]}", force: true
|
30
|
+
end
|
31
|
+
template "#{file_template_location('sessions/new')}.tt", "app/views/devise/sessions/new.html.#{options[:template_engine]}", force: true
|
32
|
+
template "#{file_template_location('unlocks/new')}.tt", "app/views/devise/unlocks/new.html.#{options[:template_engine]}", force: true
|
33
|
+
directory "#{options[:template_engine]}/shared", 'app/views/devise/shared', force: true
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def file_template_location(file_location = '')
|
39
|
+
return '' if file_location.blank?
|
40
|
+
|
41
|
+
# Depending if simpleform is to be used, it will return a path similar to one of the following:
|
42
|
+
# => slim/unlocks/new.html.slim || simple_form/slim/unlocks/new.html.slim
|
43
|
+
"#{simple_path}#{options[:template_engine]}/#{file_location}.html.#{options[:template_engine]}"
|
44
|
+
end
|
45
|
+
|
46
|
+
# If simpleform is going ot be used with the forms return a simple_form path
|
47
|
+
def simple_path
|
48
|
+
options[:simpleform] ? 'simple_form/' : ''
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails/generators'
|
4
|
+
require_relative 'devise_generator'
|
5
|
+
require_relative '../../tailwind_views_generator/helpers'
|
6
|
+
|
7
|
+
module TailwindViews
|
8
|
+
module Generators
|
9
|
+
# Generate scaffolds and views for tailwind
|
10
|
+
class InstallGenerator < ::Rails::Generators::Base
|
11
|
+
include TailwindViewsGenerator::Helpers
|
12
|
+
desc 'Override default view scaffolding with Tailwind based scaffolds'
|
13
|
+
source_root ::File.expand_path('../../templates', __dir__)
|
14
|
+
class_option :template_engine, type: :string, default: 'erb', aliases: '-t', enum: %w[erb slim haml],
|
15
|
+
desc: 'The template_engine to use for generating the applications views (Erb, Slim, HAML)'
|
16
|
+
|
17
|
+
# Boolean flags that can be flagged by adding to the generator call ie: --pagination or --metag_tags
|
18
|
+
class_option :devise, type: :boolean, default: false,
|
19
|
+
desc: 'If views for devise will be required by the generator'
|
20
|
+
|
21
|
+
class_option :layout, type: :boolean, default: false, aliases: '-l',
|
22
|
+
desc: 'Over-write your application layout file with a bootstrap based layout'
|
23
|
+
|
24
|
+
class_option :metatags, type: :boolean, default: false, aliases: '-m',
|
25
|
+
desc: 'If views will assign pages title using metatags gem'
|
26
|
+
|
27
|
+
class_option :pagination, type: :boolean, default: false, aliases: '-p',
|
28
|
+
desc: 'Toggle if pagination will be used with the index view/controller (based off of Pagy)'
|
29
|
+
|
30
|
+
class_option :simpleform, type: :boolean, default: false, aliases: '-sf',
|
31
|
+
desc: 'Enable SimpleForms for the form generating'
|
32
|
+
|
33
|
+
class_option :skip_javascript, type: :boolean, default: false,
|
34
|
+
desc: 'Skip adding javascript_include_tag or javascript_pack_tag to the layouts'
|
35
|
+
|
36
|
+
class_option :skip_turbolinks, type: :boolean, default: false,
|
37
|
+
desc: 'Skip associating assets and views with turbolinks'
|
38
|
+
|
39
|
+
def copy_scaffold_views
|
40
|
+
%w[edit index show new].each do |file|
|
41
|
+
template("scaffolds/#{options[:template_engine]}/#{file}.html.#{options[:template_engine]}",
|
42
|
+
"lib/templates/#{options[:template_engine]}/scaffold/#{file}.html.#{options[:template_engine]}",
|
43
|
+
force: true)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def copy_form
|
48
|
+
if options[:simpleform]
|
49
|
+
copy_file("scaffolds/simple_form/_form.html.#{options[:template_engine]}",
|
50
|
+
"lib/templates/#{options[:template_engine]}/scaffold/_form.html.#{options[:template_engine]}", force: true)
|
51
|
+
else
|
52
|
+
copy_file("scaffolds/#{options[:template_engine]}/_form.html.#{options[:template_engine]}",
|
53
|
+
"lib/templates/#{options[:template_engine]}/scaffold/_form.html.#{options[:template_engine]}", force: true)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def copy_layout_views
|
58
|
+
return unless options[:layout]
|
59
|
+
|
60
|
+
template("layouts/application.html.#{options[:template_engine]}.tt",
|
61
|
+
"app/views/layouts/application.html.#{options[:template_engine]}", force: true)
|
62
|
+
end
|
63
|
+
|
64
|
+
def copy_shared_views
|
65
|
+
%w[footer navigation].each do |template_file|
|
66
|
+
template("shared/#{template_file}/_#{template_file}.html.#{options[:template_engine]}.tt",
|
67
|
+
"app/views/shared/_#{template_file}.html.#{options[:template_engine]}", force: true)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def copy_pagination_view
|
72
|
+
return unless options[:pagination]
|
73
|
+
|
74
|
+
copy_file("shared/pagination/_pagination.html.#{options[:template_engine]}",
|
75
|
+
"app/views/shared/_pagination.html.#{options[:template_engine]}", force: true)
|
76
|
+
end
|
77
|
+
|
78
|
+
def inject_application_helpers
|
79
|
+
pagy_helper = (options[:pagination] ? 'include Pagy::Frontend' : '')
|
80
|
+
helper_str = <<~HELPER
|
81
|
+
#{pagy_helper}
|
82
|
+
|
83
|
+
FLASH_TYPE_HASH = { success: 'green', error: 'yellow', alert: 'red', notice: 'indigo' }.freeze
|
84
|
+
|
85
|
+
def alert_color(flash_type)
|
86
|
+
(FLASH_TYPE_HASH[flash_type.to_sym] || flash_type.to_s)
|
87
|
+
end
|
88
|
+
|
89
|
+
def flash_messages(_opts = [])
|
90
|
+
return '' unless flash.any?
|
91
|
+
|
92
|
+
# remove any blank devise timeout errors
|
93
|
+
flash.delete(:timedout)
|
94
|
+
flash.each do |msg_type, message|
|
95
|
+
# You don't need to create an empty alert message
|
96
|
+
next if message.blank? || message.to_s.length.zero?
|
97
|
+
|
98
|
+
concat(tag.div(class: "bg-\#{alert_color(msg_type)}-50 p-5 lg:w-full rounded border-l-4 border-\#{alert_color(msg_type)}-400 mb-5", role: 'alert') do
|
99
|
+
concat(tag.p(message, class: "text-sm text-\#{alert_color(msg_type)}-500"))
|
100
|
+
end)
|
101
|
+
end
|
102
|
+
nil
|
103
|
+
end
|
104
|
+
|
105
|
+
# for outputting an objects error messages
|
106
|
+
def errors_for(object)
|
107
|
+
return '' unless object.errors.any?
|
108
|
+
|
109
|
+
content_tag(:div, class: 'text-sm bg-red-50 rounded p-5 mb-5') do
|
110
|
+
concat(content_tag(:div, class: 'text-red-600 font-medium') do
|
111
|
+
concat "\#{pluralize(object.errors.count, 'error')} prohibited this \#{object.class.name.downcase} from being saved:"
|
112
|
+
end)
|
113
|
+
concat(content_tag(:ul, class: 'px-0 text-red-500 italic font-sm') do
|
114
|
+
object.errors.full_messages.each do |msg|
|
115
|
+
concat content_tag(:li, msg, class: 'list-disc px-0 py-1 mx-4')
|
116
|
+
end
|
117
|
+
end)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
HELPER
|
121
|
+
|
122
|
+
inject_into_file('app/helpers/application_helper.rb',
|
123
|
+
optimize_indentation(helper_str, 2),
|
124
|
+
after: "module ApplicationHelper\n",
|
125
|
+
force: true)
|
126
|
+
end
|
127
|
+
|
128
|
+
def invoke_devise_generator
|
129
|
+
# Generate tailwind based devise views if devise is being used
|
130
|
+
invoke('tailwind_views:devise') if options[:devise]
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module TailwindViewsGenerator
|
4
|
+
module Helpers
|
5
|
+
# Return a cleaned up version of the name of the application being generated
|
6
|
+
# @return [String]
|
7
|
+
def app_name
|
8
|
+
@app_name ||= if Rails.version.to_f >= 6.0
|
9
|
+
Rails.app_class.module_parent_name.demodulize.titleize
|
10
|
+
else
|
11
|
+
Rails.application.class.parent.to_s.titleize
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
Binary file
|
Binary file
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<div class="md:mx-auto md:max-w-md overflow-hidden mx-0">
|
2
|
+
<div class="shadow-md rounded px-8 pt-6 pb-8 mb-4 flex flex-col justify-center bg-gray-50">
|
3
|
+
<h2 class="text-center text-xl text-black">
|
4
|
+
<%- if options[:metatags] -%>
|
5
|
+
<%%%= title('Resend confirmation instructions') %>
|
6
|
+
<%- else -%>
|
7
|
+
Resend confirmation instructions
|
8
|
+
<%- end -%>
|
9
|
+
</h2>
|
10
|
+
|
11
|
+
<%%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
|
12
|
+
<%%= render 'devise/shared/error_messages', resource: resource %>
|
13
|
+
|
14
|
+
<div class="mb-4">
|
15
|
+
<%%= f.label :email, class: 'text-sm font-medium text-gray-600' %>
|
16
|
+
<%%= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email), class: 'shadow appearance-none border border-gray-300 rounded w-full py-2 px-3 bg-white focus:outline-none focus:ring-0 focus:border-blue-500 text-gray-400 leading-6 transition-colors duration-200 ease-in-out' %>
|
17
|
+
</div>
|
18
|
+
<%%= f.submit "Resend confirmation instructions" %>
|
19
|
+
|
20
|
+
<%%= f.submit "Resend confirmation instructions" class: 'my-2 bg-blue-500 hover:bg-blue-700 text-white font-bold text-sm py-2 px-4 rounded w-full' %>
|
21
|
+
<%% end %>
|
22
|
+
|
23
|
+
<%%= render 'devise/shared/links' %>
|
24
|
+
</div>
|
25
|
+
</div>
|
@@ -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,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,33 @@
|
|
1
|
+
<div class="md:mx-auto md:max-w-md overflow-hidden mx-0">
|
2
|
+
<div class=" shadow-md rounded px-8 pt-6 pb-8 mb-4 flex flex-col justify-center bg-gray-50">
|
3
|
+
<h2 class="text-center text-xl text-black">
|
4
|
+
<%- if options[:metatags] -%>
|
5
|
+
<%%= title('Change your password') %>
|
6
|
+
<%- else -%>
|
7
|
+
Change your password
|
8
|
+
<%- end -%>
|
9
|
+
</h2>
|
10
|
+
|
11
|
+
<%%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
|
12
|
+
<%%= render 'devise/shared/error_messages', resource: resource %>
|
13
|
+
<%%= f.hidden_field :reset_password_token %>
|
14
|
+
|
15
|
+
<div class="mb-4">
|
16
|
+
<%%= f.label :password, "New password", class: 'text-sm font-medium text-gray-600' %>
|
17
|
+
<%% if @minimum_password_length %>
|
18
|
+
<em>(<%%= @minimum_password_length %> characters minimum)</em><br />
|
19
|
+
<%% end %>
|
20
|
+
<%%= f.password_field :password, autofocus: true, autocomplete: "new-password", class: 'text-sm font-medium text-gray-600' %>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div class="mb-4">
|
24
|
+
<%%= f.label :password_confirmation, "Confirm new password", class: 'text-sm font-medium text-gray-600' %>
|
25
|
+
<%%= f.password_field :password_confirmation, autocomplete: "new-password", class: 'text-sm font-medium text-gray-600' %>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<%%= f.submit "Change my password" class: 'my-2 bg-blue-500 hover:bg-blue-700 text-white font-bold text-sm py-2 px-4 rounded w-full' %>
|
29
|
+
<%% end %>
|
30
|
+
|
31
|
+
<%%= render 'devise/shared/links' %>
|
32
|
+
</div>
|
33
|
+
</div>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<div class="md:mx-auto md:max-w-md overflow-hidden mx-0">
|
2
|
+
<div class=" shadow-md rounded px-8 pt-6 pb-8 mb-4 flex flex-col justify-center bg-gray-50">
|
3
|
+
<h2 class="text-center text-xl text-black">
|
4
|
+
<%- if options[:metatags] -%>
|
5
|
+
<%%= title('Forgot your password?') %>
|
6
|
+
<%- else -%>
|
7
|
+
Forget your password?
|
8
|
+
<%- end -%>
|
9
|
+
</h2>
|
10
|
+
|
11
|
+
<%%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
|
12
|
+
<%%= render 'devise/shared/error_messages', resource: resource %>
|
13
|
+
<div class="mb-4">
|
14
|
+
<%%= f.label :email, class: 'block email optional text-sm font-medium text-gray-600' %>
|
15
|
+
<%%= f.email_field :email, autofocus: true, autocomplete: 'email', class: 'shadow appearance-none border border-gray-300 rounded w-full py-2 px-3 bg-white focus:outline-none focus:ring-0 focus:border-blue-500 text-gray-400 leading-6 transition-colors duration-200 ease-in-out string' %>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<%%= f.submit 'Send me reset password instructions', class: 'my-2 bg-blue-500 hover:bg-blue-700 text-white font-bold text-sm py-2 px-4 rounded w-full' %>
|
19
|
+
<%% end %>
|
20
|
+
|
21
|
+
<%%= render 'devise/shared/links' %>
|
22
|
+
</div>
|
23
|
+
</div>
|
@@ -0,0 +1,53 @@
|
|
1
|
+
<div class="md:mx-auto md:max-w-md overflow-hidden mx-0">
|
2
|
+
<div class=" shadow-md rounded px-8 pt-6 pb-8 mb-4 flex flex-col justify-center bg-gray-50">
|
3
|
+
<h2 class="text-center text-xl text-black">
|
4
|
+
<%- if options[:metatags] -%>
|
5
|
+
<%%= title("Edit #{resource_name.to_s.humanize}") %>
|
6
|
+
<%- else -%>
|
7
|
+
Edit <%%= resource_name.to_s.humanize %>
|
8
|
+
<%- end -%>
|
9
|
+
</h2>
|
10
|
+
<hr class="my-5">
|
11
|
+
|
12
|
+
<%%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
|
13
|
+
<%%= render 'devise/shared/error_messages', resource: resource %>
|
14
|
+
|
15
|
+
<div class="mb-4">
|
16
|
+
<%%= f.label :email, class: 'block email text-sm font-medium text-gray-600' %>
|
17
|
+
<%%= f.email_field :email, autofocus: true, autocomplete: 'email', class: 'shadow appearance-none border border-gray-300 rounded w-full py-2 px-3 bg-white focus:outline-none focus:ring-0 focus:border-blue-500 text-gray-400 leading-6 transition-colors duration-200 ease-in-out string' %>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<%% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
|
21
|
+
<div>Currently waiting confirmation for: <%%= resource.unconfirmed_email %></div>
|
22
|
+
<%% end %>
|
23
|
+
|
24
|
+
<div class="mb-4">
|
25
|
+
<%%= f.label :password, class: 'block password text-sm font-medium text-gray-600' %>
|
26
|
+
<%%= f.password_field :password, autocomplete: 'new-password', class: 'shadow appearance-none border border-gray-300 rounded w-full py-2 px-3 bg-white focus:outline-none focus:ring-0 focus:border-blue-500 text-gray-400 leading-6 transition-colors duration-200 ease-in-out string' %>
|
27
|
+
<p class="mt-2 text-grey-700 text-xs italic">Leave it blank if you don't want to change it</p>
|
28
|
+
<%% if @minimum_password_length %>
|
29
|
+
<br />
|
30
|
+
<em><%%= @minimum_password_length %> characters minimum</em>
|
31
|
+
<%% end %>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<div class="mb-4">
|
35
|
+
<%%= f.label :password_confirmation, class: 'block password text-sm font-medium text-gray-600' %>
|
36
|
+
<%%= f.password_field :password_confirmation, autocomplete: 'new-password', class: 'shadow appearance-none border border-gray-300 rounded w-full py-2 px-3 bg-white focus:outline-none focus:ring-0 focus:border-blue-500 text-gray-400 leading-6 transition-colors duration-200 ease-in-out string' %>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div class="mb-4">
|
40
|
+
<%%= f.label :current_password, class: 'block password text-sm font-medium text-gray-600' %>
|
41
|
+
<%%= f.password_field :current_password, autocomplete: 'current-password', class: 'shadow appearance-none border border-gray-300 rounded w-full py-2 px-3 bg-white focus:outline-none focus:ring-0 focus:border-blue-500 text-gray-400 leading-6 transition-colors duration-200 ease-in-out string' %>
|
42
|
+
<p class="mt-2 text-grey-700 text-xs italic">We need your current password to confirm your changes</p>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<%%= f.submit 'Update', class: 'my-2 bg-blue-500 hover:bg-blue-700 text-white font-bold text-sm py-2 px-4 rounded w-full' %>
|
46
|
+
<%% end %>
|
47
|
+
<hr class="my-5" />
|
48
|
+
<%%= button_to 'Cancel my account', registration_path(resource_name), class: 'my-2 bg-red-500 hover:bg-red-700 text-white font-bold text-sm py-2 px-4 rounded w-full', data: { confirm: 'Are you sure? You cannot undo this.' }, method: :delete %>
|
49
|
+
|
50
|
+
<hr class="my-5" />
|
51
|
+
<%%= link_to "Back", :back %>
|
52
|
+
</div>
|
53
|
+
</div>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<div class="md:mx-auto md:max-w-md overflow-hidden mx-0">
|
2
|
+
<div class=" shadow-md rounded px-8 pt-6 pb-8 mb-4 flex flex-col justify-center bg-gray-50">
|
3
|
+
<h2 class="text-center text-xl text-black">
|
4
|
+
<%- if options[:metatags] -%>
|
5
|
+
<%%= title('Sign Up') %>
|
6
|
+
<%- else -%>
|
7
|
+
Sign Up
|
8
|
+
<%- end -%>
|
9
|
+
</h2>
|
10
|
+
|
11
|
+
<%%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
|
12
|
+
<%%= render 'devise/shared/error_messages', resource: resource %>
|
13
|
+
|
14
|
+
<div class="mb-4">
|
15
|
+
<%%= f.label :email, class: 'block email optional text-sm font-medium text-gray-600' %>
|
16
|
+
<%%= f.email_field :email, autofocus: true, autocomplete: 'email', class: 'shadow appearance-none border border-gray-300 rounded w-full py-2 px-3 bg-white focus:outline-none focus:ring-0 focus:border-blue-500 text-gray-400 leading-6 transition-colors duration-200 ease-in-out string' %>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div class="mb-4">
|
20
|
+
<%%= f.label :password, class: 'block email optional text-sm font-medium text-gray-600' %>
|
21
|
+
<%% if @minimum_password_length %>
|
22
|
+
<em>(<%%= @minimum_password_length %> characters minimum)</em>
|
23
|
+
<%% end %>
|
24
|
+
<%%= f.password_field :password, autocomplete: 'new-password', class: 'shadow appearance-none border border-gray-300 rounded w-full py-2 px-3 bg-white focus:outline-none focus:ring-0 focus:border-blue-500 text-gray-400 leading-6 transition-colors duration-200 ease-in-out string' %>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<div class="mb-4">
|
28
|
+
<%%= f.label :password_confirmation, class: 'block email optional text-sm font-medium text-gray-600' %>
|
29
|
+
<%%= f.password_field :password_confirmation, autocomplete: 'new-password', class: 'shadow appearance-none border border-gray-300 rounded w-full py-2 px-3 bg-white focus:outline-none focus:ring-0 focus:border-blue-500 text-gray-400 leading-6 transition-colors duration-200 ease-in-out string' %>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<%%= f.submit 'Sign Up', class: 'my-2 bg-blue-500 hover:bg-blue-700 text-white font-bold text-sm py-2 px-4 rounded w-full' %>
|
33
|
+
<%% end %>
|
34
|
+
|
35
|
+
<%%= render 'devise/shared/links' %>
|
36
|
+
</div>
|
37
|
+
</div>
|