Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 6 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
Commits on Jul 13, 2012
@tilgovi tilgovi fix placeholder in register form d855653
Commits on Jul 14, 2012
@tilgovi tilgovi update MANIFEST.in
Still had jinja2 stuff in here!
db6d0ab
@tilgovi tilgovi add deform bundle for easy access 97b0f46
@tilgovi tilgovi datauri filter the inject css 15e1527
@tilgovi tilgovi add an HTML5 application cache manifest
The whole thing loads now even without a connection. However, the
Annotator loads in read-only mode since there's no attempt to cache
your credentials or enable offline annotation.

In the meantime, this should just speed up loading.
dfccc93
@tilgovi tilgovi allow embed code to be cached 1891caf
Showing with 81 additions and 4 deletions.
  1. +1 −1 MANIFEST.in
  2. +5 −0 h/resources.yaml
  3. +57 −0 h/templates/appcache.pt
  4. +2 −1 h/templates/base.pt
  5. +16 −2 h/views.py
View
2 MANIFEST.in
@@ -1,2 +1,2 @@
include *.txt *.rst LICENSE NOTICE
-recursive-include h *.ico *.css *.gif *.jpg *.png *.txt *.jinja2 *.js
+recursive-include h *.ico *.css *.gif *.jpg *.png *.txt *.pt *.js
View
5 h/resources.yaml
@@ -38,6 +38,10 @@ injector:
# component for both the annotator and injector.
d3:
contents: h:js/lib/d3.v2.min.js
+deform:
+ contents:
+ - deform:static/scripts/jquery.form-3.09.js
+ - deform:static/scripts/deform.js
easyXDM:
contents: h:js/lib/easyXDM.min.js
handlebars:
@@ -92,6 +96,7 @@ inject_css:
depends: h:sass/base.scss
filters:
- compass
+ - datauri
- cssrewrite
output: css/inject.css
filters: cleancss
View
57 h/templates/appcache.pt
@@ -0,0 +1,57 @@
+CACHE MANIFEST
+
+CACHE:
+<span tal:content="src" tal:omit-tag
+ tal:repeat="src environment['app_css'].urls()" />
+<span tal:content="src" tal:omit-tag
+ tal:repeat="src environment['inject_css'].urls()" />
+
+<span tal:content="src" tal:omit-tag
+ tal:repeat="src environment['annotator'].urls()" />
+<span tal:content="src" tal:omit-tag
+ tal:repeat="src environment['d3'].urls()" />
+<span tal:content="src" tal:omit-tag
+ tal:repeat="src environment['deform'].urls()" />
+<span tal:content="src" tal:omit-tag
+ tal:repeat="src environment['easyXDM'].urls()" />
+<span tal:content="src" tal:omit-tag
+ tal:repeat="src environment['handlebars'].urls()" />
+<span tal:content="src" tal:omit-tag
+ tal:repeat="src environment['injector'].urls()" />
+<span tal:content="src" tal:omit-tag
+ tal:repeat="src environment['jquery'].urls()" />
+<span tal:content="src" tal:omit-tag
+ tal:repeat="src environment['jwz'].urls()" />
+<span tal:content="src" tal:omit-tag
+ tal:repeat="src environment['templates'].urls()" />
+<span tal:content="src" tal:omit-tag
+ tal:repeat="src environment['underscore'].urls()" />
+
+${request.static_url('h:images/down_tab.svg')}
+${request.static_url('h:images/side_tab.svg')}
+${request.static_url('h:images/up_tab.svg')}
+
+${request.static_url('h:images/fave_1.png')}
+${request.static_url('h:images/flag_1.png')}
+${request.static_url('h:images/delete_1.png')}
+${request.static_url('h:images/minus_1.png')}
+${request.static_url('h:images/noise_1.png')}
+${request.static_url('h:images/pen_1.png')}
+${request.static_url('h:images/plus_1.png')}
+${request.static_url('h:images/submit_1.png')}
+
+${request.static_url('h:images/hbar-logo-small.png')}
+
+http://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js
+http://fonts.googleapis.com/css?family=Merriweather%7COpen+Sans%7CPT+Serif
+http://themes.googleusercontent.com/static/fonts/opensans/v6/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff
+http://themes.googleusercontent.com/static/fonts/merriweather/v4/RFda8w1V0eDZheqfcyQ4EHhCUOGz7vYGh680lGh-uXM.woff
+http://themes.googleusercontent.com/static/fonts/ptserif/v4/sDRi4fY9bOiJUbgq53yZCfesZW2xOQ-xsNqO47m55DA.woff
+
+NETWORK:
+${request.route_url('api', subpath='')}
+${request.route_url('api', subpath='')}*
+${request.route_url('forgot')}
+${request.route_url('login')}
+${request.route_url('logout')}
+${request.route_url('register')}
View
3 h/templates/base.pt
@@ -1,5 +1,6 @@
<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang='en' lang='en'>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang='en' lang='en'
+ tal:attributes="manifest manifest | nothing">
<head>
<title>hypothes.is</title>
<meta charset="UTF-8" />
View
18 h/views.py
@@ -63,7 +63,17 @@ class LoginSchema(CSRFSchema):
placeholder="Password"
)
-class RegisterSchema(LoginSchema):
+class RegisterSchema(CSRFSchema):
+ username = SchemaNode(
+ String(),
+ validator=Length(min=4, max=25),
+ placeholder="Username"
+ )
+ password = SchemaNode(
+ String(),
+ widget=PasswordWidget(),
+ placeholder="Password"
+ )
password2 = SchemaNode(
String(),
title='Password',
@@ -202,6 +212,7 @@ def __call__(self):
assets_env = self.request.registry.queryUtility(IWebAssetsEnvironment)
form = self.auth()
form['css_links'].extend(assets_env['app_css'].urls())
+ form['manifest'] = 'appcache.mf'
return form
def auth(request):
@@ -248,6 +259,9 @@ def includeme(config):
config.add_view(app, renderer='string', route_name='app',
attr='partial', xhr=True)
+ config.add_view(lambda r: {}, name='appcache.mf',
+ renderer='templates/appcache.pt')
+
config.add_view(home, renderer='templates/home.pt')
config.add_view(home, attr='partial', renderer='templates/form.pt', xhr=True)
@@ -259,7 +273,7 @@ def includeme(config):
config.add_view(
lambda r: Response(
body=render('h:templates/embed.pt', embed(r), request=r),
- cache_control='must-revalidate',
+ cache_control='max-age=86400; must-revalidate',
content_type='application/javascript',
charset='utf-8'),
route_name='embed')

No commit comments for this range

Something went wrong with that request. Please try again.