Sha256: 4fefcb5daa469ad0eaaf7dd2e9b86c8ff62805fb4541b2b67c56d9fab5625df2

Contents?: true

Size: 1.68 KB

Versions: 12

Compression:

Stored size: 1.68 KB

Contents

require_dependency "phcmemberspro/application_controller"

module Phcmemberspro
	class Directory::CategoriesController < ApplicationController

		# Security & Action Filters
		before_filter :authenticate_user!
		layout 'layouts/phcmemberspro/directory/directory_all.html.erb'
		before_action :set_directory_category, only: [:edit, :update, :destroy]

		# Directory Category Index
		def index
			@directory_categories = Directory::Category.scoped_to(current_account).order('catname ASC')
		end

		# Directory Category Details
		def show
		end

		# New Directory Category
		def new
			@directory_category = Directory::Category.scoped_to(current_account).new
		end

		# Edit Directory Category
		def edit
		end

		# Create Action
		def create
			@directory_category = Directory::Category.scoped_to(current_account).new(directory_category_params)
			if @directory_category.save
				redirect_to directory_categories_path, notice: 'Category was successfully created.'
				else
					render :new
			end
		end

		# Update Action
		def update
			if @directory_category.scoped_to(current_account).update(directory_category_params)
				redirect_to directory_categories_path, notice: 'Category was successfully updated.'
				else
					render :edit
			end
		end

		# Delete Action
		def destroy
			@directory_category.scoped_to(current_account).destroy
			redirect_to directory_categories_path, notice: 'Category was successfully destroyed.'
		end

		private

		# Common Callbacks
		def set_directory_category
			@directory_category = Directory::Category.scoped_to(current_account).find(params[:id])
		end

		# whitelist
		def directory_category_params
			params.require(:directory_category).permit(:catname, :account_id)
		end

	end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
phcmemberspro-2.2.3 app/controllers/phcmemberspro/directory/categories_controller.rb
phcmemberspro-2.2.1 app/controllers/phcmemberspro/directory/categories_controller.rb
phcmemberspro-2.2.0 app/controllers/phcmemberspro/directory/categories_controller.rb
phcmemberspro-2.1.9 app/controllers/phcmemberspro/directory/categories_controller.rb
phcmemberspro-2.1.8 app/controllers/phcmemberspro/directory/categories_controller.rb
phcmemberspro-2.1.7 app/controllers/phcmemberspro/directory/categories_controller.rb
phcmemberspro-2.1.6 app/controllers/phcmemberspro/directory/categories_controller.rb
phcmemberspro-2.1.4 app/controllers/phcmemberspro/directory/categories_controller.rb
phcmemberspro-2.1.3 app/controllers/phcmemberspro/directory/categories_controller.rb
phcmemberspro-2.1.2 app/controllers/phcmemberspro/directory/categories_controller.rb
phcmemberspro-2.1.0 app/controllers/phcmemberspro/directory/categories_controller.rb
phcmemberspro-1.8.0 app/controllers/phcmemberspro/directory/categories_controller.rb