~ubuntu-branches/ubuntu/raring/horizon/raring

« back to all changes in this revision

Viewing changes to horizon/static/horizon/js/modals.js

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-06-01 10:57:56 UTC
  • mfrom: (1.1.15)
  • Revision ID: package-import@ubuntu.com-20120601105756-dif0km7n98vhdi2x
Tags: 2012.2~f2~20120530.1777-0ubuntu1
* New upstream release. 
* debian/patches/add_juju_settings_panel.patch: Refreshed
* debian/patches/turn-off-debug.patch: Refreshed

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Storage for our current jqXHR object.
2
 
horizon.modals._request = null;
 
1
/* Namespace for core functionality related to modal dialogs. */
 
2
horizon.modals = {
 
3
  // Storage for our current jqXHR object.
 
4
  _request: null,
 
5
  spinner: null,
 
6
 
 
7
  spinner_options: {
 
8
    lines:  10,
 
9
    length: 15,
 
10
    width:  4,
 
11
    radius: 10,
 
12
    color:  '#000',
 
13
    speed:  0.8,
 
14
    trail:  50
 
15
  }
 
16
};
 
17
 
 
18
 
 
19
/* Creates a modal dialog from the client-side template. */
 
20
horizon.modals.create = function (title, body, confirm, cancel) {
 
21
  if (!cancel) {
 
22
    cancel = "Cancel";
 
23
  }
 
24
  var template = horizon.templates.compiled_templates["#modal_template"],
 
25
    params = {title: title, body: body, confirm: confirm, cancel: cancel},
 
26
    modal = $(template.render(params)).appendTo("body");
 
27
  return modal;
 
28
};
 
29
 
3
30
 
4
31
horizon.modals.success = function (data, textStatus, jqXHR) {
5
32
  $('body').append(data);
77
104
    }
78
105
 
79
106
    horizon.modals._request = $.ajax($this.attr('href'), {
 
107
      beforeSend: function() {
 
108
        var template = horizon.templates.compiled_templates["#spinner-modal"];
 
109
        horizon.modals.spinner = $(template.render());
 
110
 
 
111
        horizon.modals.spinner.appendTo("body");
 
112
        horizon.modals.spinner.modal({backdrop: 'static'});
 
113
        horizon.modals.spinner.spin(horizon.modals.spinner_options);
 
114
      },
80
115
      complete: function () {
81
116
        // Clear the global storage;
82
117
        horizon.modals._request = null;
 
118
        horizon.modals.spinner.modal('hide');
83
119
      },
84
120
      error: function(jqXHR, status, errorThrown) {
85
121
        if (jqXHR.status === 401){