scoping devise

This commit is contained in:
Torsten 2022-12-21 17:30:29 +02:00
parent 0398a20861
commit d6606f05bb
13 changed files with 38 additions and 41 deletions

View File

@ -10,11 +10,6 @@ class MembersController < ApplicationController
def show
end
# GET /members/new
def new
@member = Member.new
end
# GET /members/1/edit
def edit
end

View File

@ -3,7 +3,7 @@
%h1.font-hairline.mb-6.text-center Resend Confirmation Instructions
= form_for(resource, |
as: resource_name, |
url: confirmation_path(resource_name), |
url: main_app.confirmation_path(resource_name), |
html: { |
method: :post, |
class: "bg-white mb-4 px-8 pt-6 pb-8 rounded shadow-md" |

View File

@ -1,19 +1,15 @@
.flex.justify-center
.w-full.max-w-xs
%h2.font-hairline.mb-6.text-center Change Your Password
= form_for(resource, |
as: resource_name, |
url: member_password_path(resource_name), |
html: { |
method: :put, |
class: "bg-white mb-4 px-8 pt-6 pb-8 rounded shadow-md" |
} |
) do |f| |
= form_for(resource,
as: resource_name,
html: { method: :put, class: "bg-white mb-4 px-8 pt-6 pb-8 rounded shadow-md" },
url: member_password_path(resource_name) ) do |f|
= render "devise/shared/error_messages", resource: resource
= f.hidden_field :reset_password_token
.mb-4
= f.label :password, "New Password", |
class: "block font-bold mb-2 text-gray-700 text-sm" |
= f.label :password, "New Password",
class: "block font-bold mb-2 text-gray-700 text-sm"
- if @minimum_password_length
%small
%em.text-gray-600
@ -21,16 +17,16 @@
= f.password_field :password, |
autofocus: true, |
autocomplete: "new-password", |
class: "appearance-none border leading-tight focus:outline-none px-3 py-2 rounded shadow focus:shadow-outline text-gray-700 w-full" |
class: "appearance-none border leading-tight focus:outline-none px-3 py-2 rounded shadow focus:shadow-outline text-gray-700 w-full"
.mb-4
= f.label :password_confirmation, |
"Confirm New Password", |
class: "block font-bold mb-2 text-gray-700 text-sm" |
= f.label :password_confirmation,
"Confirm New Password",
class: "block font-bold mb-2 text-gray-700 text-sm"
= f.password_field :password_confirmation, |
autocomplete: "off", |
class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 mb-3 leading-tight focus:outline-none focus:shadow-outline" |
class: "shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 mb-3 leading-tight focus:outline-none focus:shadow-outline"
.mb-4
= f.submit "Change My Password", |
class: "button bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline w-full" |
class: "button bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline w-full"
= render "devise/shared/links"
= render "devise/shared/form_footer"

View File

@ -3,7 +3,7 @@
%h1.font-hairline.mb-6.text-center Forgot your password?
= form_for(resource, |
as: resource_name, |
url: password_path(resource_name), |
url: main_app.password_path(resource_name), |
html: { |
method: :post, |
class: "bg-white mb-4 px-8 pt-6 pb-8 rounded shadow-md" |

View File

@ -4,7 +4,7 @@
Edit #{resource_name.to_s.humanize}
= form_for(resource, |
as: resource_name, |
url: registration_path(resource_name), |
url: main_app.registration_path(resource_name), |
html: { |
method: :put, |
class: "bg-white mb-4 px-8 pt-6 pb-8 rounded shadow-md" |
@ -40,5 +40,5 @@
= f.submit "Update", class: "button bg-blue-500 hover:bg-blue-700 font-bold text-white focus:outline-none py-2 px-4 rounded focus:shadow-outline w-full"
%p
Unhappy?
%span= button_to "Delete my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete
%span= button_to "Delete my account", main_app.registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete
= link_to "Back", :back

View File

@ -3,12 +3,18 @@
%h1.font-hairline.mb-6.text-center Sign Up
= form_for(resource, |
as: resource_name, |
url: registration_path(resource_name), |
url: main_app.registration_path(resource_name), |
html: { |
class: "bg-white mb-4 px-8 pt-6 pb-8 rounded shadow-md" |
} |
) do |f| |
= render "devise/shared/error_messages", resource: resource
.mb-4
= f.label :name, class: "block font-bold mb-2 text-gray-700 text-sm"
= f.text_field :name, |
autocomplete: "name", |
placeholder: "Pekka Juustonen", |
class: "appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none shadow focus:shadow-outline" |
.mb-4
= f.label :email, class: "block font-bold mb-2 text-gray-700 text-sm"
= f.email_field :email, |

View File

@ -3,7 +3,7 @@
%h1.font-hairline.mb-6.text-center Log In
= form_for(resource, |
as: resource_name, |
url: session_path(resource_name), |
url: main_app.session_path(resource_name), |
html: { |
class: "bg-white mb-4 px-8 pt-6 pb-8 rounded shadow-md" |
} |

View File

@ -1,25 +1,25 @@
- if controller_name != 'sessions'
= link_to "Log in", new_session_path(resource_name), |
= link_to "Log in", main_app.new_member_session_path(resource_name), |
class: "inline-block align-baseline font-bold text-sm text-blue-500 hover:text-blue-800" |
%br/
- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations'
= link_to "Forgot Password?", new_member_password_path(resource_name), |
= link_to "Forgot Password?", main_app.new_member_password_path(resource_name), |
class: "inline-block align-baseline font-bold text-sm text-blue-500 hover:text-blue-800" |
%br/
- if devise_mapping.registerable? && controller_name != 'registrations'
= link_to "Sign up", new_registration_path(resource_name), |
= link_to "Sign up", main_app.new_member_registration_path(resource_name), |
class: "inline-block align-baseline font-bold text-sm text-blue-500 hover:text-blue-800" |
%br/
- if devise_mapping.confirmable? && controller_name != 'confirmations'
= link_to "Didn't receive confirmation info?", new_member_confirmation_path(resource_name), |
= link_to "Didn't receive confirmation info?", main_app.new_member_confirmation_path(resource_name), |
class: "inline-block align-baseline font-bold text-sm text-blue-500 hover:text-blue-800" |
%br/
- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks'
= link_to "Didn't receive unlock info?", new_member_unlock_path(resource_name), |
= link_to "Didn't receive unlock info?", main_app.new_member_unlock_path(resource_name), |
class: "inline-block align-baseline font-bold text-sm text-blue-500 hover:text-blue-800" |
%br/
- if devise_mapping.omniauthable?
- resource_class.omniauth_providers.each do |provider|
= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), |
= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", main_app.omniauth_authorize_path(resource_name, provider), |
class: "inline-block align-baseline font-bold text-sm text-blue-500 hover:text-blue-800" |
%br/

View File

@ -3,7 +3,7 @@
%h1.font-hairline.mb-6.text-center Resend Unlock Info
= form_for(resource, |
as: resource_name, |
url: unlock_path(resource_name), |
url: main_app.unlock_path(resource_name), |
html: { |
method: :post, |
class: "bg-white mb-4 px-8 pt-6 pb-8 rounded shadow-md" |

View File

@ -15,7 +15,7 @@
.inline-flex.items-center.justify-center.h-12.px-6.font-medium.tracking-wide.text-white.transition.duration-200.rounded-lg.shadow-md.bg-green-800.hover:bg-blue-800.focus:shadow-outline.focus:outline-none
=link_to current_member.email , main_app.member_path(current_member)
- else
%a.inline-flex.items-center.justify-center.h-12.px-6.font-medium.tracking-wide.text-white.transition.duration-200.rounded-lg.shadow-md.bg-green-800.hover:bg-blue-800.focus:shadow-outline.focus:outline-none{"aria-label" => "Sign up", :href => member_session_url, :title => "Log in or Sign up"}
%a.inline-flex.items-center.justify-center.h-12.px-6.font-medium.tracking-wide.text-white.transition.duration-200.rounded-lg.shadow-md.bg-green-800.hover:bg-blue-800.focus:shadow-outline.focus:outline-none{"aria-label" => "Sign up", :href => main_app.member_session_path, :title => "Log in or Sign up"}
Login
.lg:hidden.flex.items-center.justify-between
.mr-20

View File

@ -1,5 +0,0 @@
%h1 New member
= render 'form'
= link_to 'Back', members_path

View File

@ -10,3 +10,7 @@
= link_to 'Edit', edit_member_path(@member)
\|
= link_to 'Back', members_path
\|
= form_tag( destroy_member_session_path , {method: :delete } ) do
%button.bg-cyan-200.mr-3.inline-block.rounded-lg.px-4.py-3.text-md.font-medium.border.border-gray-400{type: :submit}
Sign out

View File

@ -1,8 +1,9 @@
Rails.application.routes.draw do
devise_for :members
resources :members
devise_for :members
mount Merged::Engine => "/merged"