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- Anna Barklund - MediaRanker #42

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c1d1916
Initial Rails setup
amb54 Apr 10, 2017
cfbb450
Generetad three controllers (Works, Users and Votes). Generated three…
amb54 Apr 10, 2017
2809052
Generated welcome controller. Added resourses toroutes. Set up the re…
amb54 Apr 11, 2017
38c97fe
Added test for validation to user and vote.Updated test for validatio…
amb54 Apr 11, 2017
6068f37
Added the picture of the owl to the header in the application view
amb54 Apr 11, 2017
a4e30c0
Added text to header with link to the welcome view.
amb54 Apr 11, 2017
d6f49a1
Added data to the works fixture. Tested index for the welcome(main) c…
amb54 Apr 11, 2017
ddd1013
Updated test for the model vote with relations test.
amb54 Apr 11, 2017
36fb1e0
Tests for the actions albums, books and movies in the works controlle…
amb54 Apr 12, 2017
4f8f354
Moved code in welcome index to works index. Tested for show and made …
amb54 Apr 12, 2017
2116edc
Set up the show view for work
amb54 Apr 12, 2017
6ff112f
Updated with an instance variable in the actions albums, books and mo…
amb54 Apr 12, 2017
e9576a6
Created users and votes in seeds.rb. Added a limit of 10 for the inst…
amb54 Apr 13, 2017
9a00613
Destroyed the controllers Welcome and Votes. Updated works controller…
amb54 Apr 13, 2017
f9ea331
First git add/commit after the first successfull heroku deployment. U…
amb54 Apr 14, 2017
6485edc
Updated works controller action index to utilize two new written meth…
amb54 Apr 14, 2017
3727c1c
Changed back works index action. Added if loop in the method order_by…
amb54 Apr 14, 2017
7b0ef0f
Updated index for works controller to ordered records. Subsequently c…
amb54 Apr 14, 2017
6a5e9a1
Changed previous changes to test heroku
amb54 Apr 14, 2017
5bccaed
Changed to ordered records in works controller index (to test heroku).
amb54 Apr 14, 2017
6f05c9d
Updated the index view to test heroku.
amb54 Apr 14, 2017
877ce01
Changed erb part in the index view to be within tag.
amb54 Apr 14, 2017
46d3e01
Removed the change in index to test if heroku deployment works.
amb54 Apr 14, 2017
c8260f5
Added actions to usercontroller. Cleaned up in the works controller. …
amb54 Apr 15, 2017
af59f04
Updated the records for the actions albums, books and movies to be so…
amb54 Apr 15, 2017
e548585
Added foundation code to users index view.
amb54 Apr 15, 2017
5cb5252
Coded the action upvote in works controller. Added links to upvote to…
amb54 Apr 15, 2017
8ca8fd8
Added button to add a new user. Added information text to the header …
amb54 Apr 15, 2017
9c3c9d3
Updated the application view. Added some css for the application. Upd…
amb54 Apr 15, 2017
c3c1c04
Made changes related to css and foundations in works index and catego…
amb54 Apr 16, 2017
d831dbf
Added several foundation related code to the views. Added a table to …
amb54 Apr 17, 2017
4638ff5
Foundation code to the forms
amb54 Apr 17, 2017
07ff333
Corrected spelling
amb54 Apr 17, 2017
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
Updated the records for the actions albums, books and movies to be so…
…rted by number of votes. Updated works category and show view with links.Updated users index and show views with strftime method for the create date. Added foundation code to users index view. Added code to users show.
amb54 committed Apr 15, 2017
commit af59f048c403cccf9af439e1b4d17d6f0f532ee5
12 changes: 4 additions & 8 deletions app/controllers/works_controller.rb
Original file line number Diff line number Diff line change
@@ -8,13 +8,8 @@ def index
# @albums = Work.where(category: "album").limit(10)
# @books = Work.where(category: "book").limit(10)
# @movies = Work.where(category: "movie").limit(10)



end



def new
@work = Work.new
end
@@ -30,21 +25,22 @@ def create
end

def albums
@works = Work.where(category: "album")
@works = Work.where(category: "album").left_joins(:votes).group(:id).order('COUNT(votes.id) DESC')
# @works = Work.where(category: "album")
session.delete(:category)
session[:category] ||= "album"
render "category"
end

def books
@works = Work.where(category: "book")
@works = Work.where(category: "book").left_joins(:votes).group(:id).order('COUNT(votes.id) DESC')
session.delete(:category)
session[:category] ||= "book"
render "category"
end

def movies
@works = Work.where(category: "movie")
@works = Work.where(category: "movie").left_joins(:votes).group(:id).order('COUNT(votes.id) DESC')
session.delete(:category)
session[:category] ||= "movie"
render "category"
12 changes: 6 additions & 6 deletions app/views/users/index.html.erb
Original file line number Diff line number Diff line change
@@ -6,16 +6,16 @@

<section class="table_scroll">
<table>
<tr>
<th>Username</th>
<th>Votes</th>
<th>Joined</th>
<tr class = "row">
<th class = "small-9 colums">Username</th>
<th class = "small-1 colums">Votes</th>
<th class = "small-2 colums">Joined</th>
</tr>
<% @users.order(:name).each do |user| %>
<tr>
<tr class = "row">
<td><%= link_to user.name, user_path(user) %></td>
<td><%= user.votes.count%></td>
<td><%= user.created_at%></td>
<td><%= user.created_at.strftime("%b %d, %Y")%></td>
</tr>
<% end %>
</table>
9 changes: 9 additions & 0 deletions app/views/users/show.html.erb
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
<h1>User Summary: <%= @user.name%></h1>

<p>
<%= @user.created_at.strftime("Joined site %b %d, %Y")%>
</p>

<p>
<%= link_to "See all Users", users_path%>
<%= link_to "Back to Media List", works_path%>
</p>
2 changes: 1 addition & 1 deletion app/views/works/category.html.erb
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
</tr>
<% @works.each do |work| %>
<tr>
<td>A vote </td>
<td> <%=work.votes.count%> </td>
<td><%= link_to work.title, work_path(work) %></td>
<td><%= work.creator%></td>
<td><%= work.publication_year%></td>
2 changes: 1 addition & 1 deletion app/views/works/show.html.erb
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@
</tr>
<% @work.votes.each do |vote| %>
<tr>
<td><%= vote.user.name %></td>
<td><%= link_to vote.user.name, user_path(vote.user) %></td>
<td><%= vote.created_at%></td>
</tr>
<% end %>