Sha256: c07a3ab9cb9be56c1ed7ce266288ab089abead721227b8f49ef52a0eb9d6f4e1

Contents?: true

Size: 1.83 KB

Versions: 22

Compression:

Stored size: 1.83 KB

Contents

require_dependency "phcscriptcdnpro/application_controller"

module Phcscriptcdnpro
	class Script::VersionsController < ApplicationController

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

		# INDEX - Script Versions
		def index
			@script_versions = Script::Version.all
		end

		# DETAILS - Script Versions
		def show
		end

		# NEW - Script Versions
		def new
			@script_version = Script::Version.new
		end

		# EDIT - Script Versions
		def edit
		end

		# POST - Script Versions
		def create
			@script_version = Script::Version.new(script_version_params)
			@script_version.user_id = current_user.id
			@script_version.user_name = current_user.username
			@script_version.membership_id = membership_info.id
			@script_version.oganization_id = membership_info.org_id
			if @script_version.save
				redirect_to script_versions_url, notice: 'Version was successfully created.'
				else
					render :new
			end
		end

		# PATCH/PUT - Script Versions
		def update
			@script_version.user_id = current_user.id
			@script_version.user_name = current_user.username
			@script_version.membership_id = membership_info.id
			@script_version.oganization_id = membership_info.org_id
			if @script_version.update(script_version_params)
				redirect_to script_versions_url, notice: 'Version was successfully updated.'
				else
					render :edit
			end
		end

		# DELETE - Script Versions
		def destroy
			@script_version.destroy
			redirect_to script_versions_url, notice: 'Version was successfully destroyed.'
		end

		private

		# Common Callbacks
		def set_script_version
			@script_version = Script::Version.find(params[:id])
		end

		# Only allow a trusted parameter "white list" through.
		def script_version_params
			params.require(:script_version).permit(:scriptversion)
		end

	end
end

Version data entries

22 entries across 22 versions & 1 rubygems

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