Sha256: b61a7a7e14a7e807d22cc210cfd00c86f7e714bd2c502b077f2836f6c24899b6

Contents?: true

Size: 1.38 KB

Versions: 7

Compression:

Stored size: 1.38 KB

Contents

require_dependency "phcpresspro/application_controller"

module Phcpresspro
	class Modules::CategoriesController < ApplicationController

		# Security and Filters
		before_action :set_modules_category, only: [:show, :edit, :update, :destroy]

		# Categories Index
		def index
			@modules_categories = Modules::Category.all
		end

		# Detail News/Blog Category
		def show
		end

		# New News/Blog Category
		def new
			@modules_category = Modules::Category.new
		end

		# Edit News/Blog Category
		def edit
		end

		# Create News/Blog Category
		def create
			@modules_category = Modules::Category.new(modules_category_params)

			if @modules_category.save
				redirect_to modules_categories_url, notice: 'Category was successfully created.'
				else
					render :new
			end
		end

		# Update News/Blog Category
		def update
			if @modules_category.update(modules_category_params)
				redirect_to modules_categories_url, notice: 'Category was successfully updated.'
				else
					render :edit
			end
		end

		# Delete News/Blog Category
		def destroy
			@modules_category.destroy
			redirect_to modules_categories_url, notice: 'Category was successfully destroyed.'
		end

		private

		# Common Callbacks
		def set_modules_category
			@modules_category = Modules::Category.find(params[:id])
		end

		# Whitelist
		def modules_category_params
			params.require(:modules_category).permit(:catname)
		end

	end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
phcpresspro-3.0.9 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-3.0.8 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-3.0.7 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-3.0.6 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-3.0.5 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-3.0.4 app/controllers/phcpresspro/modules/categories_controller.rb
phcpresspro-3.0.3 app/controllers/phcpresspro/modules/categories_controller.rb