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.111 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.110 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.109 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.108 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.107 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.106 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.105 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.104 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.103 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.102 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.101 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.100 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.99 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.98 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.97 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.96 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.95 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.94 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.93 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.92 app/controllers/wco/publishers_controller.rb