Sha256: edf60f5c97c0f9220703cd80c45302a5a93391230080cfb5888f1311fb07e172

Contents?: true

Size: 1.4 KB

Versions: 2

Compression:

Stored size: 1.4 KB

Contents

require_dependency "phcscriptcdn/application_controller"

module Phcscriptcdn
	class Scriptcdn::ScriptsController < ApplicationController

		# Filters and Security
		layout "layouts/scriptcdn/scriptcdn_all"
		before_action :set_scriptcdn_script, only: [:show, :edit, :update, :destroy]

		# ScriptCDN Index
		def index
			@scriptcdn_scripts = Scriptcdn::Script.all
		end

		# Detailed Script CDN Profile
		def show
		end

		# New Script for CDN
		def new
			@scriptcdn_script = Scriptcdn::Script.new
		end

		# Edit Script
		def edit
		end

		# POST Script
		def create
			@scriptcdn_script = Scriptcdn::Script.new(scriptcdn_script_params)

			if @scriptcdn_script.save
				redirect_to scriptcdn_scripts_path, notice: 'Script was successfully created.'
			else
				render :new
			end
		end

		# PATCH/PUT Script
		def update
			if @scriptcdn_script.update(scriptcdn_script_params)
				redirect_to scriptcdn_scripts_path, notice: 'Script was successfully updated.'
			else
				render :edit
			end
		end

		# DELETE Script from CDN
		def destroy
			@scriptcdn_script.destroy
			redirect_to scriptcdn_scripts_path, notice: 'Script was successfully destroyed.'
		end

		private

		# Callbacks
		def set_scriptcdn_script
			@scriptcdn_script = Scriptcdn::Script.find(params[:id])
		end

		# Whitelist
		def scriptcdn_script_params
			params.require(:scriptcdn_script).permit(:scrptname, :scrptdescription, :scriptversion_id)
		end

	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
phcscriptcdn-0.1.5 app/controllers/phcscriptcdn/scriptcdn/scripts_controller.rb
phcscriptcdn-0.0.2 app/controllers/phcscriptcdn/scriptcdn/scripts_controller.rb