Permalink
Browse files

adding one more screenshot

  • Loading branch information...
1 parent 143071e commit d0a1b66dae6a274fc100373bd5eb9614ea7b4abf @peterbe committed Oct 12, 2011
View
@@ -1,3 +1,4 @@
+import os
import logging
from pprint import pprint, pformat
import tornado.auth
@@ -415,10 +416,40 @@ def get(self):
@route(r'/screenshots', name='screenshots')
class ScreenshotsHandler(BaseHandler): # pragma: no cover (under development)
+ IMAGES = (
+ ('bookmarklet-in-toolbar.png',
+ u"Bookmarklet in toolbar"),
+ ('on-twitter.png',
+ u"On Twitter"),
+ ('follows-me.png',
+ u"Someone who follows me"),
+ ('too-cool.png',
+ u"Someone who is too cool for me"),
+ ('everyone.png',
+ u"Complete list of all people you follow and if they follow you"),
+ ('lookups.png',
+ u"On /lookups you can see all Twitter traffic in near-real-time"),
+ )
def get(self):
options = {}
options['page_title'] = "Screenshots"
+ images = []
+ static_base_path = os.path.join(
+ self.application.settings['static_path'],
+ 'images',
+ 'screenshots',
+ )
+ for filename, title in self.IMAGES:
+ file_path = os.path.join('images', 'screenshots', filename)
+ file_path_small = file_path.replace('.png', '_small.png')
+ images.append((
+ file_path,
+ file_path_small,
+ title
+ ))
+
+ options['images'] = images
self.render('screenshots.html', **options)
@route('/everyone', name='everyone')
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
@@ -11,20 +11,11 @@
{% block content %}
<p class="shots">
-<a href="{{ static_url('images/screenshots/bookmarklet-in-toolbar.png') }}" title="Bookmarklet in toolbar"
-><img src="{{ static_url('images/screenshots/bookmarklet-in-toolbar_small.png') }}" alt="Bookmarklet in toolbar"></a>
-<a href="{{ static_url('images/screenshots/on-twitter.png') }}" title="On Twitter"
-><img src="{{ static_url('images/screenshots/on-twitter_small.png') }}" alt="On Twitter"></a>
-
-<a href="{{ static_url('images/screenshots/follows-me.png') }}" title="Someone who follows me"
-><img src="{{ static_url('images/screenshots/follows-me_small.png') }}" alt="Someone who follows me"></a>
-
-<a href="{{ static_url('images/screenshots/too-cool.png') }}" title="Someone who is too cool for me"
-><img src="{{ static_url('images/screenshots/too-cool_small.png') }}" alt="Someone who is too cool for me"></a>
-
-<a href="{{ static_url('images/screenshots/everyone.png') }}" title="Complete list of all people you follow and if they follow you"
-><img src="{{ static_url('images/screenshots/everyone_small.png') }}" alt="Complete list of all people you follow and if they follow you"></a>
+{% for file_path, file_path_small, title in images %}
+<a href="{{ static_url(file_path) }}" title="{{ title }}"
+><img src="{{ static_url(file_path_small) }}" alt="{{ title }}"></a>
+{% end %}
</p>
@@ -66,7 +57,7 @@
});
}
});
-
+
$('.shots a').each(function(i) {
$.preLoadImages($(this).attr('href'));
if (location.hash) {
@@ -75,7 +66,7 @@
}
}
});
-
+
});
</script>
{% end %}
View
@@ -1,3 +1,4 @@
+import os
import json
from urllib import urlencode
from .base import BaseHTTPTestCase
@@ -442,6 +443,30 @@ def test_following_someone_following_0(self):
self.assertTrue('%.1f' % (417.0/330) in response.body)
self.assertTrue('%.1f' % (41700.0/1) in response.body)
+ def test_screenshots(self):
+ from handlers import ScreenshotsHandler
+ url = self.reverse_url('screenshots')
+ response = self.client.get(url)
+ self.assertEqual(response.code, 200)
+ static_base_path = os.path.join(
+ self.get_app().settings['static_path'],
+ 'images',
+ 'screenshots',
+ )
+ for filename, title in ScreenshotsHandler.IMAGES:
+ filepath = os.path.join(static_base_path, filename)
+ self.assertTrue(os.path.isfile(filepath))
+ filepath_small = filepath.replace('.png', '_small.png')
+ self.assertTrue(os.path.isfile(filepath_small))
+
+ self.assertTrue(filepath.replace(static_base_path, '')
+ in response.body)
+
+ self.assertTrue(filepath_small.replace(static_base_path, '')
+ in response.body)
+
+ self.assertTrue('alt="%s"' % title in response.body)
+ self.assertTrue('title="%s"' % title in response.body)
def make_twitter_get_authenticated_user_callback(struct):
def twitter_get_authenticated_user(self, callback, **kw):

0 comments on commit d0a1b66

Please sign in to comment.