Projet

Général

Profil

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

root / drupal7 / sites / all / modules / panelizer / js / panelizer-ipe.js @ 651307cd

1
/**
2
 * @file
3
 * Provides confirm forms for additional IPE buttons that are Panelizer
4
 * specific.
5
 */
6

    
7
(function ($) {
8
  'use strict';
9

    
10
Drupal.behaviors.PanelizerIPE = {
11
  attach: function (context) {
12
    // Disable the Leave Page dialog warning.
13
    if ($(context).is('form#panels-ipe-edit-control-form.panels-ipe-edit-control-form')) {
14
      window.onbeforeunload = null;
15
      window.onunload = null;
16
    }
17

    
18
    // Update the default with this display.
19
    $('input#panelizer-save-default', context).once('save-default-alert', function() {
20
      $(this).bind('mouseup', function (e) {
21
        if (!confirm(Drupal.t("This will save this configuration as the new default for all entities of this type. This action cannot be undone. Are you sure?"))) {
22
          this.ipeCancelThis = true;
23
          return false;
24
        }
25
      });
26
    });
27

    
28
    // Redirect to confirmation page.
29
    $('input#panelizer-ipe-revert', context).once('revert-alert', function() {
30
      $(this).bind('mouseup', function (e) {
31
        window.location.href = Drupal.settings.panelizer.revert_default_url;
32
        this.ipeCancelThis = true;
33
        return false;
34
      });
35
    });
36
  }
37
};
38

    
39
})(jQuery);