Projet

Général

Profil

Paste
Télécharger (1,57 ko) Statistiques
| Branche: | Révision:

root / drupal7 / modules / node / node.js @ 76597ebf

1 85ad3d82 Assos Assos
2
(function ($) {
3
4
Drupal.behaviors.nodeFieldsetSummaries = {
5
  attach: function (context) {
6
    $('fieldset.node-form-revision-information', context).drupalSetSummary(function (context) {
7
      var revisionCheckbox = $('.form-item-revision input', context);
8
9
      // Return 'New revision' if the 'Create new revision' checkbox is checked,
10
      // or if the checkbox doesn't exist, but the revision log does. For users
11
      // without the "Administer content" permission the checkbox won't appear,
12
      // but the revision log will if the content type is set to auto-revision.
13
      if (revisionCheckbox.is(':checked') || (!revisionCheckbox.length && $('.form-item-log textarea', context).length)) {
14
        return Drupal.t('New revision');
15
      }
16
17
      return Drupal.t('No revision');
18
    });
19
20
    $('fieldset.node-form-author', context).drupalSetSummary(function (context) {
21
      var name = $('.form-item-name input', context).val() || Drupal.settings.anonymous,
22
        date = $('.form-item-date input', context).val();
23
      return date ?
24
        Drupal.t('By @name on @date', { '@name': name, '@date': date }) :
25
        Drupal.t('By @name', { '@name': name });
26
    });
27
28
    $('fieldset.node-form-options', context).drupalSetSummary(function (context) {
29
      var vals = [];
30
31
      $('input:checked', context).parent().each(function () {
32
        vals.push(Drupal.checkPlain($.trim($(this).text())));
33
      });
34
35
      if (!$('.form-item-status input', context).is(':checked')) {
36
        vals.unshift(Drupal.t('Not published'));
37
      }
38
      return vals.join(', ');
39
    });
40
  }
41
};
42
43
})(jQuery);