Sha256: 032cd61796ff5e065e73540ad6b12cefe3a1c78ca532e9960a214d9727f95ba4

Contents?: true

Size: 1.9 KB

Versions: 22

Compression:

Stored size: 1.9 KB

Contents

require_dependency "phcscriptcdnpro/application_controller"

module Phcscriptcdnpro
	class Script::ExtensionsController < ApplicationController

		# Filters & Security
		before_action :require_user
		before_action :set_script_extension, only: [:show, :edit, :update, :destroy]

		# INDEX - Script Extension
		def index
			@script_extensions = Script::Extension.all
		end

		# DETAILS - Script Extension
		def show
		end

		# NEW - Script Extension
		def new
			@script_extension = Script::Extension.new
		end

		# EDIT - Script Extension
		def edit
		end

		# CREATE - Script Extension
		def create
			@script_extension = Script::Extension.new(script_extension_params)
			@script_extension.user_id = current_user.id
			@script_extension.user_name = current_user.username
			@script_extension.membership_id = membership_info.id
			@script_extension.oganization_id = membership_info.org_id
			if @script_extension.save
				redirect_to script_extensions_url, notice: 'Extension was successfully created.'
				else
					render :new
			end
		end

		# PATCH/PUT - Script Extension
		def update
			@script_extension.user_id = current_user.id
			@script_extension.user_name = current_user.username
			@script_extension.membership_id = membership_info.id
			@script_extension.oganization_id = membership_info.org_id
			if @script_extension.update(script_extension_params)
				redirect_to script_extensions_url, notice: 'Extension was successfully updated.'
				else
					render :edit
			end
		end

		# DELETE - Script Extension
		def destroy
			@script_extension.destroy
			redirect_to script_extensions_url, notice: 'Extension was successfully destroyed.'
		end

		private

		# Common Callbacks
		def set_script_extension
			@script_extension = Script::Extension.find(params[:id])
		end

		# Whitelists
		def script_extension_params
			params.require(:script_extension).permit(:scriptextensionname, :scriptextensiondes, :scriptextension)
		end

	end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
phcscriptcdnpro-5.4.0 app/controllers/phcscriptcdnpro/script/extensions_controller.rb
phcscriptcdnpro-5.3.6 app/controllers/phcscriptcdnpro/script/extensions_controller.rb