Skip to content

Commit

Permalink
adds the blocks analytics anad javascripts in the base template, allo…
Browse files Browse the repository at this point in the history
…wing parents to override
  • Loading branch information
fredkingham committed Aug 25, 2018
1 parent 3a628c9 commit 2ee6ee5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
### 0.12.0 (Major Release)

#### Misc Changes
* Adds the {% block analytics %} in the base template (opal/templates/base.html) that by default contains the google analytics code.

* Adds the block {% block javascripts %} in the base template (opal/templates/base.html) that will compress all javascripts.

* Adds a method `.demographics()` to `opal.models.Patient` which returns the relevant demographics instance.

Expand Down
34 changes: 19 additions & 15 deletions opal/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
</script>

{% compress js %}
{% block javascripts %}
{% core_javascripts 'opal.upstream.deps' %}
{% block opal_js %}
{% plugin_javascripts 'opal.upstream.deps' %}
Expand All @@ -47,11 +48,12 @@
{% block angularapp %}
<script type="text/javascript" src="{% static "js/opal/app.js" %}"></script>
<script type="text/javascript" src="{% static "js/opal/routes.js" %}"></script>
{% endblock %}
{% endblock angularapp %}

{% application_javascripts %}
<script type="text/javascript" src="{% static "js/opal/timer.js" %}"></script>
{% endblock opal_js %}
{% endblock javascripts %}
{% endcompress %}

<link href="{% static "js/lib/c3-0.4.10/c3.css" %}" rel="stylesheet" media="all">
Expand Down Expand Up @@ -101,20 +103,22 @@ <h4 class="growl-title" ng-show="message.title" ng-bind="message.title"></h4>
</script>

<!-- google analytics -->
<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');

{% if OPAL_ANALYTICS_NODOMAIN %}
ga('create', '{{ OPAL_ANALYTICS_ID }}', {
'cookieDomain': 'none'
});
{% else %}
ga('create', '{{ OPAL_ANALYTICS_ID }}', 'auto');
{% endif %}
</script>
{% block analytics %}
<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');

{% if OPAL_ANALYTICS_NODOMAIN %}
ga('create', '{{ OPAL_ANALYTICS_ID }}', {
'cookieDomain': 'none'
});
{% else %}
ga('create', '{{ OPAL_ANALYTICS_ID }}', 'auto');
{% endif %}
</script>
{% endblock analytics %}
</body>

</html>

0 comments on commit 2ee6ee5

Please sign in to comment.