~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/javascript/bugtask_index.js

[rs=buildbot-poller] automatic merge from stable. Revisions: 14109,
        14110, 14111, 14112, 14113, 14114, 14115 included.

Show diffs side-by-side

added added

removed removed

Lines of Context:
404
404
                    privacy_text.set(
405
405
                        'innerHTML',
406
406
                        'This report is <strong>private</strong> ');
407
 
                    if (privacy_notification_enabled) {
408
 
                        Y.lp.app.privacy.display_privacy_notification();
409
 
                    }
 
407
                    Y.lp.app.privacy.display_privacy_notification();
410
408
                } else {
411
409
                    Y.one('body').replaceClass('private', 'public');
412
410
                    privacy_div.replaceClass('private', 'public');
413
411
                    privacy_text.set(
414
412
                        'innerHTML', 'This report is public ');
415
 
                    if (privacy_notification_enabled) {
416
 
                        Y.lp.app.privacy.hide_privacy_notification();
417
 
                    }
 
413
                    Y.lp.app.privacy.hide_privacy_notification();
418
414
                }
419
415
                privacy_text.appendChild(privacy_link);
420
416
                privacy_text.appendChild(privacy_spinner);
1156
1152
    var request = io_provider.io(batched_comments_url, {on: handlers});
1157
1153
};
1158
1154
 
 
1155
/**
 
1156
 * Set up the click handling for a single show-more-comments link.
 
1157
 *
 
1158
 * @method setup_show_more_comments_link
 
1159
 * @param link {Node} The link to set up.
 
1160
 * @param url {Object} The current batched_comments_url
 
1161
 * @param container {Node} The node into which to load the comments.
 
1162
 */
 
1163
namespace.setup_show_more_comments_link = function(link, url, container) {
 
1164
    link.on('click', function(e) {
 
1165
        e.preventDefault();
 
1166
        namespace.load_more_comments(url, container);
 
1167
    });
 
1168
    link.addClass('js-action');
 
1169
};
1159
1170
 
1160
1171
/**
1161
1172
 *  Set up click handling to load the rest of the comments for the bug
1164
1175
 * @method setup_load_comments
1165
1176
 */
1166
1177
namespace.setup_load_comments = function() {
1167
 
    var show_comments_link = Y.one('#show-comments-link');
1168
 
    if (Y.Lang.isValue(show_comments_link)) {
 
1178
    var show_comments_links = Y.all('.show-comments-link');
 
1179
    if (show_comments_links) {
1169
1180
        var current_offset = LP.cache.initial_comment_batch_offset;
1170
1181
        var batched_comments_url =
1171
1182
            LP.cache.context.self_link.replace('/api/devel', '') +
1172
1183
            "/+batched-comments?offset=" +
1173
1184
            current_offset;
1174
1185
        var comments_container = Y.one('#comments-container');
1175
 
        show_comments_link.on('click', function(e) {
1176
 
            e.preventDefault();
1177
 
            namespace.load_more_comments(
1178
 
                batched_comments_url, comments_container);
 
1186
        Y.each(show_comments_links, function(link) {
 
1187
            namespace.setup_show_more_comments_link(
 
1188
                link, batched_comments_url, comments_container);
1179
1189
        });
1180
 
        show_comments_link.addClass('js-action');
1181
1190
    }
1182
1191
};
1183
1192