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.176 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.175 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.174 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.173 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.172 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.171 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.170 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.169 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.168 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.167 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.166 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.165 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.164 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.163 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.162 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.161 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.155 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.154 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.153 app/controllers/wco/publishers_controller.rb
wco_models-3.1.0.152 app/controllers/wco/publishers_controller.rb