Browse files

re-use the screenshot virtual; double-res the image

  • Loading branch information...
1 parent 24695af commit 5a2fbf62467d3bc5f7bf81da815ad8ef09f395e9 Visnu Pitiyanuvath committed Nov 5, 2012
Showing with 9 additions and 9 deletions.
  1. +2 −2 controllers/dashboard.js
  2. +1 −1 migrations/winners.coffee
  3. +3 −3 models/team.coffee
  4. +1 −1 views/people/show.jade
  5. +1 −1 views/teams/entries.jade
  6. +1 −1 views/teams/entry.jade
View
4 controllers/dashboard.js
@@ -99,7 +99,7 @@ module.exports = function(app) {
{ name: team.entry.name
, by: team.name
, slug: team.slug
- , screenshot: team.screenshot()
+ , screenshot: team.screenshot
, url: team.entry.url }
, message: commit.message.trim()
, author: commit.author.username
@@ -125,7 +125,7 @@ module.exports = function(app) {
{ name: team.entry.name
, by: team.name
, slug: team.slug
- , screenshot: team.screenshot()
+ , screenshot: team.screenshot
, url: team.entry.url }
, platform: deploy.platform
, updatedAt: deploy.updatedAt };
View
2 migrations/winners.coffee
@@ -18,7 +18,7 @@ blurb = (category, slug, fn) ->
console.log team.name
fn """
<div style='clear:both'></div>
- <a href='#{team.entry.url}'><img src='#{team.screenshot()}' style='float:right;margin-left:1ex;margin-top:10px;'></a>
+ <a href='#{team.entry.url}'><img src='#{team.screenshot}' style='float:right;margin-left:1ex;margin-top:10px;'></a>
<h2 style='margin-bottom:0'>
#{category}:
<a href='#{team.entry.url}'>#{team.entry.name}</a>
View
6 models/team.coffee
@@ -199,14 +199,14 @@ TeamSchema.method 'prettifyURL', ->
@entry.url = (if typeof(r.uri) is 'string' then r.uri else r.uri.href) or @entry.url
@save()
-TeamSchema.method 'screenshot', ->
+TeamSchema.virtual('screenshot').get ->
return unless url = @entry.url
- qs = querystring.stringify url: url, resize: '160x93', 'out-format': 'png'
+ qs = querystring.stringify url: url, resize: '320x186', 'out-format': 'png'
"http://pinkyurl.com/i?#{qs}"
TeamSchema.method 'updateScreenshot', (callback) ->
return unless @entry.url
- r = request.get @screenshot() + '&expire=1', (error, response, body) ->
+ r = request.get "#{@screenshot}&expire=1", (error, response, body) ->
throw error if error
# no callback
View
2 views/people/show.jade
@@ -39,7 +39,7 @@ h1.name= title(person.name)
.next-vote
.entry-info
- a( href=nextVote.team.entry.url, target='entry' ): img.screenshot( src=nextVote.team.screenshot() )
+ a( href=nextVote.team.entry.url, target='entry' ): img.screenshot( src=nextVote.team.screenshot )
h2: a( href=nextVote.team.entry.url, target='entry' )= nextVote.team.entry.name
h3
| by
View
2 views/teams/entries.jade
@@ -16,7 +16,7 @@ ul.teams
li
- url = team.entry.url
a( href=url )
- img.screenshot( src='http://pinkyurl.com/i?url=' + encodeURIComponent(url) + '&out-format=png&resize=160x93' )
+ img.screenshot( src=team.screenshot )
h2: a( href=url )= team.entry.name
h4 by
a( href='/teams/' + team )= team.name
View
2 views/teams/entry.jade
@@ -1,7 +1,7 @@
.entry-info
- if (url = team.entry.url)
a( href=url )
- img.screenshot( src='http://pinkyurl.com/i?url=' + encodeURIComponent(url) + '&out-format=png&resize=160x93' )
+ img.screenshot( src=team.screenshot )
h2: a( href=url )= team.entry.name
- else
img.screenshot( src='/images/blank.png' )

0 comments on commit 5a2fbf6

Please sign in to comment.