app/controllers/phcmembers/members/mains_controller.rb in phcmembers-2.2.0 vs app/controllers/phcmembers/members/mains_controller.rb in phcmembers-3.0.0
- old
+ new
@@ -1,22 +1,25 @@
require_dependency "phcmembers/application_controller"
module Phcmembers
class Members::MainsController < ApplicationController
-
+
# Filters
- layout 'layouts/phcmembers/members/members_all.html.erb'
- before_filter :authenticate_user!, if: -> { defined?(Devise) }
+ before_action :set_paper_trail_whodunnit
before_action :set_members_main, only: [:show, :edit, :update, :destroy]
+ # layout :phcmemberspro_membersmain_layouts_resolver
# Member Profile List
def index
@members_mains = Members::Main.all
end
# Detailed Member Profile
def show
+ @versions = PaperTrail::Version.where(item_id: params[:id], item_type: 'Phcmembers::Members::Main')
+ @members_listings = Directory::Listing.where(main_id: params[:id])
+ @members_main = Members::Main.find(params[:id])
end
# New Member Profile
def new
@members_main = Members::Main.new
@@ -28,29 +31,29 @@
# Create Member Profile Action
def create
@members_main = Members::Main.new(members_main_params)
if @members_main.save
- redirect_to members_mains_path, notice: 'Member profile was successfully created.'
+ redirect_to members_mains_path, notice: 'Member profile has been successfully created.'
else
render :new
end
end
# Update Member Profile Action
def update
if @members_main.update(members_main_params)
- redirect_to members_mains_path, notice: 'Member profile was successfully updated.'
+ redirect_to members_mains_path, notice: 'Member profile has been successfully updated.'
else
render :edit
end
end
# Delete Member Profile Action
def destroy
@members_main.destroy
- redirect_to members_mains_path, notice: 'Member profile was successfully destroyed.'
+ redirect_to members_mains_path, notice: 'Member profile and all businesses was successfully destroyed.'
end
private
# Common Callbacks
@@ -58,10 +61,10 @@
@members_main = Members::Main.find(params[:id])
end
# White List
def members_main_params
- params.require(:members_main).permit(:mfirstname, :mlastname, :mtitle, :memail, :mphone, :mnotes)
+ params.require(:members_main).permit(:mfirstname, :mlastname, :mtitle, :memail, :mphone, :mnotes, :smfacebook, :smtwitter, :smlinkedin)
end
end
end