made settings page
This commit is contained in:
parent
80271a46b5
commit
0a9b32f06b
|
@ -1,20 +1,20 @@
|
|||
class MembersController < ApplicationController
|
||||
before_action :set_member, only: %i[ show edit update destroy ]
|
||||
before_action :set_member, only: %i[ show edit update destroy]
|
||||
|
||||
# GET /members
|
||||
def index
|
||||
@members = Member.page params[:page]
|
||||
end
|
||||
|
||||
# GET /members/1
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /members/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /members
|
||||
def settings
|
||||
@member = current_member
|
||||
end
|
||||
|
||||
def create
|
||||
@member = Member.new(member_params)
|
||||
|
||||
|
@ -25,7 +25,6 @@ class MembersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /members/1
|
||||
def update
|
||||
if @member.update(member_params)
|
||||
redirect_to @member, notice: "Member was successfully updated."
|
||||
|
@ -34,7 +33,6 @@ class MembersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# DELETE /members/1
|
||||
def destroy
|
||||
@member.destroy
|
||||
redirect_to members_url, notice: "Member was successfully destroyed."
|
||||
|
|
|
@ -31,7 +31,7 @@ module ApplicationHelper
|
|||
["/about" , "About"], ]
|
||||
end
|
||||
def member_memu
|
||||
items =[["/forum" ,"Forum"] , [main_app.member_path(current_member) , "Settings"]]
|
||||
items =[["/forum" ,"Forum"] , [main_app.settings_members_path , "Settings"]]
|
||||
if current_member.admin? and !Rails.env.production?
|
||||
items << [merged.pages_path(), "CMS" ]
|
||||
end
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
class MemberPolicy < EditOwnPolicy
|
||||
|
||||
|
||||
class Scope < Scope
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
%section.mx-20
|
||||
.flex.justify-center
|
||||
.px-4.py-4.md:py-10.lg:py-16.mx-5.md:mx-12.lg:mx-20.text-center
|
||||
%h1.text-2xl.font-bold.tracking-tight.sm:text-4xl
|
||||
Settings and profiles
|
||||
%h4.text-xl.mt-4.md:text-2xl
|
||||
View and edit your profiles, and change settings
|
||||
.grid.grid-cols-1.mx-8.gap-8.md:grid-cols-2.mx-12.gap-12.lg:grid-cols-3.mx-16.gap-16
|
||||
.flex.flex-col.justify-between
|
||||
%h3.text-2xl.bg-gray-200.p-4.text-center Settings
|
||||
.flex.justify-beteen.flex-wrap
|
||||
= form_tag( destroy_member_session_path , {method: :delete } ) do
|
||||
%button.m-4.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
|
||||
= link_to edit_member_registration_path do
|
||||
%button.m-4.bg-cyan-200.mr-3.inline-block.rounded-lg.px-4.py-3.text-md.font-medium.border.border-gray-400{type: :submit}
|
||||
Change Password
|
||||
= link_to members_edit_email_path do
|
||||
%button.m-4.bg-cyan-200.mr-3.inline-block.rounded-lg.px-4.py-3.text-md.font-medium.border.border-gray-400{type: :submit}
|
||||
Change Email
|
||||
.grid.grid-cols-6.gap-4.mt-10.mx-10
|
||||
-@member.entities.each do |entity|
|
||||
%div= entity.type
|
||||
%div= entity.name
|
||||
%div= entity.value
|
||||
%div
|
||||
- unless @member.artist_profile
|
||||
If you are an artist at Hub Feenix, click
|
||||
=link_to "here" , new_profile_path(kind: :artist) , class: "underline"
|
||||
- unless @member.teacher_profile
|
||||
If you teach at Hub Feenix, click
|
||||
=link_to "here" , new_profile_path(kind: :teacher) , class: "underline"
|
||||
|
||||
- unless @member.member_profile
|
||||
%div
|
||||
%h3.text-2xl.bg-gray-200.p-4.text-center No Profile
|
||||
%h2 Create new
|
||||
= link_to new_profile_path(kind: :member) do
|
||||
%button.bg-cyan-200.mr-3.inline-block.rounded-lg.px-4.py-3.text-md.font-medium.border.border-gray-400
|
||||
Member profile
|
||||
.prose
|
||||
Member profiles are always public and contain an image and text.
|
||||
|
||||
- Profile.kinds.each do |kind|
|
||||
- if profile = @member.profile(kind)
|
||||
%div= render "#{kind}_profile" , profile: profile
|
|
@ -8,7 +8,9 @@ Rails.application.routes.draw do
|
|||
get "/members/edit_email" , to: "registrations#edit_email"
|
||||
end
|
||||
|
||||
resources :members
|
||||
resources :members do
|
||||
get 'settings' , on: :collection
|
||||
end
|
||||
|
||||
mount Thredded::Engine => '/forum'
|
||||
|
||||
|
|
Loading…
Reference in New Issue