Class: Wco::OfficeActionsController
Instance Method Summary
collapse
#home, #tinymce
#my_truthy?, #obfuscate, #pexels_search_path, #pp_amount, #pp_currency, #pp_date, #pp_datetime, #pp_money, #pp_percent, #pp_time, #pretty_date
Instance Method Details
#create ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
|
# File 'app/controllers/wco/office_actions_controller.rb', line 6
def create
@oa = OA.new params[:oa].permit!
authorize! :update, @oa
if @oa.save
flash_notice @oa
else
flash_alert @oa
end
redirect_to action: :index
end
|
#destroy ⇒ Object
18
19
20
21
22
23
24
25
26
27
|
# File 'app/controllers/wco/office_actions_controller.rb', line 18
def destroy
@oa = OA.find params[:id]
authorize! :destroy, @oa
if @oa.delete
flash_notice @oa
else
flash_alert @oa
end
redirect_to action: :index
end
|
#do_run ⇒ Object
29
30
31
32
33
34
35
|
# File 'app/controllers/wco/office_actions_controller.rb', line 29
def do_run
@oa = OA.find params[:id]
authorize! :do_run, @oa
out = @oa.do_run
puts! out, 'do_run office action'
redirect_to request.referrer
end
|
#edit ⇒ Object
37
38
39
40
|
# File 'app/controllers/wco/office_actions_controller.rb', line 37
def edit
@oa = OA.find params[:id]
authorize! :edit, @oa
end
|
#index ⇒ Object
42
43
44
45
46
47
48
|
# File 'app/controllers/wco/office_actions_controller.rb', line 42
def index
authorize! :index, OA
@oas = OA.all
if params[:status]
@oas = @oas.where( status: params[:status] )
end
end
|
#new ⇒ Object
50
51
52
53
|
# File 'app/controllers/wco/office_actions_controller.rb', line 50
def new
@oa = OA.new
authorize! :new, @oa
end
|
#show ⇒ Object
55
56
57
58
|
# File 'app/controllers/wco/office_actions_controller.rb', line 55
def show
@oa = OA.find params[:id]
authorize! :show, @oa
end
|
#update ⇒ Object
60
61
62
63
64
65
66
67
68
69
70
|
# File 'app/controllers/wco/office_actions_controller.rb', line 60
def update
@oa = OA.find params[:id]
authorize! :update, @oa
if @oa.update params[:oa].permit!
flash_notice @oa
else
flash_alert @oa
end
redirect_to action: :index
end
|