blob: a385864333f3f5d9a044408ffaf29dadf4b11d38 [file] [log] [blame]
{% comment %}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
{% endcomment %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
{% block meta %}
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
{% endblock meta %}
<title>{{ page_name|default:"No Page Name Present, please open an issue at http://code.google.com/p/soc/ " }}</title>
{% block stylesheets %}
{% endblock stylesheets %}
</head>
<body>
{% block body %}
{% endblock body %}
{% block scripts %}
{% block synchronous_scripts %}
<script type="text/javascript">
var xsrf_token = '{{xsrf_token}}';
</script>
<script type='text/javascript' src="/js/{{ app_version }}/LABjs/LAB.js"></script>
{% endblock synchronous_scripts %}
<script type="text/javascript">
$LAB
.script("/js/{{ app_version }}/json/json2.js")
{% if is_local %}
.script("/js/{{ app_version }}/jquery/jquery-1.7.2.js")
{% else %}
.script("https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js")
{% endif %}
.wait(
// Post jQuery loading activities.
function () {
/* If there are forms, make all the submit buttons in the page appear
disabled and prevent them to be submitted again to avoid accidental
double clicking. See Issue 980. */
jQuery(function() {
/* Delegate the function to document so it's likely to be the last event
in the queue because of event bubbling. */
jQuery(document).delegate("form", "submit", function (e) {
var form = jQuery(this);
if (form.hasClass("form_disabled")) {
e.preventDefault();
return false;
}
else {
form
.addClass("form_disabled")
.find(":submit")
.addClass("disabled");
}
// Reactivate the forms and their buttons after 3 secs as a fallback.
setTimeout(function () {
form
.removeClass("form_disabled")
.find(":submit")
.removeClass("disabled");
}, 3000);
});
});
}
)
.script("/js/{{ app_version }}/jquery/jquery-cookie.js").wait()
.script("/soc/content/{{ app_version }}/js/melange.js").wait(
function () {
// set global configuration
melange.init({
app_version: "{{ app_version }}",
css_path: "{{ css_path }}",
{% if google_api_key %}
google_api_key: "{{ google_api_key }}",
{% endif %}
{% if is_local %}
is_local: true,
{% else %}
is_local: false,
{% endif %}
});
}
)
.script("/soc/content/{{ app_version }}/js/melange.dependency.js").wait(
function () {
// Shortcuts facilities for children Django templates
var dep = melange.dependency.s;
var tc = function (script, context) {
return new melange.dependency.templateWithContext(script, context);
};
var css = function (css_path) {
return new melange.dependency.cssFile(css_path);
};
melange.dependency.loadScripts([
{% block default_dependencies %}
[
{% if ga_tracking_num %}
dep.melange.analytics,
null,
function() {
melange.analytics.initAnalytics('{{ ga_tracking_num }}');
}
{% endif %}
],
{% endblock default_dependencies %}
{% block dependencies %}
null
{% endblock dependencies %}
]);
}
);
</script>
{% endblock scripts %}
</body>
</html>