diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/assets/stylesheets/main/layout.scss | 11 | ||||
| -rw-r--r-- | app/controllers/application_controller.rb | 10 | ||||
| -rw-r--r-- | app/models/scrobble.rb | 2 | ||||
| -rw-r--r-- | app/views/admin/streams/edit.html.haml | 2 | ||||
| -rw-r--r-- | app/views/admin/streams/index.html.haml | 4 | ||||
| -rw-r--r-- | app/views/blogs/_blog.html.haml | 2 | ||||
| -rw-r--r-- | app/views/layouts/application.html.haml | 10 | ||||
| -rw-r--r-- | app/views/layouts/quotes.html.haml | 4 |
8 files changed, 39 insertions, 6 deletions
| diff --git a/app/assets/stylesheets/main/layout.scss b/app/assets/stylesheets/main/layout.scss index ef31ada..d5fe7a7 100644 --- a/app/assets/stylesheets/main/layout.scss +++ b/app/assets/stylesheets/main/layout.scss | |||
| @@ -228,3 +228,14 @@ h2.centered { | |||
| 228 | text-decoration: none; | 228 | text-decoration: none; |
| 229 | } | 229 | } |
| 230 | } | 230 | } |
| 231 | |||
| 232 | #scrobble-box { | ||
| 233 | img { | ||
| 234 | margin: 0 auto; | ||
| 235 | display: block; | ||
| 236 | } | ||
| 237 | |||
| 238 | p { | ||
| 239 | text-align: center; | ||
| 240 | } | ||
| 241 | } | ||
| diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0174cae..ad46fb9 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb | |||
| @@ -1,9 +1,19 @@ | |||
| 1 | class ApplicationController < ActionController::Base | 1 | class ApplicationController < ActionController::Base |
| 2 | protect_from_forgery with: :exception | 2 | protect_from_forgery with: :exception |
| 3 | before_action :choose_random_song | ||
| 3 | 4 | ||
| 4 | private | 5 | private |
| 5 | 6 | ||
| 6 | def after_sign_out_path_for(resource) | 7 | def after_sign_out_path_for(resource) |
| 7 | new_session_path(resource) | 8 | new_session_path(resource) |
| 8 | end | 9 | end |
| 10 | |||
| 11 | def choose_random_song | ||
| 12 | ids = Scrobble.ids | ||
| 13 | if ids.empty? | ||
| 14 | @random_song = nil | ||
| 15 | else | ||
| 16 | @random_song = Scrobble.find(ids.sample) | ||
| 17 | end | ||
| 18 | end | ||
| 9 | end | 19 | end |
| diff --git a/app/models/scrobble.rb b/app/models/scrobble.rb new file mode 100644 index 0000000..f527612 --- /dev/null +++ b/app/models/scrobble.rb | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | class Scrobble < ApplicationRecord | ||
| 2 | end | ||
| diff --git a/app/views/admin/streams/edit.html.haml b/app/views/admin/streams/edit.html.haml index 8d910fe..8c250e2 100644 --- a/app/views/admin/streams/edit.html.haml +++ b/app/views/admin/streams/edit.html.haml | |||
| @@ -1,3 +1,3 @@ | |||
| 1 | - title "Editing #{@stream.title}" | 1 | - title "Editing #{@stream.title}" |
| 2 | = form_for @stream, url: admin_stream_url(@stream), html: { id: "entry-form" } do |f| | 2 | = form_for @stream, url: admin_stream_url(@stream.id), html: { id: "entry-form" } do |f| |
| 3 | = render partial: "form", locals: { f: f } | 3 | = render partial: "form", locals: { f: f } |
| diff --git a/app/views/admin/streams/index.html.haml b/app/views/admin/streams/index.html.haml index 6903fd1..a2a25d7 100644 --- a/app/views/admin/streams/index.html.haml +++ b/app/views/admin/streams/index.html.haml | |||
| @@ -10,5 +10,5 @@ | |||
| 10 | %td= stream.created_at.strftime("%B %d, %Y, %l:%M%P") | 10 | %td= stream.created_at.strftime("%B %d, %Y, %l:%M%P") |
| 11 | %td | 11 | %td |
| 12 | %ul.admin-actions | 12 | %ul.admin-actions |
| 13 | %li= link_to "Edit", edit_admin_stream_url(stream) | 13 | %li= link_to "Edit", edit_admin_stream_url(stream.id) |
| 14 | %li= link_to "Add Update", new_admin_stream_update_url(stream) | 14 | %li= link_to "Add Update", new_admin_stream_update_url(stream.id) |
| diff --git a/app/views/blogs/_blog.html.haml b/app/views/blogs/_blog.html.haml index 878b1a2..34b343f 100644 --- a/app/views/blogs/_blog.html.haml +++ b/app/views/blogs/_blog.html.haml | |||
| @@ -24,5 +24,5 @@ | |||
| 24 | %time.dt-published{ datetime: blog.visible_date.strftime("%Y-%m-%dT%H:%M:%SZ%z") }= blog.visible_date.strftime("%B #{blog.visible_date.day.ordinalize}, %Y at %-I:%M:%S%P") | 24 | %time.dt-published{ datetime: blog.visible_date.strftime("%Y-%m-%dT%H:%M:%SZ%z") }= blog.visible_date.strftime("%B #{blog.visible_date.day.ordinalize}, %Y at %-I:%M:%S%P") |
| 25 | .post-vote{ id: "blog-vote-section-#{blog.id}" } | 25 | .post-vote{ id: "blog-vote-section-#{blog.id}" } |
| 26 | %span.vote-link{ id: "blog-upvote-link-#{blog.id}" }= link_to_unless (not blog.published or blog.already_upvoted?(request.remote_ip)), "👍", upvote_blog_path(blog), remote: true, rel: "nofollow", class: "blog-upvote-link", method: :post | 26 | %span.vote-link{ id: "blog-upvote-link-#{blog.id}" }= link_to_unless (not blog.published or blog.already_upvoted?(request.remote_ip)), "👍", upvote_blog_path(blog), remote: true, rel: "nofollow", class: "blog-upvote-link", method: :post |
| 27 | %span.post-rating{ id: "blog-rating-#{blog.id}" }= blog.upvotes - blog.downvotes | 27 | %span.post-rating{ id: "blog-rating-#{blog.id}" }= blog.upvotes |
| 28 | %span.vote-link{ id: "blog-downvote-link-#{blog.id}" }= link_to_unless (not blog.published or blog.already_downvoted?(request.remote_ip)), "👎", downvote_blog_path(blog), remote: true, rel: "nofollow", class: "blog-downvote-link", method: :post | 28 | %span.vote-link{ id: "blog-downvote-link-#{blog.id}" }= link_to_unless (not blog.published or blog.already_downvoted?(request.remote_ip)), "👎", downvote_blog_path(blog), remote: true, rel: "nofollow", class: "blog-downvote-link", method: :post |
| diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 1d0bea3..6bc7041 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml | |||
| @@ -73,6 +73,16 @@ | |||
| 73 | %li | 73 | %li |
| 74 | = image_tag "feed.png" | 74 | = image_tag "feed.png" |
| 75 | = link_to "Atom feed", blogs_url(format: :atom) | 75 | = link_to "Atom feed", blogs_url(format: :atom) |
| 76 | - unless @random_song.nil? | ||
| 77 | .sidebar-module#scrobble-box | ||
| 78 | .bubble.rounded | ||
| 79 | %h2 Listening to | ||
| 80 | = image_tag @random_song.image, width: "174px" | ||
| 81 | %p | ||
| 82 | %strong= @random_song.title | ||
| 83 | by | ||
| 84 | = @random_song.artist | ||
| 85 | %p= @random_song.album | ||
| 76 | .sidebar-module | 86 | .sidebar-module |
| 77 | .bubble.rounded | 87 | .bubble.rounded |
| 78 | %h2 Meta | 88 | %h2 Meta |
| diff --git a/app/views/layouts/quotes.html.haml b/app/views/layouts/quotes.html.haml index 4b21000..040fdfe 100644 --- a/app/views/layouts/quotes.html.haml +++ b/app/views/layouts/quotes.html.haml | |||
| @@ -21,12 +21,12 @@ | |||
| 21 | %li= link_to_unless_current "Home", quotes_url | 21 | %li= link_to_unless_current "Home", quotes_url |
| 22 | %li= link_to_unless_current "Latest", latest_quotes_url | 22 | %li= link_to_unless_current "Latest", latest_quotes_url |
| 23 | %li= link_to_unless_current "Top", top_quotes_url | 23 | %li= link_to_unless_current "Top", top_quotes_url |
| 24 | %li= link_to "Random", random_quotes_url | 24 | %li{"data-turbolinks" => "false"}= link_to "Random", random_quotes_url |
| 25 | - if user_signed_in? | 25 | - if user_signed_in? |
| 26 | %li= link_to_unless_current "Submit", new_quote_url | 26 | %li= link_to_unless_current "Submit", new_quote_url |
| 27 | %li= link_to_unless_current "Tags", tags_quotes_url | 27 | %li= link_to_unless_current "Tags", tags_quotes_url |
| 28 | %li= link_to_unless_current "Search", search_form_quotes_url | 28 | %li= link_to_unless_current "Search", search_form_quotes_url |
| 29 | %li= link_to_unless_current "Stats", stats_quotes_url | 29 | %li{"data-turbolinks" => "false"}= link_to_unless_current "Stats", stats_quotes_url |
| 30 | %li= link_to_unless_current "Feed", latest_quotes_url(:atom) | 30 | %li= link_to_unless_current "Feed", latest_quotes_url(:atom) |
| 31 | - if user_signed_in? | 31 | - if user_signed_in? |
| 32 | %li= link_to_unless_current "Admin", admin_url | 32 | %li= link_to_unless_current "Admin", admin_url |
