diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-21 22:52:41 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-21 22:52:41 -0400 |
commit | 20f2479b33bc548c4736cdc1ceffde6e3af3a31d (patch) | |
tree | fcc7416ee5cc9302235fb47b716298d254343433 /app/controllers/admin | |
parent | 41155441c9412ab0dba0b62f606cdef5488343f1 (diff) | |
download | thoughts-20f2479b33bc548c4736cdc1ceffde6e3af3a31d.tar.gz thoughts-20f2479b33bc548c4736cdc1ceffde6e3af3a31d.tar.bz2 thoughts-20f2479b33bc548c4736cdc1ceffde6e3af3a31d.zip |
Added quote editing
Diffstat (limited to 'app/controllers/admin')
-rw-r--r-- | app/controllers/admin/quotes_controller.rb | 20 |
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 | ||
34 | end | 54 | end |