Sha256: 43e6c27c3f5912542eef4d64982a922c672d9ac1fe28b4a6297c8422b7ba62d2

Contents?: true

Size: 1.97 KB

Versions: 17

Compression:

Stored size: 1.97 KB

Contents

require_dependency "phcscriptcdnpro/application_controller"

module Phcscriptcdnpro
	class Script::ListingsController < ApplicationController

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

		# INDEX - Script Listings
		def index
			@script_listings = Script::Listing.all
		end

		# DETAILS - Script Listings
		def show
		end

		# NEW - Script Listings
		def new
			@script_listing = Script::Listing.new
		end

		# EDIT - Script Listings
		def edit
		end

		# POST - Script Listings
		def create
			@script_listing = Script::Listing.new(script_listing_params)
			@script_listing.user_id = current_user.id
			@script_listing.user_name = current_user.username
			@script_listing.membership_id = membership_info.id
			@script_listing.oganization_id = membership_info.org_id
			if @script_listing.save
				redirect_to script_listings_path, notice: 'Listing was successfully created.'
				else
					render :new
			end
		end

		# PATCH/PUT - Script Listings
		def update
			@script_listing.user_id = current_user.id
			@script_listing.user_name = current_user.username
			@script_listing.membership_id = membership_info.id
			@script_listing.oganization_id = membership_info.org_id
			if @script_listing.update(script_listing_params)
				redirect_to script_listings_path, notice: 'Listing was successfully updated.'
				else
					render :edit
			end
		end

		# DELETE - Script Listings
		def destroy
			@script_listing.destroy
			redirect_to script_listings_path, notice: 'Listing was successfully destroyed.'
		end

		private

		# Common Callbacks
		def set_script_listing
			@script_listing = Script::Listing.find(params[:id])
		end

		# Whitelist
		def script_listing_params
			params.require(:script_listing).permit(:scripttitle, :scriptdescription, :scriptwebsite, :scripttwitter, :scriptgithub, :scriptinitialrelease, :scriptlastestrelease, :scriptbetarelease, :scriptstatus, :version_id, :author_id, :licence_id)
		end

	end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
phcscriptcdnpro-5.7.1 app/controllers/phcscriptcdnpro/script/listings_controller.rb
phcscriptcdnpro-5.7.0 app/controllers/phcscriptcdnpro/script/listings_controller.rb
phcscriptcdnpro-5.6.7 app/controllers/phcscriptcdnpro/script/listings_controller.rb
phcscriptcdnpro-5.6.6 app/controllers/phcscriptcdnpro/script/listings_controller.rb
phcscriptcdnpro-5.6.5 app/controllers/phcscriptcdnpro/script/listings_controller.rb
phcscriptcdnpro-5.6.3 app/controllers/phcscriptcdnpro/script/listings_controller.rb
phcscriptcdnpro-5.6.2 app/controllers/phcscriptcdnpro/script/listings_controller.rb
phcscriptcdnpro-5.6.1 app/controllers/phcscriptcdnpro/script/listings_controller.rb
phcscriptcdnpro-5.6.0 app/controllers/phcscriptcdnpro/script/listings_controller.rb
phcscriptcdnpro-5.5.6 app/controllers/phcscriptcdnpro/script/listings_controller.rb
phcscriptcdnpro-5.5.5 app/controllers/phcscriptcdnpro/script/listings_controller.rb
phcscriptcdnpro-5.5.3 app/controllers/phcscriptcdnpro/script/listings_controller.rb
phcscriptcdnpro-5.5.2 app/controllers/phcscriptcdnpro/script/listings_controller.rb
phcscriptcdnpro-5.5.1 app/controllers/phcscriptcdnpro/script/listings_controller.rb
phcscriptcdnpro-5.5.0 app/controllers/phcscriptcdnpro/script/listings_controller.rb
phcscriptcdnpro-5.4.0 app/controllers/phcscriptcdnpro/script/listings_controller.rb
phcscriptcdnpro-5.3.6 app/controllers/phcscriptcdnpro/script/listings_controller.rb