Sha256: d271a3279a6d88548838b43fc4fab25ac3b1e6925476447152429c9cd224d6c6

Contents?: true

Size: 1.44 KB

Versions: 108

Compression:

Stored size: 1.44 KB

Contents

# require 'httparty'

class Wco::PublishersController < Wco::ApplicationController

  ## Alphabetized : )

  def create
    @publisher = Wco::Publisher.new params[:publisher].permit!
    authorize! :create, @publisher
    if @publisher.save
      flash_notice "Created publisher"
    else
      flash_alert "Cannot create publisher: #{@publisher.errors.messages}"
    end
    redirect_to action: 'index'
  end

  def do_run
    @publisher = Wco::Publisher.find params[:id]
    authorize! :do_run, @publisher

    @publisher.props = OpenStruct.new( JSON.parse params[:publisher][:props] )
    # @publisher.do_run binding
    @publisher.do_run

    flash_notice "Probably ok"

    redirect_to action: 'index'
  end

  def edit
    @publisher = Wco::Publisher.find params[:id]
    authorize! :edit, @publisher
    @sites_list = Wco::Site.list
    @galleries_list  = Wco::Gallery.list
  end

  def index
    authorize! :index, Wco::Publisher
    @publishers = Wco::Publisher.all
  end

  def new
    authorize! :new, Wco::Publisher
    @new_publisher   = Wco::Publisher.new
    @sites_list = Wco::Site.list
    @galleries_list  = Wco::Gallery.list
  end

  def update
    @publisher = Wco::Publisher.find params[:id]
    authorize! :update, @publisher
    if @publisher.update params[:publisher].permit!
      flash_notice "Updated publisher"
    else
      flash_alert "Cannot update publisher: #{@publisher.errors.messages}"
    end
    redirect_to action: 'index'
  end

end

Version data entries

108 entries across 108 versions & 1 rubygems

Version Path
wco_models-3.1.0.199 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.198 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.197 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.196 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.195 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.194 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.193 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.192 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.191 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.190 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.189 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.188 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.187 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.184 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.183 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.182 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.181 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.180 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.178 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.177 app/controllers/wco/publishers_controller.rb