diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-22 00:06:48 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-22 00:06:48 -0400 |
commit | 4ecc5d37609c3de8d3b013a738f3704f1e70c61a (patch) | |
tree | edcf3b0f38a40d348b72699e2e905b4b8251ae8d | |
parent | 98378969dae552c0c190eea922415d35eb22ae1e (diff) | |
download | thoughts-4ecc5d37609c3de8d3b013a738f3704f1e70c61a.tar.gz thoughts-4ecc5d37609c3de8d3b013a738f3704f1e70c61a.tar.bz2 thoughts-4ecc5d37609c3de8d3b013a738f3704f1e70c61a.zip |
Audio quotes!
-rw-r--r-- | app/controllers/admin/quotes_controller.rb | 2 | ||||
-rw-r--r-- | app/models/quote.rb | 2 | ||||
-rw-r--r-- | app/views/admin/quotes/_form.html.haml | 5 | ||||
-rw-r--r-- | app/views/quotes/_quote.html.haml | 2 |
4 files changed, 10 insertions, 1 deletions
diff --git a/app/controllers/admin/quotes_controller.rb b/app/controllers/admin/quotes_controller.rb index 70a541f..3623463 100644 --- a/app/controllers/admin/quotes_controller.rb +++ b/app/controllers/admin/quotes_controller.rb | |||
@@ -49,6 +49,6 @@ class Admin::QuotesController < Admin::AdminController | |||
49 | end | 49 | end |
50 | 50 | ||
51 | def quote_params | 51 | def quote_params |
52 | params.require(:quote).permit(:content, :state, :notes, :submitter, :tag_list) | 52 | params.require(:quote).permit(:content, :state, :notes, :submitter, :tag_list, :audio) |
53 | end | 53 | end |
54 | end | 54 | end |
diff --git a/app/models/quote.rb b/app/models/quote.rb index d037aab..518d53b 100644 --- a/app/models/quote.rb +++ b/app/models/quote.rb | |||
@@ -5,6 +5,8 @@ class Quote < ApplicationRecord | |||
5 | 5 | ||
6 | acts_as_taggable | 6 | acts_as_taggable |
7 | 7 | ||
8 | has_one_attached :audio | ||
9 | |||
8 | validates :content, presence: true | 10 | validates :content, presence: true |
9 | 11 | ||
10 | enumerize :state, | 12 | enumerize :state, |
diff --git a/app/views/admin/quotes/_form.html.haml b/app/views/admin/quotes/_form.html.haml index 920835b..13948ca 100644 --- a/app/views/admin/quotes/_form.html.haml +++ b/app/views/admin/quotes/_form.html.haml | |||
@@ -24,4 +24,9 @@ | |||
24 | .published-field | 24 | .published-field |
25 | = f.label :state | 25 | = f.label :state |
26 | = f.select :state, Quote.state.options | 26 | = f.select :state, Quote.state.options |
27 | .details-module.image-uploads | ||
28 | %h4 Audio | ||
29 | - if f.object.audio.attached? | ||
30 | = audio_tag(rails_blob_url(f.object.audio), controls: true) | ||
31 | = f.file_field :audio | ||
27 | .details-module= f.submit | 32 | .details-module= f.submit |
diff --git a/app/views/quotes/_quote.html.haml b/app/views/quotes/_quote.html.haml index 46b0266..db6ab8b 100644 --- a/app/views/quotes/_quote.html.haml +++ b/app/views/quotes/_quote.html.haml | |||
@@ -7,6 +7,8 @@ | |||
7 | %datetime= quote.published_date | 7 | %datetime= quote.published_date |
8 | - if user_signed_in? and !quote.new_record? | 8 | - if user_signed_in? and !quote.new_record? |
9 | = link_to "Edit", edit_admin_quote_path(quote), :class => "quote-edit-link" | 9 | = link_to "Edit", edit_admin_quote_path(quote), :class => "quote-edit-link" |
10 | - if quote.audio.attached? | ||
11 | .audioplayer= audio_tag(rails_blob_url(quote.audio), controls: true) | ||
10 | %blockquote.quote-body= raw quote_format(h(quote.content)) | 12 | %blockquote.quote-body= raw quote_format(h(quote.content)) |
11 | - if !quote.new_record? and quote.has_extra? | 13 | - if !quote.new_record? and quote.has_extra? |
12 | .quote-footer | 14 | .quote-footer |