Sha256: b4770f17ec2180d65d2cc265d374b0a713b7e6b253a6e73a182714ad174bc89a

Contents?: true

Size: 1.94 KB

Versions: 61

Compression:

Stored size: 1.94 KB

Contents

require_dependency "phcscriptcdnpro/application_controller"

module Phcscriptcdnpro
	class Script::UrlsController < ApplicationController

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

		# INDEX - Script Authors
		def index
			script_listing = Script::Listing.find(params[:listing_id])
			@script_urls = script_listing.urls
		end

		# DETAILED PROFILE - Script Authors
		def show
			script_listing = Script::Listing.find(params[:listing_id])
			@script_url = script_listing.urls.find(params[:id])
		end

		# NEW - Script Athors
		def new
			script_listing = Script::Listing.find(params[:listing_id])
			@script_url = script_listing.urls.build
		end

		# EDIT - Script Athors
		def edit
			script_listing = Script::Listing.find(params[:listing_id])
			@script_url = script_listing.urls.find(params[:id])
		end

		# POST - Script Athors
		def create
			@script_listing = Script::Listing.find(params[:listing_id])
			@script_url = @script_listing.urls.create(script_url_params)
			if @script_url.save
				redirect_to script_listing_urls_path, notice: 'Author was successfully created.'
				else
					render :new
			end
		end

		# PATCH/PUT - Script Athors
		def update
			if @script_url.update(script_url_params)
				redirect_to script_listing_urls_path, notice: 'Author was successfully updated.'
				else
					render :edit
			end
		end

		# DELETE - Script Athors
		def destroy
			@script_listing = Script::Listing.find(params[:listing_id])
			@script_url = @script_listing.urls.find(params[:id])
			@script_url.destroy
			redirect_to script_listing_urls_path, notice: 'Author was successfully destroyed.'
		end

		private

		# Common Callbacks
		def set_script_url
			@script_url = Script::Url.find(params[:id])
		end

		# Whitelists
		def script_url_params
			params.require(:script_url).permit(:scripturl, :scripturlrelease, :scripturlcdnupdate, :listing_id, :version_id, :extension_id)
		end

	end
end

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
phcscriptcdnpro-5.3.5 app/controllers/phcscriptcdnpro/script/urls_controller.rb
phcscriptcdnpro-5.3.3 app/controllers/phcscriptcdnpro/script/urls_controller.rb
phcscriptcdnpro-5.3.2 app/controllers/phcscriptcdnpro/script/urls_controller.rb
phcscriptcdnpro-5.3.1 app/controllers/phcscriptcdnpro/script/urls_controller.rb
phcscriptcdnpro-5.3.0 app/controllers/phcscriptcdnpro/script/urls_controller.rb
phcscriptcdnpro-5.2.3 app/controllers/phcscriptcdnpro/script/urls_controller.rb
phcscriptcdnpro-5.2.2 app/controllers/phcscriptcdnpro/script/urls_controller.rb
phcscriptcdnpro-5.2.1 app/controllers/phcscriptcdnpro/script/urls_controller.rb
phcscriptcdnpro-5.2.0 app/controllers/phcscriptcdnpro/script/urls_controller.rb
phcscriptcdnpro-5.1.7 app/controllers/phcscriptcdnpro/script/urls_controller.rb
phcscriptcdnpro-5.1.6 app/controllers/phcscriptcdnpro/script/urls_controller.rb
phcscriptcdnpro-5.1.5 app/controllers/phcscriptcdnpro/script/urls_controller.rb
phcscriptcdnpro-5.1.4 app/controllers/phcscriptcdnpro/script/urls_controller.rb
phcscriptcdnpro-5.1.3 app/controllers/phcscriptcdnpro/script/urls_controller.rb
phcscriptcdnpro-5.1.2 app/controllers/phcscriptcdnpro/script/urls_controller.rb
phcscriptcdnpro-5.1.1 app/controllers/phcscriptcdnpro/script/urls_controller.rb
phcscriptcdnpro-5.1.0 app/controllers/phcscriptcdnpro/script/urls_controller.rb
phcscriptcdnpro-5.0.3 app/controllers/phcscriptcdnpro/script/urls_controller.rb
phcscriptcdnpro-5.0.2 app/controllers/phcscriptcdnpro/script/urls_controller.rb
phcscriptcdnpro-5.0.1 app/controllers/phcscriptcdnpro/script/urls_controller.rb