Permalink
Browse files

Added tooltips and some styling changes.

  • Loading branch information...
1 parent 951df6c commit b586c1a889afc11db381a006f4b1d08b3955f70c @hjhart committed Jul 24, 2011
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -11,9 +11,9 @@
var openNotifications = []
var timeout = null;
+var interval = null;
$(document).ready(function() {
- queryNotifications()
$("input[id=movie_adder]").autocomplete({
source: "/movielist.json" + $("input[id=movie_adder]").val(),
@@ -23,10 +23,6 @@ $(document).ready(function() {
}
});
- setInterval(function() {
- queryNotifications()
- }, 5000)
-
$('a.download_torrent').click(function(e) {
e.preventDefault()
console.debug(this, $(this), $(this).attr('id'), this.id)
@@ -72,24 +68,16 @@ $(document).ready(function() {
});
})
- $('.add_movie').fancybox(
- {
+ $('.add_movie').fancybox({
type: 'iframe',
width: '8',
height: '4',
- autoScale: false,
- onStart: function() {
- clearTimeout(timeout);
- },
- onClosed: function() {
- startRefreshTimer();
- }
- }
- )
+ autoScale: false
+ })
$('.movies.index').ready(function() {
- startRefreshTimer()
+// startRefreshTimer()
})
function startRefreshTimer() {
@@ -110,12 +98,16 @@ $(document).ready(function() {
}
},
show: {
- event: 'mouseover'
-// solo: true // Only show one tooltip at a time
+ event: 'mouseover',
+ solo: true // Only show one tooltip at a time
+ },
+ hide: {
+ event: 'mouseleave',
+ fixed: true
},
style: {
classes: 'ui-tooltip-dark ui-tooltip-shadow',
- width: "400px"
+ width: "500px"
},
position: {
at: 'top left'
@@ -8,15 +8,66 @@
.
*/
-.status_bar.ui-progressbar {
+.status_bar.small {
height: 0.5em;
+ width: 173px;
+}
+
+.status_bar.large {
+ height: 0.5em;
+ width: 100%;
+}
+
+.movies.show .rating {
+ width: 50%;
+ float: left;
+ margin: 20px 0;
+ font-size: 24px;
+ font-weight: bold;
+}
+
+.rating img {
+ margin-right: 20px;
+}
+
+.info {
+ width: 25%;
+ float: left;
+}
+
+.status_bar {
margin-right: 20px;
+ border: 1px solid black;
+ background-color: white;
+}
+
+.progress {
+ background-color: green;
+ height: 0.5em;
}
a:link, a:visited {
color: white;
}
#ajax_loader {
- display:none;
+ display: none;
+}
+
+.movies.show * {
+ font-size: 12px;
+}
+
+.movies.show table {
+ width: 100%;
+ text-align: left;
+ margin: 20px 0;
+}
+
+.movies.show .info img {
+ background-color: white;
+}
+
+.movies.show .info {
+ width: 33%;
}
@@ -7,7 +7,6 @@
$background-color: #000030;
$neon-green: #4a9f00;
body {
- padding: 2em 6em;
background-image: url('/assets/background.jpg');
background-repeat: no-repeat;
background-color: $background-color;
@@ -35,6 +34,7 @@ h1 {
.plus {
&:link, &:visited {
color: $neon-green;
+ margin: 0 6em 0 0;
}
}
View
@@ -23,6 +23,59 @@ class Movie < ActiveRecord::Base
MINIMUM_SEEDS = 5
MAX_FILE_SIZE = 1000000000 # in bytes
MIN_FILE_SIZE = 400000000
+ CERTIFIED_FRESH_SCORE = 70
+
+
+ def rating_image
+ return "question_mark.png" if mpaa_rating.nil?
+ image_name = case mpaa_rating.downcase
+ when "r"
+ "R.png"
+ when "pg-13"
+ "PG-13.png"
+ when "g"
+ "G.png"
+ when "nc-17"
+ "NC-17.png"
+ when "pg"
+ "PG.png"
+ else
+ "question_mark.png"
+ end
+
+ File.join("ratings", image_name)
+ end
+
+ def rt_image
+ return "/assets/question_mark.png" if critics_score.nil?
+ if(critics_score > CERTIFIED_FRESH_SCORE)
+ "/assets/certified_fresh.png"
+ else
+ "/assets/splat.png"
+ end
+ end
+
+ def meta_image
+ return "/assets/question_mark.png" if audience_score.nil?
+ if(audience_score > CERTIFIED_FRESH_SCORE)
+ "/assets/meta_certified_fresh.png"
+ else
+ "/assets/meta_splat.png"
+ end
+
+ end
+
+ def display_filesize
+ return "" if download.nil?
+ filesize = download.filesize
+ if filesize.nil?
+ ""
+ elsif(filesize > 1000000 && filesize < 1000000000)
+ "%0.1f" % (filesize / 1000000.0) + "mb"
+ elsif(filesize >= 1000000000)
+ "%0.1f" % (filesize / 1000000000.0) + "gb"
+ end
+ end
def queue_date
return "Loading..." if self.api_queried.nil?
@@ -60,11 +113,17 @@ def self.qualifies(result)
end
def percent_complete
- percent = downloads.first.percent_done
+ return 0 if download.nil?
+ percent = download.percent_done
return 0 if percent.nil?
percent
end
+ def display_runtime
+ return "" if(runtime.nil?)
+ seconds_to_string(runtime * 60)
+ end
+
def display_eta
if self.download.nil?
return ""
@@ -1,21 +1,26 @@
<%# TODO: Scope out the names to the appropriate tables %>
<%# TODO: Check movie release date after adding (add to resque queue) %>
<p id="notice"><%= notice %></p>
-<h1>Movie Queue</h1>
+<script type="text/javascript">
+
+ $('.movies.index').ready(function() {
+ queryNotifications()
+
+ setInterval(function() {
+ queryNotifications()
+ }, 5000)
+ });
+</script>
+<h1 style="padding-left: 4em;">Movie Queue</h1>
<%= link_to '+', new_movie_path, :class => "plus add_movie" %><%= link_to 'Movie', new_movie_path, :class => "add_movie", :id => "add_movie" %>
<br/>
<br/>
<div style="clear: both;"></div>
<% @movies.each do |movie| %>
-<div style="width: 200px; float: left; margin: 20px 20px 0 0; height: 275px;" class="movie_info" data-id="<%= movie.id %>" data-title="<%=movie.name %>">
- <div style="overflow: hidden; height: 250px; width: 160px;">
- <%= link_to image_tag(movie.movie_cover_path, :style => "position: relative; top: 0; height: 250px;"), edit_movie_path(movie) %>
- </div>
- <a href="<%= edit_movie_path(movie) %>">
- <div style="height: <%= movie.image_percentage_height %>; width: 160px; background-color: black; opacity : 0.6; filter: alpha(opacity=40); background-color: #000; position: relative; top: -250px;"></div>
- </a>
- <span style="position:relative; top: '-<%= movie.image_percentage_height %>'; text-align: center; width: 160px;"><%= movie.display_eta %></span>
-</div>
+
+ <div style="float: left; margin: 10px; height: 200px; overflow: hidden;" class="movie_info" data-id="<%= movie.id %>" data-title="<%= movie.name %>">
+ <%= link_to image_tag(movie.movie_cover_path), edit_movie_path(movie) %>
+ </div>
<% end %>
<div style="clear: both;"></div>
@@ -1,37 +1,43 @@
-<html>
-<head>
- <title>Whatever.</title>
- <style type="text/css">
- table * {
- font-size: 12px;
- }
- #movie_info {
- font-size: 12px;
- }
- </style>
-</head>
-<body>
-<table id="movie_info">
- <tr>
- <td><strong>Year</strong></td>
- <td><%= @movie.year %></td>
- </tr>
- <tr>
- <td><strong>Rating</strong></td>
- <td><%= @movie.mpaa_rating %></td>
- </tr>
- <tr>
- <td><strong>Critics Score:</strong></td>
- <td><%= @movie.critics_score %></td>
- </tr>
- <tr>
- <td><strong>Audience Score:</strong></td>
- <td><%= @movie.audience_score %></td>
- </tr>
- <tr>
- <td><strong>Movie Length:</strong></td>
- <td><%= @movie.seconds_to_string(@movie.runtime * 60) %></td>
- </tr>
-</table>
-</body>
-</html>
+<div class="movies show">
+<% if @movie.api_queried.nil? %>
+ <strong>Fetching Information from Rotten Tomatoes...</strong>
+<% else %>
+
+
+<% if @movie.download.present? %>
+ <div class="status_bar large">
+ <div class="progress" style="width: <%= @movie.percent_complete %>%"></div>
+ </div>
+<% end %>
+ <div class="rating"><%= image_tag @movie.rt_image %><%= @movie.critics_score %>%</div>
+ <div class="rating"><%= image_tag @movie.meta_image %><%= @movie.audience_score %>%</div>
+
+ <table>
+ <tr>
+ <th>Running Time</th>
+ <th>Year</th>
+<% if @movie.download.present? %>
+ <th>Filesize</th>
+ <th>ETA:</th>
+<% end %>
+ </tr>
+ <tr>
+ <td><%= @movie.display_runtime %></td>
+ <td><%= @movie.year %></td>
+<% if @movie.download.present? %>
+ <td><%= @movie.display_filesize %></td>
+ <td><%= @movie.display_eta %></td>
+<% end %>
+ </tr>
+ </table>
+
+<% if @movie.download.nil? && @movie.torrents.present? %>
+ <div class="info"><%= link_to "Choose Download", movie_torrents_path(@movie) %></div>
+<% elsif @movie.torrents.empty? %>
+ <div class="info"><%= link_to "Fetch Torrents", "/movie/#{@movie.id}/fetch_torrents" %></div>
+<% end %>
+ <div class="info"><%= link_to "Delete", @movie, method: :delete %></div>
+ <div class="info"><%= link_to "View on RT", @movie.url %></div>
+ <div class="info"><%= image_tag @movie.rating_image %></div>
+</div>
+<% end %>
@@ -0,0 +1,9 @@
+class AddFileLocationToDownload < ActiveRecord::Migration
+ def up
+ add_column :downloads, :download_location, :string
+ end
+
+ def down
+ remove_column :downloads, :download_location
+ end
+end
@@ -0,0 +1,11 @@
+class EnlargeTextFieldsInTorrents < ActiveRecord::Migration
+ def up
+ change_column :torrents, :name, :text
+ change_column :torrents, :link, :text
+ end
+
+ def down
+ change_column :torrents, :name, :string
+ change_column :torrents, :link, :string
+ end
+end
Oops, something went wrong.

0 comments on commit b586c1a

Please sign in to comment.