-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added changes to implement sorting and styling
- Loading branch information
1 parent
5fb0dae
commit 9885c31
Showing
8 changed files
with
334 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
class Movie < ActiveRecord::Base | ||
end | ||
def self.sort_based(attribute, order) | ||
order("#{attribute} #{order}") | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,31 @@ | ||
<% if local_assigns[:separate] %> | ||
<div id="<%= dom_id movie %>"> | ||
<p>Title: <%= movie.title %></p> | ||
<p>Rating: <%= movie.rating %></p> | ||
<p>Release Date: <%= movie.release_date %></p> | ||
<p>Description: <%= movie.description %></p> | ||
</div> | ||
<% else %> | ||
|
||
|
||
<div id="<%= dom_id movie %>"> | ||
|
||
<tr> | ||
<td> <%= movie.title %> </td> | ||
<td> <%= movie.rating %> </td> | ||
<td> <%= movie.release_date %> </td> | ||
<td> <%= link_to "Click here", movie %> </td> | ||
<td class="<%= params[:attribute] == 'title' && params[:order] == 'asc' ? 'order-asc' : params[:attribute] == 'title' && params[:order] == 'desc' ? 'order-desc' : '' %>"> | ||
<%= movie.title %> | ||
</td> | ||
|
||
<td class="<%= params[:attribute] == 'rating' && params[:order] == 'asc' ? 'order-asc' : params[:attribute] == 'rating' && params[:order] == 'desc' ? 'order-desc' : '' %>"> | ||
<%= movie.rating %> | ||
</td> | ||
|
||
<td class="<%= params[:attribute] == 'release_date' && params[:order] == 'asc' ? 'order-asc' : params[:attribute] == 'release_date' && params[:order] == 'desc' ? 'order-desc' : '' %>"> | ||
<%= movie.release_date %> | ||
</td> | ||
|
||
<td> <%= link_to "Click here", movie %> </td> | ||
</tr> | ||
|
||
</div> | ||
|
||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,59 @@ | ||
<% content_for :title, "Editing movie" %> | ||
<head> | ||
<style> | ||
body { | ||
margin: 0; | ||
color: #333; | ||
} | ||
|
||
<h1>Editing movie</h1> | ||
header { | ||
background-color: #004D98; | ||
color: white; | ||
padding: 10px 20px; | ||
text-align: center; | ||
font-size : 20px | ||
} | ||
|
||
<%= render "form", movie: @movie %> | ||
.content { | ||
padding: 20px; | ||
background-color: #F5F5F5; | ||
font-size : 20px | ||
} | ||
|
||
<br> | ||
footer { | ||
background-color: #D97B9A; | ||
color: white; | ||
text-align: center; | ||
padding: 10px; | ||
width: 100%; | ||
font-size : 20px | ||
} | ||
</style> | ||
</head> | ||
|
||
<div> | ||
|
||
|
||
<body> | ||
<header> | ||
<% content_for :title, "EDIT MOVIE" %> | ||
|
||
<h1>Editing movie</h1> | ||
|
||
</header> | ||
|
||
<div class="content"> | ||
<%= render "form", movie: @movie %> | ||
|
||
<br> | ||
|
||
</div> | ||
|
||
<footer> | ||
<div> | ||
<%= link_to "Show this movie", @movie %> | | ||
<%= link_to "Back to movies", movies_path %> | ||
</div> | ||
|
||
|
||
</footer> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.