[#5561] Fixed commit browser not working in Allura theme
Signed-off-by: Cory Johns <cjohns@slashdotmedia.com>
diff --git a/Allura/allura/templates/jinja_master/master.html b/Allura/allura/templates/jinja_master/master.html
index 8060240..e297b03 100644
--- a/Allura/allura/templates/jinja_master/master.html
+++ b/Allura/allura/templates/jinja_master/master.html
@@ -71,9 +71,11 @@
</head>
<body{% block body_attrs %}{% endblock %} id="forge">
+ {% block body_top_js %}
{% for blob in g.resource_manager.emit('body_top_js') %}
{{ blob }}
{% endfor %}
+ {% endblock %}
{{theme_macros.header(g.login_url, '/auth/logout')}}
{% set flash = tg.flash_obj.render('flash', use_js=False) %}
<section id="page-body" class="{{g.document_class(neighborhood)}}">
diff --git a/Allura/allura/templates/repo/commit.html b/Allura/allura/templates/repo/commit.html
index d420d47..a43ae6e 100644
--- a/Allura/allura/templates/repo/commit.html
+++ b/Allura/allura/templates/repo/commit.html
@@ -36,14 +36,19 @@
</a>
{% endblock %}
-{% block extra_js %}
+{% block body_top_js %}
{{ super() }}
<script type="text/javascript">
var MAX_REQUESTS = 5; // max simultaneous load requests
var WAIT_FOR = 500; // wait for 100ms when requests queue is full and try again
var diff_queue = []; // queue of diffs waiting for load
var called_count = 0; // count of running load requests
+ </script>
+{% endblock %}
+{% block extra_js %}
+{{ super() }}
+ <script type="text/javascript">
function ld(diff, callback) {
$(diff.selector).load(encodeURI(diff.url), callback);
}
@@ -150,12 +155,10 @@
{% else %}
<img src="{{g.forge_static('images/spinner.gif')}}" class="loading_icon" alt="Loading..."/>
<script type="text/javascript">
- $(document).ready(function() {
- diff_queue.push({
- selector: '#diff-{{loop.index}}',
- url: '{{commit.url()}}tree/{{h.really_unicode(file)}}?barediff={{prev[0]._id if prev else ''}}'
- });
- });
+ diff_queue.push({
+ selector: '#diff-{{loop.index}}',
+ url: '{{commit.url()}}tree/{{h.really_unicode(file)}}?barediff={{prev[0]._id if prev else ''}}'
+ });
</script>
{% endif %}
</div>