Sha256: 02baf9e8b1994802c1b60d15eb6fd96e4f08ec2285b10acd93d5333d5331ce98

Contents?: true

Size: 1.69 KB

Versions: 54

Compression:

Stored size: 1.69 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, :slug, :user_id, :user_name, :version_id, :author_id, :licence_id)
    end

  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
phcscriptcdn-48.0.0 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-47.0.0 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-44.1.0 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-45.0.0 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-44.0.0 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-43.0.0 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-42.0.0 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-41.0.0 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-40.0.0 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-38.0.0 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-37.0.0 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-36.0.0 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-35.0.0 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-34.0.0 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-33.0.0 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-32.0.0 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-31.0.0 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-30.0.0 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-29.2.0 app/controllers/phcscriptcdn/script/listings_controller.rb
phcscriptcdn-29.1.0 app/controllers/phcscriptcdn/script/listings_controller.rb