about summary refs log tree commit diff stats
path: root/app/controllers/admin
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/admin')
-rw-r--r--app/controllers/admin/quotes_controller.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/controllers/admin/quotes_controller.rb b/app/controllers/admin/quotes_controller.rb index 2c09627..70a541f 100644 --- a/app/controllers/admin/quotes_controller.rb +++ b/app/controllers/admin/quotes_controller.rb
@@ -9,6 +9,22 @@ class Admin::QuotesController < Admin::AdminController
9 @quotes = Quote.pending.order(id: :desc).paginate(page: params[:page], per_page: 20) 9 @quotes = Quote.pending.order(id: :desc).paginate(page: params[:page], per_page: 20)
10 end 10 end
11 11
12 def edit
13 @quote = Quote.find(params[:id])
14 end
15
16 def update
17 @quote = Quote.find(params[:id])
18
19 if @quote.update(quote_params)
20 flash[:notice] = "Quote was successfully updated."
21 else
22 flash[:error] = "Error updating quote."
23 end
24
25 render :edit
26 end
27
12 def accept 28 def accept
13 @quote = Quote.find(params[:id]) 29 @quote = Quote.find(params[:id])
14 @quote.state = :published 30 @quote.state = :published
@@ -31,4 +47,8 @@ class Admin::QuotesController < Admin::AdminController
31 def set_section 47 def set_section
32 @section = "quotes" 48 @section = "quotes"
33 end 49 end
50
51 def quote_params
52 params.require(:quote).permit(:content, :state, :notes, :submitter, :tag_list)
53 end
34end 54end