Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added a manifest for offline access to the app. I don't think it's wo…

…rking riht now, but I'll play with it again later.
  • Loading branch information...
commit fe9467fc6f6eafb5cf8d0db8e00b60673037bbdb 1 parent c69842d
@mjumbewu authored
View
1  .gitignore
@@ -5,3 +5,4 @@ static/jqtouch/demos/
gof.db
index.html
+patterns.manifest
View
13 Makefile
@@ -1,7 +1,9 @@
PATTERNS_DB = gof.db
PATTERNS_SCRIPT = gof.sql
APP_HTML = index.html
-APP_TEMPLATE = templates/patterns.thtml
+APP_MANIFEST = patterns.manifest
+APP_HTML_TEMPLATE = templates/patterns.thtml
+APP_MANIFEST_TEMPLATE = templates/patterns.tmanifest
APP_GENERATOR = generate_app.py
APP_DEPENDENCIES = \
models/category.py \
@@ -11,15 +13,16 @@ all: $(PATTERNS_DB) $(APP_HTML)
db: $(PATTERNS_DB)
-app: $(APP_HTML)
+app: $(APP_HTML) $(APP_MANIFEST)
$(PATTERNS_DB): $(PATTERNS_SCRIPT)
sqlite3 $(PATTERNS_DB) < $(PATTERNS_SCRIPT)
-$(APP_HTML): $(APP_TEMPLATE) $(APP_GENERATOR) $(APP_DEPENDENCIES)
- python $(APP_GENERATOR) > $(APP_HTML)
+$(APP_HTML): $(PATTERNS_DB) $(APP_HTML_TEMPLATE) $(APP_MANIFEST_TEMPLATE) $(APP_GENERATOR) $(APP_DEPENDENCIES)
+ python $(APP_GENERATOR) $(APP_HTML_TEMPLATE) > $(APP_HTML)
+ python $(APP_GENERATOR) $(APP_MANIFEST_TEMPLATE) > $(APP_MANIFEST)
clean:
- rm -f $(PATTERNS_DB) $(APP_HTML)
+ rm -f $(PATTERNS_DB) $(APP_HTML) $(APP_MANIFEST)
rm -f *~ *.pyo *.pyc
View
13 generate_app.py
@@ -1,4 +1,5 @@
import os
+import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from django.template.loader import render_to_string
@@ -6,8 +7,12 @@
from models.category import Category
from models.pattern import Pattern
-values = {
- 'patterns':Pattern.objects.all()
-}
+if __name__ == "__main__":
+ template_name = sys.argv[1]
+
+ values = {
+ 'patterns':Pattern.objects.all()
+ }
+
+ print render_to_string(template_name, values)
-print render_to_string('patterns.thtml', values)
View
2  settings.py
@@ -67,7 +67,7 @@
ROOT_URLCONF = 'gof_patterns.urls'
TEMPLATE_DIRS = (
- os.path.dirname(__file__) + "/templates",
+ os.path.dirname(__file__) + "/",
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
View
6 templates/patterns.thtml
@@ -1,11 +1,10 @@
<!DOCTYPE html>
-<html>
+<html manifest="patterns.manifest">
<head>
<title>GoF Patterns</title>
- <script type="text/javascript" src="http://www.google.com/jsapi"></script>
- <script type="text/javascript"> google.load("jquery", "1.3.2"); </script>
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script src="static/jqtouch/jqtouch/jqtouch.js" type="application/x-javascript" charset="utf-8"></script>
<style type="text/css" media="screen">@import "static/jqtouch/jqtouch/jqtouch.min.css";</style>
<style type="text/css" media="screen">@import "static/jqtouch/themes/jqt/theme.min.css";</style>
@@ -109,7 +108,6 @@
<script>
var jQT = new $.jQTouch({
icon: 'static/icons/escher.png',
- preloadImages: ['static/startup/escher.png'],
startupScreen: 'static/startup/escher.png',
statusBar: 'black'
});
View
38 templates/patterns.tmanifest
@@ -0,0 +1,38 @@
+CACHE MANIFEST
+
+http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
+
+static/jqtouch/extensions/jqt.offline.js
+static/jqtouch/extensions/jqt.autotitles.js
+static/jqtouch/extensions/jqt.location.js
+static/jqtouch/extensions/jqt.floaty.js
+
+static/jqtouch/jqtouch/jquery.1.3.2.min.js
+static/jqtouch/jqtouch/jqtouch.transitions.js
+static/jqtouch/jqtouch/jqtouch.min.js
+static/jqtouch/jqtouch/jqtouch.js
+static/jqtouch/jqtouch/jqtouch.min.css
+static/jqtouch/jqtouch/jqtouch.css
+
+static/jqtouch/themes/jqt/img/whiteButton.png
+static/jqtouch/themes/jqt/img/on_off.png
+static/jqtouch/themes/jqt/img/back_button_clicked.png
+static/jqtouch/themes/jqt/img/chevron_circle.png
+static/jqtouch/themes/jqt/img/back_button.png
+static/jqtouch/themes/jqt/img/loading.gif
+static/jqtouch/themes/jqt/img/button_clicked.png
+static/jqtouch/themes/jqt/img/toggleOn.png
+static/jqtouch/themes/jqt/img/grayButton.png
+static/jqtouch/themes/jqt/img/chevron.png
+static/jqtouch/themes/jqt/img/rowhead.png
+static/jqtouch/themes/jqt/img/button.png
+static/jqtouch/themes/jqt/img/toggle.png
+static/jqtouch/themes/jqt/img/toolbar.png
+static/jqtouch/themes/jqt/theme.css
+static/jqtouch/themes/jqt/theme.min.css
+
+static/icons/escher.png
+static/startup/escher.png
+
+{% for pattern in patterns %}diagrams/png120/{{ pattern.stem }}.png
+{% endfor %}
Please sign in to comment.
Something went wrong with that request. Please try again.