Projet

Général

Profil

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

root / drupal7 / sites / all / modules / commerce / modules / order / commerce_order.js @ 70a4c29b

1

    
2
(function ($) {
3

    
4
Drupal.behaviors.orderFieldsetSummaries = {
5
  attach: function (context) {
6
    $('fieldset#edit-order-status', context).drupalSetSummary(function (context) {
7
      // If the status has been changed, indicate the original status.
8
      if ($('#edit-status').val() != $('#edit-status-original').val()) {
9
        return Drupal.t('From @title', { '@title' : Drupal.settings.status_titles[$('#edit-status-original').val()] }) + '<br />' + Drupal.t('To @title', { '@title' : Drupal.settings.status_titles[$('#edit-status').val()] });
10
      }
11
      else {
12
        return Drupal.settings.status_titles[$('#edit-status').val()];
13
      }
14
    });
15

    
16
    $('fieldset#edit-user', context).drupalSetSummary(function (context) {
17
      var name = $('#edit-name').val() || Drupal.settings.anonymous,
18
        mail = $('#edit-mail').val();
19
      return mail ?
20
        Drupal.t('Owned by @name', { '@name' : name }) + '<br />' + mail :
21
        Drupal.t('Owned by @name', { '@name': name });
22
    });
23

    
24
    $('fieldset#edit-order-history', context).drupalSetSummary(function (context) {
25
      var summary = $('#edit-created', context).val() ?
26
        Drupal.t('Created @date', { '@date' : $('#edit-created').val() }) :
27
        Drupal.t('New order');
28

    
29
      // Add the changed date to the summary if it's different from the created.
30
      if ($('#edit-created', context).val() != $('#edit-changed', context).val()) {
31
        summary += '<br />' + Drupal.t('Updated @date', { '@date' : $('#edit-changed').val() });
32
      }
33

    
34
      return summary;
35
    });
36
  }
37
};
38

    
39
})(jQuery);