phcmemberspro 8.6.3 → 9.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/phcmemberspro/application.js +2 -5
- data/app/assets/stylesheets/phcmemberspro/_custom.scss +38 -0
- data/app/assets/stylesheets/phcmemberspro/application.scss +17 -22
- data/app/controllers/phcmemberspro/application_controller.rb +13 -17
- data/app/controllers/phcmemberspro/directory/categories_controller.rb +14 -25
- data/app/controllers/phcmemberspro/directory/categorylistings_controller.rb +21 -0
- data/app/controllers/phcmemberspro/member/addresses_controller.rb +82 -0
- data/app/controllers/phcmemberspro/member/listings_controller.rb +84 -0
- data/app/controllers/phcmemberspro/member/profiles_controller.rb +75 -0
- data/app/models/phcmemberspro/directory/category.rb +4 -10
- data/app/models/phcmemberspro/directory/categorylisting.rb +12 -0
- data/app/models/phcmemberspro/{members.rb → member.rb} +2 -2
- data/app/models/phcmemberspro/member/address.rb +11 -0
- data/app/models/phcmemberspro/member/listing.rb +13 -0
- data/app/models/phcmemberspro/{members/main.rb → member/profile.rb} +3 -5
- data/app/views/layouts/components/backend/footer/_footer.html.erb +10 -0
- data/app/views/layouts/components/backend/header/_header.html.erb +39 -0
- data/app/views/layouts/components/backend/navigation/_side_menu.html.erb +94 -0
- data/app/views/layouts/phcmemberspro/application.html.erb +9 -14
- data/app/views/phcmemberspro/directory/categories/_form.html.erb +5 -2
- data/app/views/phcmemberspro/directory/categories/components/_category_list.html.erb +7 -20
- data/app/views/phcmemberspro/directory/categories/components/_category_main.html.erb +1 -1
- data/app/views/phcmemberspro/directory/categories/edit.html.erb +12 -13
- data/app/views/phcmemberspro/directory/categories/index.html.erb +9 -10
- data/app/views/phcmemberspro/directory/categories/new.html.erb +11 -12
- data/app/views/phcmemberspro/directory/categories/show.html.erb +10 -11
- data/app/views/phcmemberspro/directory/categorylistings/index.html.erb +60 -0
- data/app/views/phcmemberspro/directory/categorylistings/show.html.erb +4 -0
- data/app/views/phcmemberspro/{members/contacts → member/addresses}/_form.html.erb +12 -5
- data/app/views/phcmemberspro/{members/contacts/components/_contact_address.html.erb → member/addresses/components/_address_address.html.erb} +7 -7
- data/app/views/phcmemberspro/{members/contacts/components/_contact_audits.html.erb → member/addresses/components/_address_audits.html.erb} +1 -1
- data/app/views/phcmemberspro/{members/contacts/components/_contact_main.html.erb → member/addresses/components/_address_main.html.erb} +6 -6
- data/app/views/phcmemberspro/member/addresses/edit.html.erb +41 -0
- data/app/views/phcmemberspro/member/addresses/index.html.erb +71 -0
- data/app/views/phcmemberspro/member/addresses/new.html.erb +41 -0
- data/app/views/phcmemberspro/member/addresses/show.html.erb +24 -0
- data/app/views/phcmemberspro/{members/businesses → member/listings}/_form.html.erb +11 -4
- data/app/views/phcmemberspro/member/listings/components/_listing_address.html.erb +48 -0
- data/app/views/phcmemberspro/{directory → member}/listings/components/_listing_audits.html.erb +1 -1
- data/app/views/phcmemberspro/{directory → member}/listings/components/_listing_main.html.erb +9 -6
- data/app/views/phcmemberspro/member/listings/edit.html.erb +41 -0
- data/app/views/phcmemberspro/member/listings/index.html.erb +74 -0
- data/app/views/phcmemberspro/member/listings/new.html.erb +41 -0
- data/app/views/phcmemberspro/member/listings/show.html.erb +24 -0
- data/app/views/phcmemberspro/member/profiles/_form.html.erb +31 -0
- data/app/views/phcmemberspro/member/profiles/components/_profile_addresses_table.html.erb +20 -0
- data/app/views/phcmemberspro/{members/mains → member/profiles}/components/_profile_audits.html.erb +1 -1
- data/app/views/phcmemberspro/member/profiles/components/_profile_listings_table.html.erb +20 -0
- data/app/views/phcmemberspro/{members/mains → member/profiles}/components/_profile_main.html.erb +6 -6
- data/app/views/phcmemberspro/member/profiles/components/_profile_sidebar.html.erb +65 -0
- data/app/views/phcmemberspro/{members/mains → member/profiles}/edit.html.erb +14 -14
- data/app/views/phcmemberspro/{members/mains → member/profiles}/index.html.erb +17 -19
- data/app/views/phcmemberspro/{members/mains → member/profiles}/new.html.erb +13 -13
- data/app/views/phcmemberspro/member/profiles/show.html.erb +31 -0
- data/config/routes.rb +13 -16
- data/db/migrate/{20160711040328_create_phcmemberspro_directory_categories.rb → 20160728230720_create_phcmemberspro_directory_categories.rb} +2 -4
- data/db/migrate/20160728230830_create_phcmemberspro_directory_categorylistings.rb +16 -0
- data/db/migrate/{20160711040205_create_phcmemberspro_members_contacts.rb → 20160728230901_create_phcmemberspro_member_addresses.rb} +5 -5
- data/db/migrate/{20160711040139_create_phcmemberspro_members_businesses.rb → 20160728231011_create_phcmemberspro_member_listings.rb} +5 -5
- data/db/migrate/{20160711040108_create_phcmemberspro_members_mains.rb → 20160728231036_create_phcmemberspro_member_profiles.rb} +4 -8
- data/lib/phcmemberspro/engine.rb +2 -0
- data/lib/phcmemberspro/version.rb +1 -1
- metadata +103 -78
- data/app/controllers/phcmemberspro/directory/listings_controller.rb +0 -94
- data/app/controllers/phcmemberspro/members/businesses_controller.rb +0 -104
- data/app/controllers/phcmemberspro/members/contacts_controller.rb +0 -104
- data/app/controllers/phcmemberspro/members/mains_controller.rb +0 -86
- data/app/models/phcmemberspro/directory/listing.rb +0 -20
- data/app/models/phcmemberspro/members/business.rb +0 -44
- data/app/models/phcmemberspro/members/contact.rb +0 -34
- data/app/views/layouts/phcmemberspro/directory/directory_all.html.erb +0 -61
- data/app/views/layouts/phcmemberspro/members/members_all.html.erb +0 -61
- data/app/views/layouts/phcmemberspro/members/members_profile.html.erb +0 -61
- data/app/views/phcmemberspro/directory/listings/_form.html.erb +0 -12
- data/app/views/phcmemberspro/directory/listings/_form_category.html.erb +0 -17
- data/app/views/phcmemberspro/directory/listings/components/_listing_list.html.erb +0 -48
- data/app/views/phcmemberspro/directory/listings/index.html.erb +0 -67
- data/app/views/phcmemberspro/directory/listings/new.html.erb +0 -43
- data/app/views/phcmemberspro/directory/listings/show.html.erb +0 -27
- data/app/views/phcmemberspro/members/businesses/_formpatch.html.erb +0 -65
- data/app/views/phcmemberspro/members/businesses/components/_business_address.html.erb +0 -48
- data/app/views/phcmemberspro/members/businesses/components/_business_audits.html.erb +0 -25
- data/app/views/phcmemberspro/members/businesses/components/_business_main.html.erb +0 -41
- data/app/views/phcmemberspro/members/businesses/edit.html.erb +0 -43
- data/app/views/phcmemberspro/members/businesses/index.html.erb +0 -74
- data/app/views/phcmemberspro/members/businesses/new.html.erb +0 -43
- data/app/views/phcmemberspro/members/businesses/show.html.erb +0 -28
- data/app/views/phcmemberspro/members/contacts/_formpatch.html.erb +0 -38
- data/app/views/phcmemberspro/members/contacts/edit.html.erb +0 -43
- data/app/views/phcmemberspro/members/contacts/index.html.erb +0 -72
- data/app/views/phcmemberspro/members/contacts/new.html.erb +0 -44
- data/app/views/phcmemberspro/members/contacts/show.html.erb +0 -28
- data/app/views/phcmemberspro/members/mains/_form.html.erb +0 -43
- data/app/views/phcmemberspro/members/mains/components/_profile_business_table.html.erb +0 -20
- data/app/views/phcmemberspro/members/mains/components/_profile_contact_table.html.erb +0 -20
- data/app/views/phcmemberspro/members/mains/components/_profile_sidebar.html.erb +0 -80
- data/app/views/phcmemberspro/members/mains/show.html.erb +0 -32
- data/db/migrate/20160711040309_create_phcmemberspro_directory_listings.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb4432c8a5ae976563c8d7709871293cc561eb02
|
4
|
+
data.tar.gz: 4beda8b6fb781ac287aa19de5474862004ca747e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cfcc17b856444558e90991518776fc65782f06246b6ddc8013c7649f5421c8405601dffd6174845a9dfcfa295a26bbf2e9bff3d5d62ea29d3d2be372e32fcf6
|
7
|
+
data.tar.gz: 1af9bf6175bb933a3b0c43dd2b7b872de54b18310299a5348079573d7395851d30a076c26118bdcbe571e45186d27d7e46bedddd5a00e2c777ed162cf4b490fe
|
@@ -5,12 +5,9 @@
|
|
5
5
|
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
6
|
//
|
7
7
|
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
-
// compiled file.
|
8
|
+
// compiled file.
|
9
9
|
//
|
10
10
|
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
11
|
// about supported directives.
|
12
12
|
//
|
13
|
-
//= require
|
14
|
-
//= require jquery_ujs
|
15
|
-
//= require bootstrap-sprockets
|
16
|
-
//= require_tree .
|
13
|
+
//= require phc_admins_main
|
@@ -0,0 +1,38 @@
|
|
1
|
+
// Page Header Title
|
2
|
+
.page-title {
|
3
|
+
padding: 25px 0px 40px 0px;
|
4
|
+
font-size: 28px;
|
5
|
+
letter-spacing: -1px;
|
6
|
+
display: block;
|
7
|
+
color: #666;
|
8
|
+
margin: 0px 0px 15px 0px;
|
9
|
+
font-weight: 300;
|
10
|
+
// Title SubScript
|
11
|
+
small {
|
12
|
+
font-size: 14px;
|
13
|
+
letter-spacing: 0px;
|
14
|
+
font-weight: 300;
|
15
|
+
color: #888;
|
16
|
+
}
|
17
|
+
|
18
|
+
.page-content-white &,
|
19
|
+
.page-container-bg-solid & {
|
20
|
+
color: #666;
|
21
|
+
margin-bottom: 20px;
|
22
|
+
margin-top: 20px;
|
23
|
+
small {
|
24
|
+
color: #666;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
.page-content-white & {
|
29
|
+
margin: 25px 0;
|
30
|
+
font-size: 24px;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
// Fix for Time in List
|
35
|
+
.feeds {
|
36
|
+
padding: 5px 5px 5px 5px;
|
37
|
+
font-size: 13px;
|
38
|
+
}
|
@@ -1,23 +1,18 @@
|
|
1
|
-
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
-
* listed below.
|
4
|
-
*
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
-
* compiled file so the styles you add here take precedence over styles defined in any
|
10
|
-
*
|
11
|
-
* file per style scope.
|
12
|
-
*
|
13
|
-
*=
|
14
|
-
|
15
|
-
*/
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_self
|
14
|
+
*/
|
16
15
|
|
17
|
-
//
|
18
|
-
@import "
|
19
|
-
@import "
|
20
|
-
@import "font-awesome";
|
21
|
-
|
22
|
-
// Custom Alterations
|
23
|
-
@import "custom";
|
16
|
+
// Add PHCAdmins Styles
|
17
|
+
@import "phc_admins_style";
|
18
|
+
@import "custom"
|
@@ -1,42 +1,38 @@
|
|
1
1
|
module Phcmemberspro
|
2
2
|
class ApplicationController < ActionController::Base
|
3
3
|
|
4
|
-
#
|
4
|
+
# Security Filters
|
5
5
|
before_filter :require_user
|
6
6
|
protect_from_forgery with: :exception
|
7
7
|
|
8
|
+
# Grab Member Information
|
9
|
+
def get_member_profile_info
|
10
|
+
@members_profile_info = Member::Profile.find(params[:profile_id])
|
11
|
+
end
|
12
|
+
|
8
13
|
# AuthRocket User Helpers
|
9
14
|
def require_user
|
10
15
|
unless current_user
|
16
|
+
params.permit!
|
11
17
|
session[:last_url] = request.get? ? url_for(params) : url_for
|
12
18
|
redirect_to new_login_url
|
13
19
|
end
|
14
20
|
end
|
15
|
-
|
21
|
+
|
16
22
|
def current_user
|
17
23
|
@_current_user ||= AuthRocket::Session.from_token(session[:ar_token]).try(:user)
|
18
24
|
end
|
19
25
|
helper_method :current_user
|
20
|
-
|
26
|
+
|
21
27
|
def new_login_url
|
22
|
-
|
23
|
-
# $ar_login_url
|
28
|
+
ENV['AUTHROCKET_LOGIN_URL']
|
24
29
|
end
|
25
30
|
helper_method :new_login_url
|
26
31
|
|
27
|
-
#
|
28
|
-
helper Phcnotifi::Engine.helpers
|
32
|
+
# Load Helpers
|
29
33
|
helper Phctitleseo::Engine.helpers
|
30
|
-
|
31
|
-
|
32
|
-
def phcmemberspro_membersmain_layouts_resolver
|
33
|
-
case action_name
|
34
|
-
when "show"
|
35
|
-
"layouts/phcmemberspro/members/members_profile"
|
36
|
-
else
|
37
|
-
"layouts/phcmemberspro/members/members_all"
|
38
|
-
end
|
39
|
-
end
|
34
|
+
helper Phcnotifi::Engine.helpers
|
35
|
+
helper Phcaccountspro::Engine.helpers
|
40
36
|
|
41
37
|
end
|
42
38
|
end
|
@@ -6,80 +6,69 @@ module Phcmemberspro
|
|
6
6
|
# Security & Action Filters
|
7
7
|
before_action :require_user
|
8
8
|
before_action :set_paper_trail_whodunnit
|
9
|
-
before_action :set_directory_category, only: [:edit, :update, :destroy]
|
10
|
-
layout 'layouts/phcmemberspro/directory/directory_all.html.erb'
|
9
|
+
before_action :set_directory_category, only: [:show, :edit, :update, :destroy]
|
11
10
|
|
12
|
-
# Directory Category
|
11
|
+
# INDEX - Directory Category
|
13
12
|
def index
|
14
13
|
@directory_categories = Directory::Category.where(oganization_id: membership_info.org_id)
|
15
14
|
end
|
16
15
|
|
17
|
-
# Directory Category
|
16
|
+
# DETAILED - Directory Category
|
18
17
|
def show
|
19
|
-
@versions = PaperTrail::Version.where(item_id: params[:id], item_type: 'Phcmemberspro::Directory::Category')
|
20
18
|
@directory_category = Directory::Category.find(params[:id])
|
19
|
+
@versions = PaperTrail::Version.where(item_id: params[:id], item_type: 'Phcmemberspro::Directory::Category')
|
21
20
|
end
|
22
21
|
|
23
|
-
#
|
22
|
+
# NEW - Directory Category
|
24
23
|
def new
|
25
24
|
@directory_category = Directory::Category.new
|
26
25
|
end
|
27
26
|
|
28
|
-
#
|
27
|
+
# EDIT - Directory Category
|
29
28
|
def edit
|
30
29
|
end
|
31
30
|
|
32
|
-
#
|
31
|
+
# POST - Directory Category
|
33
32
|
def create
|
34
33
|
@directory_category = Directory::Category.new(directory_category_params)
|
35
34
|
@directory_category.user_id = current_user.id
|
36
35
|
@directory_category.membership_id = membership_info.id
|
37
36
|
@directory_category.oganization_id = membership_info.org_id
|
38
37
|
if @directory_category.save
|
39
|
-
redirect_to
|
38
|
+
redirect_to directory_categories_url, notice: 'Category was successfully created.'
|
40
39
|
else
|
41
40
|
render :new
|
42
41
|
end
|
43
42
|
end
|
44
43
|
|
45
|
-
#
|
44
|
+
# PATCH/PUT - Directory Category
|
46
45
|
def update
|
47
46
|
@directory_category.user_id = current_user.id
|
48
47
|
@directory_category.membership_id = membership_info.id
|
49
48
|
@directory_category.oganization_id = membership_info.org_id
|
50
49
|
if @directory_category.update(directory_category_params)
|
51
|
-
redirect_to
|
50
|
+
redirect_to directory_categories_url, notice: 'Category was successfully updated.'
|
52
51
|
else
|
53
52
|
render :edit
|
54
53
|
end
|
55
54
|
end
|
56
55
|
|
57
|
-
#
|
56
|
+
# DELETE - Directory Category
|
58
57
|
def destroy
|
59
58
|
@directory_category.destroy
|
60
|
-
redirect_to
|
59
|
+
redirect_to directory_categories_url, notice: 'Category was successfully destroyed.'
|
61
60
|
end
|
62
61
|
|
63
62
|
private
|
64
63
|
|
65
|
-
# Grab User Session Key (For ID)
|
66
|
-
def current_user
|
67
|
-
@_current_user ||= AuthRocket::Session.from_token(session[:ar_token]).try(:user)
|
68
|
-
end
|
69
|
-
|
70
|
-
# Get Current User from Above and Get Membership Info
|
71
|
-
def membership_info
|
72
|
-
AuthRocket::Membership.all(user_id: current_user.id).first
|
73
|
-
end
|
74
|
-
|
75
64
|
# Common Callbacks
|
76
65
|
def set_directory_category
|
77
66
|
@directory_category = Directory::Category.find(params[:id])
|
78
67
|
end
|
79
68
|
|
80
|
-
#
|
69
|
+
# Whitelist
|
81
70
|
def directory_category_params
|
82
|
-
params.require(:directory_category).permit(:catname
|
71
|
+
params.require(:directory_category).permit(:catname)
|
83
72
|
end
|
84
73
|
|
85
74
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_dependency "phcmemberspro/application_controller"
|
2
|
+
|
3
|
+
module Phcmemberspro
|
4
|
+
class Directory::CategorylistingsController < ApplicationController
|
5
|
+
|
6
|
+
# Security & Action Filters
|
7
|
+
before_action :require_user
|
8
|
+
before_action :set_paper_trail_whodunnit
|
9
|
+
before_action :set_directory_category, only: [:show]
|
10
|
+
|
11
|
+
# INDEX - Directory Category/Listings
|
12
|
+
def index
|
13
|
+
@directory_categorylistings = Directory::Categorylisting.where(oganization_id: membership_info.org_id)
|
14
|
+
end
|
15
|
+
|
16
|
+
# DETAILED - Directory Category/Listings
|
17
|
+
def show
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require_dependency "phcmemberspro/application_controller"
|
2
|
+
|
3
|
+
module Phcmemberspro
|
4
|
+
class Member::AddressesController < ApplicationController
|
5
|
+
|
6
|
+
# Security & Action Filters
|
7
|
+
before_action :require_user
|
8
|
+
before_action :set_paper_trail_whodunnit
|
9
|
+
before_action :get_member_profile_info
|
10
|
+
before_action :set_member_address, only: [:show, :edit, :update, :destroy]
|
11
|
+
|
12
|
+
# INDEX - Directory Listings
|
13
|
+
def index
|
14
|
+
profile = Member::Profile.find(params[:profile_id])
|
15
|
+
@member_addresses = profile.addresses.where(oganization_id: membership_info.org_id)
|
16
|
+
end
|
17
|
+
|
18
|
+
# LISTINGS DETAILS - Directory Listings
|
19
|
+
def show
|
20
|
+
profile = Member::Profile.find(params[:profile_id])
|
21
|
+
@member_address = profile.addresses.find(params[:id])
|
22
|
+
@versions = PaperTrail::Version.where(item_id: params[:id], item_type: 'Phcmemberspro::Member::Address')
|
23
|
+
end
|
24
|
+
|
25
|
+
# NEW - Directory Listings
|
26
|
+
def new
|
27
|
+
profile = Member::Profile.find(params[:profile_id])
|
28
|
+
@member_address = profile.addresses.build
|
29
|
+
end
|
30
|
+
|
31
|
+
# EDIT - Directory Listings
|
32
|
+
def edit
|
33
|
+
end
|
34
|
+
|
35
|
+
# POST - Directory Listings
|
36
|
+
def create
|
37
|
+
@profile = Member::Profile.find(params[:profile_id])
|
38
|
+
@member_address = @profile.addresses.create(member_address_params)
|
39
|
+
@member_address.user_id = current_user.id
|
40
|
+
@member_address.membership_id = membership_info.id
|
41
|
+
@member_address.oganization_id = membership_info.org_id
|
42
|
+
if @member_address.save
|
43
|
+
redirect_to member_profile_addresses_url, notice: 'Listing was successfully created.'
|
44
|
+
else
|
45
|
+
render :new
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# PATCH/PUT - Directory Listings
|
50
|
+
def update
|
51
|
+
@member_address.user_id = current_user.id
|
52
|
+
@member_address.membership_id = membership_info.id
|
53
|
+
@member_address.oganization_id = membership_info.org_id
|
54
|
+
if @member_address.update(member_address_params)
|
55
|
+
redirect_to member_profile_addresses_url, notice: 'Listing was successfully updated.'
|
56
|
+
else
|
57
|
+
render :edit
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# DELETE - Directory Listings
|
62
|
+
def destroy
|
63
|
+
@profile = Member::Profile.find(params[:profile_id])
|
64
|
+
@member_address = @profile.addresses.find(params[:id])
|
65
|
+
@member_address.destroy
|
66
|
+
redirect_to member_profile_addresses_url, notice: 'Listing was successfully destroyed.'
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
# Common Callbacks
|
72
|
+
def set_member_address
|
73
|
+
@member_address = Member::Address.find(params[:id])
|
74
|
+
end
|
75
|
+
|
76
|
+
# Whitelist
|
77
|
+
def member_address_params
|
78
|
+
params.require(:member_address).permit(:mcaddressl1, :mcaddressl2, :mccity, :mcprovince, :mccountry, :mcpostalcode, :mctype, :profile_id)
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require_dependency "phcmemberspro/application_controller"
|
2
|
+
|
3
|
+
module Phcmemberspro
|
4
|
+
class Member::ListingsController < ApplicationController
|
5
|
+
|
6
|
+
# Security & Action Filters
|
7
|
+
before_action :require_user
|
8
|
+
before_action :set_paper_trail_whodunnit
|
9
|
+
before_action :get_member_profile_info
|
10
|
+
before_action :set_member_listing, only: [:show, :edit, :update, :destroy]
|
11
|
+
|
12
|
+
# INDEX - Directory Listings
|
13
|
+
def index
|
14
|
+
profile = Member::Profile.find(params[:profile_id])
|
15
|
+
@member_listings = profile.listings.where(oganization_id: membership_info.org_id)
|
16
|
+
end
|
17
|
+
|
18
|
+
# LISTINGS DETAILS - Directory Listings
|
19
|
+
def show
|
20
|
+
profile = Member::Profile.find(params[:profile_id])
|
21
|
+
@meber_listing = profile.listings.find(params[:id])
|
22
|
+
@versions = PaperTrail::Version.where(item_id: params[:id], item_type: 'Phcmemberspro::Member::Listing')
|
23
|
+
end
|
24
|
+
|
25
|
+
# NEW - Directory Listings
|
26
|
+
def new
|
27
|
+
profile = Member::Profile.find(params[:profile_id])
|
28
|
+
@member_listing = profile.listings.build
|
29
|
+
end
|
30
|
+
|
31
|
+
# EDIT - Directory Listings
|
32
|
+
def edit
|
33
|
+
end
|
34
|
+
|
35
|
+
# POST - Directory Listings
|
36
|
+
def create
|
37
|
+
@profile = Member::Profile.find(params[:profile_id])
|
38
|
+
@member_listing = @profile.listings.create(member_listing_params)
|
39
|
+
@member_listing.user_id = current_user.id
|
40
|
+
@member_listing.membership_id = membership_info.id
|
41
|
+
@member_listing.oganization_id = membership_info.org_id
|
42
|
+
if @member_listing.save
|
43
|
+
@member_listing.categorylistings.build
|
44
|
+
redirect_to member_profile_listings_url, notice: 'Listing was successfully created.'
|
45
|
+
else
|
46
|
+
render :new
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# PATCH/PUT - Directory Listings
|
51
|
+
def update
|
52
|
+
@member_listing.user_id = current_user.id
|
53
|
+
@member_listing.membership_id = membership_info.id
|
54
|
+
@member_listing.oganization_id = membership_info.org_id
|
55
|
+
if @member_listing.update(member_listing_params)
|
56
|
+
@member_listing.categorylistings.build
|
57
|
+
redirect_to member_profile_listings_url, notice: 'Listing was successfully updated.'
|
58
|
+
else
|
59
|
+
render :edit
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# DELETE - Directory Listings
|
64
|
+
def destroy
|
65
|
+
@profile = Member::Profile.find(params[:profile_id])
|
66
|
+
@member_listing = @profile.listings.find(params[:id])
|
67
|
+
@member_listing.destroy
|
68
|
+
redirect_to member_profile_listings_url, notice: 'Listing was successfully destroyed.'
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
# Common Callbacks
|
74
|
+
def set_member_listing
|
75
|
+
@member_listing = Member::Listing.find(params[:id])
|
76
|
+
end
|
77
|
+
|
78
|
+
# Whitelist
|
79
|
+
def member_listing_params
|
80
|
+
params.require(:member_listing).permit(:mbcompanyname, :mbcontactname, :mbaddressl1, :mbaddressl2, :mbcity, :mbcountry, :mbprovince, :mbpostalcode, :mbphone, :mbcontactemail, :mbwebsite, :profile_id, category_ids: [])
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|