Permalink
Browse files

bug 883128, use staticfiles' static template tag instead of hardocdin…

…g STATIC_URL in templates. r=Pike
  • Loading branch information...
1 parent 012ee2c commit 53cdf36a6f72791b84f3b4896bc176bf90ec8a15 @jezdez jezdez committed Jun 20, 2013
@@ -6,13 +6,14 @@
{% endcomment %} -->
{% load simile %}
{% load compress %}
+{% load staticfiles %}
{% load url from future %}
{% block title_matter %}L10n Bug helper{% endblock %}
{% block head_matter %}
<link rel="exhibit/data" type="x-bugzilla-components"
href="https://api-dev.bugzilla.mozilla.org/1.3/configuration?flags=0&amp;cached_ok=1">
{% compress css %}
-<link rel="stylesheet" href="{{ STATIC_URL }}bugsy/css/file_bugs.css" type="text/css">
+<link rel="stylesheet" href="{% static "bugsy/css/file_bugs.css" %}" type="text/css">
{% endcompress %}
{# must be loaded in the head :( #}
@@ -25,7 +26,7 @@
var BUG_LINKS_URL = '{% url "bugsy.views.get_bug_links" %}';
</script>
{% compress js %}
-<script src="{{ STATIC_URL }}bugsy/js/file_bug.js"></script>
+<script src="{% static "bugsy/js/file_bug.js" %}"></script>
{% endcompress %}
{% endblock %}
{% block content %}
@@ -6,6 +6,7 @@
{% endcomment %} -->
{% load simile %}
{% load compress %}
+{% load staticfiles %}
{% load url from future %}
{% block title_matter %}Localization bugs{% endblock %}
{% block head_matter %}
@@ -14,7 +15,7 @@
{% block javascript_matter %}
{% compress js %}
-<script src="{{ STATIC_URL }}bugsy/js/index.js"></script>
+<script src="{% static "bugsy/js/index.js" %}"></script>
{% endcompress %}
{% endblock %}
{% block content %}
@@ -5,6 +5,7 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
{% endcomment %} -->
{% load compress %}
+{% load staticfiles %}
{% load url from future %}
{% block title_matter %}Bugs for a new localization{% endblock %}
{% block head_matter %}
@@ -24,7 +25,7 @@
var NEW_LOCALE_URL = '{% url "bugsy.views.new_locale_bugs" %}';
</script>
{% compress js %}
-<script src="{{ STATIC_URL }}bugsy/js/new_locale.js"></script>
+<script src="{% static "bugsy/js/new_locale.js" %}"></script>
{% endcompress %}
{% endblock %}
{% block content %}
@@ -14,7 +14,6 @@
STYLES_REGEX = re.compile('<link.*?href=["\']([^"\']+)["\'].*?>',
re.M|re.DOTALL)
-MISSING_STATIC_URL = re.compile('\!\{\s*STATIC_URL\s\}')
class EmbedsTestCaseMixin:
"""Checks that any static files referred to in the response exist.
@@ -45,7 +44,3 @@ def assert_all_embeds(self, response):
response = re.sub('<!--(.*)-->', '', response, re.M)
self._check(response, SCRIPTS_REGEX, '.js')
self._check(response, STYLES_REGEX, '.css')
-
- # '{! STATIC_URL }' is something you might guess if the template does
- # a {{ STATIC_URL }} and the view doesn't use a RequestContext
- ok_(not MISSING_STATIC_URL.findall(response))
@@ -5,20 +5,21 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
{% endcomment %} -->
{% load compress %}
+{% load staticfiles %}
{% load url from future %}
{% block title_matter %}Mozilla Localization{% endblock %}
{% block body_tag %}id="home"{% endblock %}
{% block head_matter %}
{% compress css %}
-<link rel="stylesheet" href="{{ STATIC_URL }}homepage/css/index.css" type="text/css">
-<link rel="stylesheet" href="{{ STATIC_URL }}css/chosen/chosen.css" />
+<link rel="stylesheet" href="{% static "homepage/css/index.css" %}" type="text/css">
+<link rel="stylesheet" href="{% static "css/chosen/chosen.css" %}" />
{% endcompress %}
{% endblock %}
{% block javascript_matter %}
-<script src="{{ STATIC_URL }}js/libs/chosen.jquery.js"></script>
-<script src="{{ STATIC_URL }}homepage/js/index.js"></script>
+<script src="{% static "js/libs/chosen.jquery.js" %}"></script>
+<script src="{% static "homepage/js/index.js" %}"></script>
{% endblock %}
{% block alt_header %}
@@ -33,7 +34,7 @@ <h1 class="large">Mozilla in your language</h1>
class="mozilla-video-shadow"
width="580"
height="326"
- poster="{{ STATIC_URL }}/img/poster.jpg"
+ poster="{% static "img/poster.jpg" %}"
controls="controls"
>
<source src="//videos-cdn.mozilla.net/serv/drafts/FFxGlobal.webm" type="video/webm" />
@@ -5,23 +5,24 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
{% endcomment %} -->
{% load compress %}
+{% load staticfiles %}
{% block title_matter %}Mozilla Localization Team {{ locale.name }}{% endblock %}
{% block javascript_matter %}
<script>
var WEBDASHBOARD_URL = '{{ webdashboard_url }}';
var LOCALE_CODE = '{{ locale.code }}';
</script>
{% compress js %}
-<script src="{{ STATIC_URL }}bugsy/js/bugcount.js"></script>
-<script src="{{ STATIC_URL }}homepage/js/webdashboard.js"></script>
+<script src="{% static "bugsy/js/bugcount.js" %}"></script>
+<script src="{% static "homepage/js/webdashboard.js" %}"></script>
{% endcompress %}
{% endblock %}
{% block head_matter %}
{% compress css %}
-<link rel="stylesheet" href="{{ STATIC_URL }}homepage/css/locale-team.css" type="text/css">
-<link rel="stylesheet" href="{{ STATIC_URL }}shipping/css/dashboard.css" type="text/css">
-<link rel="stylesheet" href="{{ STATIC_URL }}shipping/css/snippet.css" type="text/css">
+<link rel="stylesheet" href="{% static "homepage/css/locale-team.css" %}" type="text/css">
+<link rel="stylesheet" href="{% static "shipping/css/dashboard.css" %}" type="text/css">
+<link rel="stylesheet" href="{% static "shipping/css/snippet.css" %}" type="text/css">
{% endcompress %}
{% endblock %}
@@ -55,7 +56,7 @@ <h1 class="large">{{ locale.name }} <span class="lang">({{ locale.code }})</span
{{ bugs }}
<div id="webdashboard">
-<p class="rss-icon-outer" style="float:right"><a href="{{ webdashboard_url }}?locale={{ locale.code }}"><img src="{{ STATIC_URL }}img/icons/feed.png" alt="Subscribe to our feed"></a></p>
+<p class="rss-icon-outer" style="float:right"><a href="{{ webdashboard_url }}?locale={{ locale.code }}"><img src="{% static "img/icons/feed.png" %}" alt="Subscribe to our feed"></a></p>
<h2>Web Dashboard <a href="#webdashboard" class="permalink">#</a></h2>
<p class="intro">The team's work on the <a href="http://www.mozilla.org/{{ locale.code }}/">mozilla.org website</a>
@@ -5,18 +5,19 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
{% endcomment %} -->
{% load compress %}
+{% load staticfiles %}
{% load url from future %}
{% block title_matter %}Mozilla Localization Teams{% endblock %}
{% block head_matter %}
{% compress css %}
-<link rel="stylesheet" href="{{ STATIC_URL }}homepage/css/teams.css" type="text/css">
+<link rel="stylesheet" href="{% static "homepage/css/teams.css" %}" type="text/css">
{% endcompress %}
{% endblock %}
{% block javascript_matter %}
{% compress js %}
-<script src="{{ STATIC_URL }}homepage/js/teams.js"></script>
+<script src="{% static "homepage/js/teams.js" %}"></script>
{% endcompress %}
{% endblock %}
@@ -6,12 +6,13 @@
{% endcomment %} -->
{% load recurse %}
{% load compress %}
+{% load staticfiles %}
{% load url from future %}
{% block title_matter %}
Comparison for {{ run.tree.code }}-{{run.locale.code }} ({{ run.build.buildnumber }}) {% endblock %}
{% block head_matter %}
{% compress css %}
-<link rel="stylesheet" href="{{ STATIC_URL }}l10nstats/css/compare.css" type="text/css">
+<link rel="stylesheet" href="{% static "l10nstats/css/compare.css" %}" type="text/css">
{% endcompress %}
{% endblock %}
{% block content %}
@@ -5,14 +5,15 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
{% endcomment %} -->
{% load compress %}
+{% load staticfiles %}
{% load url from future %}
{% block title_matter %}[{{ locale}}, {{ tree }}] l10n stats{% endblock %}
{% block timeplot_styles %}
{% compress css %}
-<link rel="stylesheet" href="{{ STATIC_URL }}l10nstats/css/timeplot.css" type="text/css">
-<link rel="stylesheet" href="{{ STATIC_URL }}l10nstats/css/history.css" type="text/css">
+<link rel="stylesheet" href="{% static "l10nstats/css/timeplot.css" %}" type="text/css">
+<link rel="stylesheet" href="{% static "l10nstats/css/history.css" %}" type="text/css">
{% endcompress %}
{% endblock %}
@@ -25,8 +26,8 @@
{% block timeplot_scripts %}
{% compress js %}
-<script src="{{ STATIC_URL }}l10nstats/js/timeplot.js"></script>
-<script src="{{ STATIC_URL }}l10nstats/js/history.js"></script>
+<script src="{% static "l10nstats/js/timeplot.js" %}"></script>
+<script src="{% static "l10nstats/js/history.js" %}"></script>
{% endcompress %}
{% endblock %}
@@ -5,11 +5,12 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
{% endcomment %} -->
{% load compress %}
+{% load staticfiles %}
{% block head_matter %}
{% block timeplot_styles %}
{% compress css %}
-<link rel="stylesheet" href="{{ STATIC_URL }}l10nstats/css/timeplot.css" type="text/css">
+<link rel="stylesheet" href="{% static "l10nstats/css/timeplot.css" %}" type="text/css">
{% endcompress %}
{% endblock %}
{% endblock %}
@@ -22,10 +23,10 @@
</script>
{% block timeplot_extra_js %}{% endblock %}
-<script src="{{ STATIC_URL }}js/d3/d3.v2.min.js"></script>
+<script src="{% static "js/d3/d3.v2.min.js" %}"></script>
{% block timeplot_scripts %}
{% compress js %}
-<script src="{{ STATIC_URL }}l10nstats/js/timeplot.js"></script>
+<script src="{% static "l10nstats/js/timeplot.js" %}"></script>
{% endcompress %}
{% endblock %}
{% endblock %}
@@ -5,13 +5,14 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
{% endcomment %} -->
{% load compress %}
+{% load staticfiles %}
{% block title_matter %}{{ tree }} l10n stats{% endblock %}
{% block timeplot_styles %}
{% compress css %}
-<link rel="stylesheet" href="{{ STATIC_URL }}l10nstats/css/timeplot.css" type="text/css">
-<link rel="stylesheet" href="{{ STATIC_URL }}l10nstats/css/tree_progress.css" type="text/css">
+<link rel="stylesheet" href="{% static "l10nstats/css/timeplot.css" %}" type="text/css">
+<link rel="stylesheet" href="{% static "l10nstats/css/tree_progress.css" %}" type="text/css">
{% endcompress %}
{% endblock %}
@@ -29,9 +30,9 @@
{% block timeplot_scripts %}
{% compress js %}
-<script src="{{ STATIC_URL }}l10nstats/js/timeplot.js"></script>
-<script src="{{ STATIC_URL }}l10nstats/js/clusterer.js"></script>
-<script src="{{ STATIC_URL }}l10nstats/js/tree_progress.js"></script>
+<script src="{% static "l10nstats/js/timeplot.js" %}"></script>
+<script src="{% static "l10nstats/js/clusterer.js" %}"></script>
+<script src="{% static "l10nstats/js/tree_progress.js" %}"></script>
{% endcompress %}
{% endblock %}
@@ -5,16 +5,18 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
{% endcomment %} -->
{% load compress %}
+{% load staticfiles %}
+
{% block title_matter %}Add new Privacy Policy{% endblock %}
{% block head_matter %}
{% compress css %}
-<link rel="stylesheet" href="{{ STATIC_URL }}privacy/css/privacy.css" type="text/css">
+<link rel="stylesheet" href="{% static "privacy/css/privacy.css" %}" type="text/css">
{% endcompress %}
{% endblock %}
{% block javascript_matter %}
{% compress js %}
-<script src="{{ STATIC_URL }}privacy/js/add.js"></script>
+<script src="{% static "privacy/js/add.js" %}"></script>
{% endcompress %}
{% endblock %}
@@ -5,11 +5,13 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
{% endcomment %} -->
{% load compress %}
+{% load staticfiles %}
{% load url from future %}
+
{% block title_matter %}Privacy Policy{% endblock %}
{% block head_matter %}
{% compress css %}
-<link rel="stylesheet" href="{{ STATIC_URL }}privacy/css/privacy.css" type="text/css">
+<link rel="stylesheet" href="{% static "privacy/css/privacy.css" %}" type="text/css">
{% endcompress %}
{% endblock %}
@@ -5,24 +5,25 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
{% endcomment %} -->
{% load compress %}
+{% load staticfiles %}
{% load url from future %}
{% block title_matter %}Revision history of Privacy Policies{% endblock %}
{% block head_matter %}
{% compress css %}
-<link rel="stylesheet" href="{{ STATIC_URL }}privacy/css/privacy.css" type="text/css">
+<link rel="stylesheet" href="{% static "privacy/css/privacy.css" %}" type="text/css">
{% endcompress %}
{% compress css %}
-<link rel="stylesheet" href="{{ STATIC_URL }}css/jquery.ui/smoothness/jquery-ui-1.10.3.custom.css" type="text/css">
+<link rel="stylesheet" href="{% static "css/jquery.ui/smoothness/jquery-ui-1.10.3.custom.css" %}" type="text/css">
{% endcompress %}
{% endblock %}
{% block javascript_matter %}
-<script src="{{ STATIC_URL }}js/jquery.ui/jquery-ui-1.10.3.custom.min.js"></script>
+<script src="{% static "js/jquery.ui/jquery-ui-1.10.3.custom.min.js" %}"></script>
{% compress js %}
-<script src="{{ STATIC_URL }}privacy/js/versions.js"></script>
+<script src="{% static "privacy/js/versions.js" %}"></script>
{% endcompress %}
{% endblock %}
@@ -6,20 +6,21 @@
{% endcomment %} -->
{% load recurse %}
{% load compress %}
+{% load staticfiles %}
{% block title_matter %}{% if given_title %}{{given_title}}{% else %}{{repo}} from {{old_rev}} to {{new_rev}}{% endif %}{% endblock %}
{% block site_css %}
{# this is now exactly the same as on confirm-drill.html so the cache can be re-used #}
{% compress css %}
-<link rel="stylesheet" href="{{ STATIC_URL }}css/jquery.ui/smoothness/jquery-ui-1.10.3.custom.css" type="text/css">
-<link rel="stylesheet" href="{{ STATIC_URL }}pushes/css/diff.css" type="text/css">
+<link rel="stylesheet" href="{% static "css/jquery.ui/smoothness/jquery-ui-1.10.3.custom.css" %}" type="text/css">
+<link rel="stylesheet" href="{% static "pushes/css/diff.css" %}" type="text/css">
{% endcompress %}
{% endblock %}
{% block javascript_matter %}
{% compress js %}
-<script src="{{ STATIC_URL }}pushes/js/diff.js"></script>
+<script src="{% static "pushes/js/diff.js" %}"></script>
{% endcompress %}
{% endblock %}
@@ -6,11 +6,12 @@
{% endcomment %} -->
{% load url from future %}
{% load compress %}
+{% load staticfiles %}
{% block title_matter %}Pushes{% endblock %}
{% block head_matter %}
{% compress css %}
-<link rel="stylesheet" href="{{ STATIC_URL }}css/jquery.ui/smoothness/jquery-ui-1.10.3.custom.css" type="text/css">
+<link rel="stylesheet" href="{% static "css/jquery.ui/smoothness/jquery-ui-1.10.3.custom.css" %}" type="text/css">
{% endcompress %}
<style type="text/css">
@@ -29,7 +30,7 @@
</style>
{% endblock %}
{% block javascript_matter %}
-<script src="{{ STATIC_URL }}js/jquery.ui/jquery-ui-1.10.3.custom.min.js"></script>
+<script src="{% static "js/jquery.ui/jquery-ui-1.10.3.custom.min.js" %}"></script>
<script>
var SEARCH = {
FROM: {% if search.from %}'{{ search.from }}'{% else %}null{% endif %}
@@ -38,8 +39,8 @@
var DIFF_APP_URL = '{% url 'pushes.views.diff' %}';
</script>
{% compress js %}
-<script type="text/javascript" src="{{ STATIC_URL }}pushes/js/widgets.js"></script>
-<script type="text/javascript" src="{{ STATIC_URL }}pushes/js/pushlog.js"></script>
+<script type="text/javascript" src="{% static "pushes/js/widgets.js" %}"></script>
+<script type="text/javascript" src="{% static "pushes/js/pushlog.js" %}"></script>
{% endcompress %}
{% endblock %}
Oops, something went wrong.

0 comments on commit 53cdf36

Please sign in to comment.