Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queues - Maria McGrew - MediaRanker #43

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
spotlight link complete
Maria McGrew committed Apr 13, 2017
commit e9e2a30aa2e6093abdebd599b2d01a2b40c58ed8
3 changes: 3 additions & 0 deletions app/controllers/works_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
class WorksController < ApplicationController
def index
@works = Work.all

offset = rand(Work.count)
@rand_record = Work.offset(offset).first
end

def show
20 changes: 16 additions & 4 deletions app/views/works/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,27 +1,39 @@
<header>

<h2>Media Ranker</h2>
<h3>Ranking the best of everything</h3>
<h1>Media Ranker</h1>
<h2>Ranking the best of everything</h2>

</header>

<body>

<section class="spotlight-section">
<h2>Media Spotlight</h2>

<li><%= link_to @rand_record.title, work_path(@rand_record.id) %></li>

</section>


<section class="top-books">
<h2>Top Books</h2>

<ul>
<% @works.each do |work| %>
<% if work.category == "book" %>
<li><%= link_to work.category, work_path(work.id) %></li>
<li><%= link_to work.title, work_path(work.id) %></li>
<% end %>
<% end %>
</ul>
</section>

<section class="top-albums">
<h2>Top Albums</h2>

<ul>
<% @works.each do |work| %>
<% if work.category == "album" %>
<li><%= link_to work.category, work_path(work.id) %></li>
<li><%= link_to work.title, work_path(work.id) %></li>
<% end %>
<% end %>
</ul>