split cmpuqrct/templates with base and analytics
authorTero Marttila <terom@fixme.fi>
Wed, 21 Aug 2013 02:14:24 +0300
changeset 53 8e6e7ca39e48
parent 52 bb851151e956
child 54 0a2345d1450a
split cmpuqrct/templates with base and analytics
cmpuqrct/settings/base.py
cmpuqrct/templates/analytics.html
cmpuqrct/templates/base.html
qrurls/static/qrurls/images.css
qrurls/static/qrurls/qrurls.css
qrurls/templates/qrurls/image.html
qrurls/templates/qrurls/index.html
--- a/cmpuqrct/settings/base.py	Wed Aug 21 01:31:35 2013 +0300
+++ b/cmpuqrct/settings/base.py	Wed Aug 21 02:14:24 2013 +0300
@@ -98,9 +98,7 @@
 WSGI_APPLICATION = 'cmpuqrct.wsgi.application'
 
 TEMPLATE_DIRS = (
-    # 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.
+    './cmpuqrct/templates',
 )
 
 INSTALLED_APPS = (
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmpuqrct/templates/analytics.html	Wed Aug 21 02:14:24 2013 +0300
@@ -0,0 +1,11 @@
+<!-- Enjoy ur urchin. -->
+<script>
+  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+
+  ga('create', 'UA-43336396-1', 'qmsk.net');
+  ga('send', 'pageview');
+</script>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmpuqrct/templates/base.html	Wed Aug 21 02:14:24 2013 +0300
@@ -0,0 +1,11 @@
+{% load staticfiles %}
+<html>
+    <head>
+        <title>{% block title %}Yo Dawg. We heard you liked Post-its.{% endblock %}</title>
+        {% block head %}{% endblock %}
+    </head>
+    <body>
+        {% block body %}{% endblock %}
+        {% include "analytics.html" %}
+    </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qrurls/static/qrurls/images.css	Wed Aug 21 02:14:24 2013 +0300
@@ -0,0 +1,35 @@
+/* Images */
+body {
+    background-color: black;
+
+    padding: 0;
+    margin: 0;
+}
+
+div.container {
+    /* Provide relative width for img within */
+    width: 100%;
+    height: 100%;
+}
+
+div.container img {
+    border: none;
+    margin: auto;
+    display: block;
+    
+    /* Scale for portait-mode */
+    max-width: 100%;
+}
+
+div.footer {
+    margin: 1em;
+    padding: 1em;
+    
+    border-radius: 1em;
+    background-color: #080808;
+    opacity: 1.0;
+
+    text-align: center;
+    color: #ff8800;
+    font-weight: bold;
+}
--- a/qrurls/static/qrurls/qrurls.css	Wed Aug 21 01:31:35 2013 +0300
+++ b/qrurls/static/qrurls/qrurls.css	Wed Aug 21 02:14:24 2013 +0300
@@ -1,4 +1,4 @@
-div.qrurls-wrapper {
+div.wrapper {
     width: 50%;
     text-align: center;
     margin: 1em auto;
@@ -12,42 +12,6 @@
     border: none;
 }
 
-p.qrurls-sadface {
+p.sadface {
     font-size: 2em;
 }
-
-/* Images */
-body.qrurls-image {
-    background-color: black;
-
-    padding: 0;
-    margin: 0;
-}
-
-body.qrurls-image .container {
-    /* Provide relative width for img within */
-    width: 100%;
-    height: 100%;
-}
-
-body.qrurls-image img {
-    border: none;
-    margin: auto;
-    display: block;
-    
-    /* Scale for portait-mode */
-    max-width: 100%;
-}
-
-div.footer {
-    margin: 1em;
-    padding: 1em;
-    
-    border-radius: 1em;
-    background-color: #080808;
-    opacity: 1.0;
-
-    text-align: center;
-    color: #ff8800;
-    font-weight: bold;
-}
--- a/qrurls/templates/qrurls/image.html	Wed Aug 21 01:31:35 2013 +0300
+++ b/qrurls/templates/qrurls/image.html	Wed Aug 21 02:14:24 2013 +0300
@@ -1,15 +1,16 @@
+{% extends "base.html" %}
 {% load staticfiles %}
-<html>
-    <head>
-        <title>{{ title }}</title>
-        <link rel="stylesheet" type="text/css" href="{% static 'qrurls/qrurls.css' %}" />
-    </head>
-    <body class="qrurls-image">
-        <div class="container">
-            <img src="{{ image.get_absolute_url }}" title="{{ title }}" />
-            <div class="footer">
-                {{ title }}
-            </div>
+
+{% block title %}{{ title }}{% endblock %}
+{% block head %}
+    <link rel="stylesheet" type="text/css" href="{% static 'qrurls/images.css' %}" />
+{% endblock %}
+
+{% block body %}
+    <div class="container">
+        <img src="{{ image.get_absolute_url }}" title="{{ title }}" />
+        <div class="footer">
+            {{ title }}
         </div>
-    </body>
-</html>
+    </div>
+{% endblock %}
--- a/qrurls/templates/qrurls/index.html	Wed Aug 21 01:31:35 2013 +0300
+++ b/qrurls/templates/qrurls/index.html	Wed Aug 21 02:14:24 2013 +0300
@@ -1,24 +1,25 @@
+{% extends "base.html" %}
 {% load staticfiles %}
-<html>
-    <head>
-        <title>Yo Dawg. We heard you liked QR-codes.</title>
-        <link rel="stylesheet" type="text/css" href="{% static 'qrurls/qrurls.css' %}" />
-    </head>
-    <body>
-        <div class="qrurls-wrapper">
-            {% if urls %}
-            <ul class="qrurls">
-                {% for url in urls %}
-                    <li>
-                        <a href="{{ url.qrcode_url }}">
-                            <img src="{{ url.qrcode_img }}" class="qrcode" />
-                        </a>
-                    </li>
-                {% endfor %}
-            </ul>
-            {% else %}
-            <p class="qrurls-sadface">&#x2639;</p>
-            {% endif %}
-        </div>
-    </body>
-</html>
+
+{% block title %}Yo Dawg. We heard you liked QR-codes.{% endblock %}
+{% block head %}
+    <link rel="stylesheet" type="text/css" href="{% static 'qrurls/qrurls.css' %}" />
+{% endblock %}
+
+{% block body %}
+    <div class="wrapper">
+        {% if urls %}
+        <ul class="qrurls">
+            {% for url in urls %}
+                <li>
+                    <a href="{{ url.qrcode_url }}">
+                        <img src="{{ url.qrcode_img }}" title="{{ url.title }}" class="qrcode" />
+                    </a>
+                </li>
+            {% endfor %}
+        </ul>
+        {% else %}
+        <p class="sadface">&#x2639;</p>
+        {% endif %}
+    </div>
+{% endblock %}