Permalink
Browse files

adding last seven stamp days to watched stamps section

  • Loading branch information...
1 parent b2c3a42 commit 05bae1d33b938c741809702f72cb075cf411dbee @ryanb committed Sep 12, 2009
@@ -1,12 +1,26 @@
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
def mark_image(mark, size = 70)
- if mark
- options = {:size => "#{size}x#{size}", :class => "mark"}
- if mark.position_x && mark.position_y
- options[:style] = "margin-left: #{mark.position_x-size/2-6}px; margin-top: #{mark.position_y-size/2-6}px;"
- end
- image_tag (mark.skip? ? "skip.png" : (mark.image_path || "question_mark.png")), options
+ options = {:size => "#{size}x#{size}", :class => "mark"}
+ if mark.position_x && mark.position_y
+ options[:style] = "margin-left: #{mark.position_x-size/2-6}px; margin-top: #{mark.position_y-size/2-6}px;"
+ end
+ image_tag mark_image_name(mark), options
+ end
+
+ def small_mark_image(mark)
+ image_tag mark_image_name(mark), :size => "25x25"
+ end
+
+ def mark_image_name(mark)
+ if mark.nil?
+ "spacer.gif"
+ elsif mark.skip?
+ "skip.png"
+ elsif mark.image_path.nil?
+ "question_mark.png"
+ else
+ mark.image_path
end
end
@@ -11,12 +11,21 @@
<% unless favorite.stamp.private? %>
<div class="stamp">
<div class="score">
- <%= render :partial => "stamps/score", :locals => { :stamp => favorite.stamp } %>
+ <div class="score_bar" style="background-position: <%= -200 + (favorite.stamp.goal_progress*2) %>px 0">score <%=h favorite.stamp.score %></div>
+ <table border="0" cellspacing="0" cellpadding="0" class="days">
+ <tr>
+ <% (7.days.ago.to_date..Date.today).each do |date| %>
+ <td class="day">
+ <%= small_mark_image(favorite.stamp.marks.first(:conditions => {:marked_on => date})) %>
+ </td>
+ <% end %>
+ </tr>
+ </table>
</div>
<div class="stamper"><%= link_to image_tag("stamper/#{h(favorite.stamp.color)}/small.png", :size => "40x52", :alt => h(favorite.stamp.name)), favorite.stamp %></div>
<h2><%=h favorite.stamp.name %></h2>
<p>
- Stamp by <%=h favorite.stamp.user.display_name if favorite.stamp.user %> |
+ by <%=h favorite.stamp.user.display_name if favorite.stamp.user %> |
<%= link_to "View Details", favorite.stamp %> |
<%= link_to "Stop Watching", favorite, :method => :delete, :confirm => "Are you sure you want to stop watching this stamp?" %>
</p>
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -1,3 +1,8 @@
+#container {
+ width: 675px;
+ max-width: 675px;
+}
+
.stamp {
border: solid 2px #CCC;
padding: 10px 20px;
@@ -21,7 +26,6 @@
}
.score {
- padding-top: 15px;
font-weight: bold;
float: right;
}
@@ -32,27 +36,20 @@
background-color: #D9D9D9;
text-align: center;
padding: 2px 0;
- float: left;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
background-image: url(/images/greenbar.png);
background-repeat: no-repeat;
background-position: -200px;
-}
-
-.score_goal {
- margin-left: 210px;
- padding-top: 3px;
- padding-bottom: 7px;
+ margin-bottom: 5px;
}
.days {
border-collapse: collapse;
- float: right;
+ clear: both;
+ width: 200px;
}
.day {
- border: solid 1px #000;
- width: 30px;
- height: 30px;
+ border: solid 1px #AAA;
}

0 comments on commit 05bae1d

Please sign in to comment.