Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Commit

Permalink
[noticket] Don't try and load comments on the resource page
Browse files Browse the repository at this point in the history
  • Loading branch information
morty committed Jan 22, 2016
1 parent f9da196 commit ab60f37
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions ckanext/dgu/theme/src/scripts/dgu-package.js
Expand Up @@ -66,24 +66,27 @@ $(function() {
var spinDiv = $('.comments-spinner')[0];
var commentsSpinner = new Spinner(spinConfig).spin(spinDiv);

var url = '/comment/get/'+window.DATASET_ID+'?comments_per_page=999999';
$.ajax({
url: url,
data: '',
dataType: 'html',
success: function(data, textStatus, xhr) {
commentsSpinner.stop();
$('#comments-container').html(data);
comments();
},
error: function(xhr, status, exception) {
commentsSpinner.stop();
$(spinDiv).hide();
$('#comments .boxed')
.append('Error loading comments: <code>'+url+'</code><br/><br/>')
.append($('<pre>').text(JSON.stringify(exception)));
}
});
// DATASET_ID is only set on dataset page, not on resource page.
if(DATASET_ID in window) {
var url = '/comment/get/'+window.DATASET_ID+'?comments_per_page=999999';
$.ajax({
url: url,
data: '',
dataType: 'html',
success: function(data, textStatus, xhr) {
commentsSpinner.stop();
$('#comments-container').html(data);
comments();
},
error: function(xhr, status, exception) {
commentsSpinner.stop();
$(spinDiv).hide();
$('#comments .boxed')
.append('Error loading comments: <code>'+url+'</code><br/><br/>')
.append($('<pre>').text(JSON.stringify(exception)));
}
});
}

// Year segmentation
$(".year .year_items").hide();
Expand All @@ -95,7 +98,6 @@ $(function() {
// Show the first 'View Less' button
$(".year .hideyear").first().show();


// Show all but the first 'View More' button
$(".year .showyear").show();
$(".year .showyear").first().hide();
Expand Down

0 comments on commit ab60f37

Please sign in to comment.