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.131 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.130 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.129 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.128 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.127 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.126 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.125 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.124 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.123 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.122 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.121 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.120 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.119 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.118 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.117 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.116 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.115 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.114 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.113 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.112 app/controllers/wco/publishers_controller.rb