Sha256: 679f3c1c34fa0040b5424ae62268463f1aa05778a050810d78728d6e2e79eee3

Contents?: true

Size: 1.59 KB

Versions: 3

Compression:

Stored size: 1.59 KB

Contents

require_dependency "phcscriptcdnpro/application_controller"

module Phcscriptcdnpro
	class Scriptcdn::ScriptversionsController < ApplicationController

		# Security & Action Filters
		before_action :require_user
		layout '/layouts/phcscriptcdnpro/application.html.erb'
		before_action :set_scriptcdn_scriptversion, only: [:edit, :update, :destroy]

		# Script Version Index
		def index
			@scriptcdn_scriptversions = Scriptcdn::Scriptversion.all
		end

		# New Script Version for CDN
		def new
			@scriptcdn_scriptversion = Scriptcdn::Scriptversion.new
		end

		# Edit Script Version
		def edit
		end

		# POST Script Version
		def create
			@scriptcdn_scriptversion = Scriptcdn::Scriptversion.new(scriptcdn_scriptversion_params)

			if @scriptcdn_scriptversion.save
				redirect_to scriptcdn_scriptversions_path, notice: 'Script version was successfully created.'
			else
				render :new
			end
		end

		# PATCH/PUT Script Version
		def update
			if @scriptcdn_scriptversion.update(scriptcdn_scriptversion_params)
				redirect_to scriptcdn_scriptversions_path, notice: 'Script version was successfully updated.'
			else
				render :edit
			end
		end

		# DELETE Script Version
		def destroy
			@scriptcdn_scriptversion.destroy
			redirect_to scriptcdn_scriptversions_path, notice: 'Script version was successfully destroyed.'
		end

		private
		
		# Callbacks
		def set_scriptcdn_scriptversion
			@scriptcdn_scriptversion = Scriptcdn::Scriptversion.find(params[:id])
		end

		# Whitelist
		def scriptcdn_scriptversion_params
			params.require(:scriptcdn_scriptversion).permit(:scrptversion, :scrptversionpakname)
		end

	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
phcscriptcdnpro-1.4.1 app/controllers/phcscriptcdnpro/scriptcdn/scriptversions_controller.rb
phcscriptcdnpro-1.4.0 app/controllers/phcscriptcdnpro/scriptcdn/scriptversions_controller.rb
phcscriptcdnpro-1.3.8 app/controllers/phcscriptcdnpro/scriptcdn/scriptversions_controller.rb