From 7de38e38c3dad9ab884190cc474f86f234602874 Mon Sep 17 00:00:00 2001 From: Coto Date: Mon, 27 Jan 2014 03:23:09 -0300 Subject: [PATCH] refactor for new google analytics code --- boilerplate/config.py | 6 +- boilerplate/lib/basehandler.py | 1 - boilerplate/templates/base.html | 271 +++++++++++++++++--------------- config/localhost.py | 15 ++ 4 files changed, 164 insertions(+), 129 deletions(-) diff --git a/boilerplate/config.py b/boilerplate/config.py index 353fbd44..3b1d009c 100755 --- a/boilerplate/config.py +++ b/boilerplate/config.py @@ -68,9 +68,9 @@ 'captcha_public_key': "PUT_YOUR_RECAPCHA_PUBLIC_KEY_HERE", 'captcha_private_key': "PUT_YOUR_RECAPCHA_PRIVATE_KEY_HERE", - # Leave blank "google_analytics_domain" if you only want Analytics code - 'google_analytics_domain': "YOUR_PRIMARY_DOMAIN (e.g. google.com)", - 'google_analytics_code': "UA-XXXXX-X", + # Use a complete Google Analytics code, no just the Tracking ID + # In config/localhost.py there is an example to fill out this value + 'google_analytics_code': "", # add status codes and templates used to catch and display errors # if a status code is not listed here it will use the default app engine diff --git a/boilerplate/lib/basehandler.py b/boilerplate/lib/basehandler.py index d8af824d..45c7271f 100644 --- a/boilerplate/lib/basehandler.py +++ b/boilerplate/lib/basehandler.py @@ -290,7 +290,6 @@ def render_template(self, filename, **kwargs): # set or overwrite special vars for jinja templates kwargs.update({ - 'google_analytics_domain': self.app.config.get('google_analytics_domain'), 'google_analytics_code': self.app.config.get('google_analytics_code'), 'app_name': self.app.config.get('app_name'), 'user_id': self.user_id, diff --git a/boilerplate/templates/base.html b/boilerplate/templates/base.html index 17b26752..0e46de8c 100644 --- a/boilerplate/templates/base.html +++ b/boilerplate/templates/base.html @@ -17,181 +17,202 @@ {% if is_mobile %} - + {% endif %} {% block mediaCSS %}{% endblock %} - + {{ google_analytics_code }} - - + -
- {% block navbar %} +
+ {% block navbar %} + +
+ +
+ - {% endblock %} + {% endblock %} -
- {% block header %} +
+ {% block header %} - {% endblock %} + {% endblock %} {% if messages|safe %} - {% for message in messages %} -

- × - {{ message[0]|safe }} -

+ {% for message in messages %} +

+ × + {{ message[0]|safe }} +

{% endfor %} {% endif %} - {% block content %}{% endblock %} + {% block content %}{% endblock %} - {% block footer %} + {% block footer %}
- {% trans %}Google App Engine Boilerplate is released under the{% endtrans %} LGPL + {% trans %}Google App Engine Boilerplate is released under the{% endtrans %} + LGPL
- {% endblock %} -
-
+ {% endblock %} + + + + - - - - - + + + + + - - - - - {% if locale_language_id != "en" %} - {% if locale_iso.language == "pt" and locale_iso.territory == "BR" %} - - {% else %} - - {% endif %} + + + + +{% if locale_language_id != "en" %} + {% if locale_iso.language == "pt" and locale_iso.territory == "BR" %} + + {% else %} + {% endif %} - {% block mediaJS %}{% endblock %} - +{% endif %} +{% block mediaJS %}{% endblock %} + diff --git a/config/localhost.py b/config/localhost.py index f78be24a..d8435cc1 100644 --- a/config/localhost.py +++ b/config/localhost.py @@ -3,6 +3,21 @@ # environment this app is running on: localhost, testing, production 'environment': "localhost", +# It is just an example to fill out this value +'google_analytics_code': """ + + """ + # ----> ADD MORE CONFIGURATION OPTIONS HERE <---- } \ No newline at end of file