Sha256: 97ead9f66c899c4ab7fecbde4777169fd329f96590e0d389aab891f62273fed6

Contents?: true

Size: 1.76 KB

Versions: 15

Compression:

Stored size: 1.76 KB

Contents

require_dependency "phcmembers/application_controller"

module Phcmembers
  class Member::ProfilesController < ApplicationController
  
    # Security & Action Filters
    before_action :set_paper_trail_whodunnit
    before_action :set_member_profile, only: [:show, :edit, :update, :destroy]
    
    # INDEX - Member Profile
    def index
      @member_profiles = Member::Profile.all
    end
    
    # DETAILED PROFILE - Member Profile
    def show
      @member_profile = Member::Profile.find(params[:id])
      @versions = PaperTrail::Version.where(item_id: params[:id], item_type: 'Phcmembers::Member::Profile')
    end
    
    # NEW FORM - Member Profile
    def new
      @member_profile = Member::Profile.new
    end
    
    # EDIT FORM - Member Profile
    def edit
    end
    
    # POST - Member Profile
    def create
      @member_profile = Member::Profile.new(member_profile_params)
      if @member_profile.save
        redirect_to member_profiles_url, notice: 'Profile was successfully created.'
        else
          render :new
      end
    end
    
    # PATCH/PUT - Member Profile
    def update
      if @member_profile.update(member_profile_params)
        redirect_to member_profiles_url, notice: 'Profile was successfully updated.'
        else
          render :edit
      end
    end
    
    # DELETE - Member Profile
    def destroy
      @member_profile.destroy
      redirect_to member_profiles_url, notice: 'Profile was successfully destroyed.'
    end
    
    private
    
    # Common Callbacks
    def set_member_profile
      @member_profile = Member::Profile.find(params[:id])
    end
    
    # Whitelist
    def member_profile_params
      params.require(:member_profile).permit(:mfirstname, :mlastname, :mtitle, :memail, :mphone, :mnotes)
    end
  
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
phcmembers-8.1.2 app/controllers/phcmembers/member/profiles_controller.rb
phcmembers-8.1.1 app/controllers/phcmembers/member/profiles_controller.rb
phcmembers-8.1.0 app/controllers/phcmembers/member/profiles_controller.rb
phcmembers-8.0.3 app/controllers/phcmembers/member/profiles_controller.rb
phcmembers-8.0.2 app/controllers/phcmembers/member/profiles_controller.rb
phcmembers-8.0.1 app/controllers/phcmembers/member/profiles_controller.rb
phcmembers-8.0.0 app/controllers/phcmembers/member/profiles_controller.rb
phcmembers-7.0.3 app/controllers/phcmembers/member/profiles_controller.rb
phcmembers-7.0.2 app/controllers/phcmembers/member/profiles_controller.rb
phcmembers-7.0.1 app/controllers/phcmembers/member/profiles_controller.rb
phcmembers-7.0.0 app/controllers/phcmembers/member/profiles_controller.rb
phcmembers-6.7.5 app/controllers/phcmembers/member/profiles_controller.rb
phcmembers-6.7.4 app/controllers/phcmembers/member/profiles_controller.rb
phcmembers-6.7.3 app/controllers/phcmembers/member/profiles_controller.rb
phcmembers-6.7.2 app/controllers/phcmembers/member/profiles_controller.rb