Sha256: a85d7232281686184f73f4a1b7862804b7f150301ad0d019f74b5e260a74bc31

Contents?: true

Size: 1.72 KB

Versions: 9

Compression:

Stored size: 1.72 KB

Contents

require_dependency "phcscriptcdn/application_controller"

module Phcscriptcdn
  class Script::ListingsController < ApplicationController
  
    # Filters & Security
    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)
      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
      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, :descriptionsource, :scriptwebsite, :scripttwitter, :scriptgithub, :scriptinitialrelease, :scriptlastestrelease, :scriptbetarelease, :scriptstatus, :user_id, :user_name, :version_id, :author_id, :licence_id)
    end
  
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
phcscriptcdn-5.1.2 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-5.1.1 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-5.1.0 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-5.0.1 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-5.0.0 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-4.3.10 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-4.3.9 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-4.3.8 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-4.3.7 app/controllers/phcscriptcdn/script/listings_controller.rb