Sha256: 14d54b352ff92503a2392876d0eded4d1d28999d0568136f4a01bdfdff30ebd7

Contents?: true

Size: 1.9 KB

Versions: 22

Compression:

Stored size: 1.9 KB

Contents

require_dependency "phcscriptcdnpro/application_controller"

module Phcscriptcdnpro
	class Script::LicencesController < ApplicationController

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

		# INDEX - Script Licences
		def index
			@script_licences = Script::Licence.all
		end

		# DETAILS - Script Licences
		def show
		end

		# NEW - Script Licences
		def new
			@script_licence = Script::Licence.new
		end

		# EDIT - Script Licences
		def edit
		end

		# POST - Script Licences
		def create
			@script_licence = Script::Licence.new(script_licence_params)
			@script_licence.user_id = current_user.id
			@script_licence.user_name = current_user.username
			@script_licence.membership_id = membership_info.id
			@script_licence.oganization_id = membership_info.org_id
			if @script_licence.save
				redirect_to script_licences_url, notice: 'Licence was successfully created.'
				else
					render :new
			end
		end

		# PATCH/PUT - Script Licences
		def update
			@script_licence.user_id = current_user.id
			@script_licence.user_name = current_user.username
			@script_licence.membership_id = membership_info.id
			@script_licence.oganization_id = membership_info.org_id
			if @script_licence.update(script_licence_params)
				redirect_to script_licences_url, notice: 'Licence was successfully updated.'
				else
					render :edit
			end
		end

		# DELETE - Script Licences
		def destroy
			@script_licence.destroy
			redirect_to script_licences_url, notice: 'Licence was successfully destroyed.'
		end

		private

		# Common Callbacks
		def set_script_licence
			@script_licence = Script::Licence.find(params[:id])
		end

		# Whitelists
		def script_licence_params
			params.require(:script_licence).permit(:lcncname, :lcncdescription, :lcncdescript, :lcnccomgpl, :lcncarvlfsf, :lcncarvlosi, :lcncarvlcopyfree, :lcncarvldebian, :lcncarvlfedora)
		end

	end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
phcscriptcdnpro-5.8.0 app/controllers/phcscriptcdnpro/script/licences_controller.rb
phcscriptcdnpro-5.7.5 app/controllers/phcscriptcdnpro/script/licences_controller.rb
phcscriptcdnpro-5.7.4 app/controllers/phcscriptcdnpro/script/licences_controller.rb
phcscriptcdnpro-5.7.3 app/controllers/phcscriptcdnpro/script/licences_controller.rb
phcscriptcdnpro-5.7.2 app/controllers/phcscriptcdnpro/script/licences_controller.rb
phcscriptcdnpro-5.7.1 app/controllers/phcscriptcdnpro/script/licences_controller.rb
phcscriptcdnpro-5.7.0 app/controllers/phcscriptcdnpro/script/licences_controller.rb
phcscriptcdnpro-5.6.7 app/controllers/phcscriptcdnpro/script/licences_controller.rb
phcscriptcdnpro-5.6.6 app/controllers/phcscriptcdnpro/script/licences_controller.rb
phcscriptcdnpro-5.6.5 app/controllers/phcscriptcdnpro/script/licences_controller.rb
phcscriptcdnpro-5.6.3 app/controllers/phcscriptcdnpro/script/licences_controller.rb
phcscriptcdnpro-5.6.2 app/controllers/phcscriptcdnpro/script/licences_controller.rb
phcscriptcdnpro-5.6.1 app/controllers/phcscriptcdnpro/script/licences_controller.rb
phcscriptcdnpro-5.6.0 app/controllers/phcscriptcdnpro/script/licences_controller.rb
phcscriptcdnpro-5.5.6 app/controllers/phcscriptcdnpro/script/licences_controller.rb
phcscriptcdnpro-5.5.5 app/controllers/phcscriptcdnpro/script/licences_controller.rb
phcscriptcdnpro-5.5.3 app/controllers/phcscriptcdnpro/script/licences_controller.rb
phcscriptcdnpro-5.5.2 app/controllers/phcscriptcdnpro/script/licences_controller.rb
phcscriptcdnpro-5.5.1 app/controllers/phcscriptcdnpro/script/licences_controller.rb
phcscriptcdnpro-5.5.0 app/controllers/phcscriptcdnpro/script/licences_controller.rb