Class: Wco::PublishersController
Overview
Instance Method Summary
collapse
#home, #tinymce
#my_truthy?, #obfuscate, #pp_amount, #pp_currency, #pp_date, #pp_datetime, #pp_money, #pp_percent, #pp_time, #pretty_date
Instance Method Details
#create ⇒ Object
8
9
10
11
12
13
14
15
16
17
|
# File 'app/controllers/wco/publishers_controller.rb', line 8
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
|
#do_run ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'app/controllers/wco/publishers_controller.rb', line 19
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
flash_notice "Probably ok"
redirect_to action: 'index'
end
|
#edit ⇒ Object
32
33
34
35
36
37
|
# File 'app/controllers/wco/publishers_controller.rb', line 32
def edit
@publisher = Wco::Publisher.find params[:id]
authorize! :edit, @publisher
@sites_list = Wco::Site.list
@galleries_list = Wco::Gallery.list
end
|
#index ⇒ Object
39
40
41
42
|
# File 'app/controllers/wco/publishers_controller.rb', line 39
def index
authorize! :index, Wco::Publisher
@publishers = Wco::Publisher.all
end
|
#new ⇒ Object
44
45
46
47
48
49
|
# File 'app/controllers/wco/publishers_controller.rb', line 44
def new
authorize! :new, Wco::Publisher
@new_publisher = Wco::Publisher.new
@sites_list = Wco::Site.list
@galleries_list = Wco::Gallery.list
end
|
#update ⇒ Object
51
52
53
54
55
56
57
58
59
60
|
# File 'app/controllers/wco/publishers_controller.rb', line 51
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
|