summaryrefslogtreecommitdiff
path: root/modules/comment/comment-node-form.js
blob: 59edf6d483e3f6f214cb9785bd419029a41b4e8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// $Id$

(function ($) {

Drupal.behaviors.commentFieldsetSummaries = {
  attach: function (context) {
    $('fieldset#edit-comment-settings', context).drupalSetSummary(function (context) {
      return Drupal.checkPlain($('input:checked', context).next('label').text());
    });
    // Provide the summary for the node type form.
    $('fieldset#edit-comment', context).drupalSetSummary(function(context) {
      var vals = [];

      // Default comment setting.
      vals.push($("select[name='comment'] option:selected", context).text());

      // Threading.
      var threading = $("input[name='comment_default_mode']:checked", context).next('label').text();
      if (threading) {
        vals.push(threading);
      }

      // Comments per page.
      var number = $("select[name='comment_default_per_page'] option:selected", context).val();
      vals.push(Drupal.t('@number comments per page', {'@number': number}));

      return Drupal.checkPlain(vals.join(', '));
    });
  }
};

})(jQuery);