Mercurial > bugzilla-dashboard
comparison js/modules/app.js @ 80:677df912e92d
added app/loader module.
author | Atul Varma <avarma@mozilla.com> |
---|---|
date | Sun, 25 Apr 2010 22:26:14 -0700 |
parents | a6ad06a2dbc1 |
children | e3de1fe32f40 |
comparison
equal
deleted
inserted
replaced
79:a6ad06a2dbc1 | 80:677df912e92d |
---|---|
1 Require.modules["app/loader"] = function(exports, require) { | |
2 exports.init = function init(moduleExports, options) { | |
3 var bugzilla = require("app/bugzilla-auth").create(options.Bugzilla); | |
4 moduleExports.bugzilla = bugzilla; | |
5 moduleExports.window = options.window; | |
6 moduleExports.jQuery = options.jQuery; | |
7 | |
8 require("app/ui").init(options.window.document); | |
9 }; | |
10 }; | |
11 | |
1 Require.modules["app/login"] = function(exports) { | 12 Require.modules["app/login"] = function(exports) { |
2 var callbacks = []; | 13 var callbacks = []; |
3 var username; | 14 var username; |
4 var password; | 15 var password; |
5 var passwordProvider; | 16 var passwordProvider; |
41 callbacks.forEach(function(cb) { cb(info); }); | 52 callbacks.forEach(function(cb) { cb(info); }); |
42 }; | 53 }; |
43 }; | 54 }; |
44 | 55 |
45 Require.modules["app/bugzilla-auth"] = function(exports, require) { | 56 Require.modules["app/bugzilla-auth"] = function(exports, require) { |
46 var myproto = require("bugzilla"); | 57 exports.create = function(Bugzilla) { |
47 | 58 function AuthenticatedBugzilla() { |
48 exports.Bugzilla = { | 59 this.ajax = function ajax(options) { |
49 ajax: function ajax(options) { | 60 var user = require("app/login").get(); |
50 var user = require("app/login").get(); | 61 |
51 | 62 if (user.isAuthenticated) { |
52 if (user.isAuthenticated) { | 63 if (!options.data) |
53 if (!options.data) | 64 options.data = {}; |
54 options.data = {}; | 65 options.data.username = user.username; |
55 options.data.username = user.username; | 66 options.data.password = user.password; |
56 options.data.password = user.password; | 67 } |
57 } | 68 |
58 | 69 return Bugzilla.ajax.call(this, options); |
59 return myproto.ajax.call(this, options); | 70 }; |
60 }, | 71 } |
61 __proto__: myproto | 72 |
73 AuthenticatedBugzilla.prototype = Bugzilla; | |
74 | |
75 return new AuthenticatedBugzilla(); | |
62 }; | 76 }; |
63 }; | 77 }; |
64 | 78 |
65 Require.modules["app/commands"] = function(exports, require) { | 79 Require.modules["app/commands"] = function(exports, require) { |
66 var commands = {}; | 80 var commands = {}; |
112 Require.modules["app/ui/file-bug"] = function(exports, require) { | 126 Require.modules["app/ui/file-bug"] = function(exports, require) { |
113 const EM_DASH = "\u2014"; | 127 const EM_DASH = "\u2014"; |
114 | 128 |
115 var $ = require("jQuery"); | 129 var $ = require("jQuery"); |
116 var cache = require("cache"); | 130 var cache = require("cache"); |
117 var bugzilla = require("app/bugzilla-auth").Bugzilla; | 131 var bugzilla = require("bugzilla"); |
118 var window = require("window"); | 132 var window = require("window"); |
119 var config = cache.get("configuration"); | 133 var config = cache.get("configuration"); |
120 var needToFetchConfig = config ? false : true; | 134 var needToFetchConfig = config ? false : true; |
121 var categories; | 135 var categories; |
122 var queuedRespond; | 136 var queuedRespond; |
207 }; | 221 }; |
208 }; | 222 }; |
209 | 223 |
210 Require.modules["app/ui/find-user"] = function(exports, require) { | 224 Require.modules["app/ui/find-user"] = function(exports, require) { |
211 var $ = require("jQuery"); | 225 var $ = require("jQuery"); |
212 var bugzilla = require("app/bugzilla-auth").Bugzilla; | 226 var bugzilla = require("bugzilla"); |
213 var window = require("window"); | 227 var window = require("window"); |
214 var currReq; | 228 var currReq; |
215 | 229 |
216 var options = { | 230 var options = { |
217 minLength: 2, | 231 minLength: 2, |
400 | 414 |
401 Require.modules["app/ui/dashboard"] = function(exports, require) { | 415 Require.modules["app/ui/dashboard"] = function(exports, require) { |
402 var $ = require("jQuery"); | 416 var $ = require("jQuery"); |
403 var cache = require("cache"); | 417 var cache = require("cache"); |
404 var dateUtils = require("date-utils"); | 418 var dateUtils = require("date-utils"); |
405 var bugzilla = require("app/bugzilla-auth").Bugzilla; | 419 var bugzilla = require("bugzilla"); |
406 var window = require("window"); | 420 var window = require("window"); |
407 var xhrQueue = require("xhr/queue").create(); | 421 var xhrQueue = require("xhr/queue").create(); |
408 | 422 |
409 function sortByLastChanged(bugs) { | 423 function sortByLastChanged(bugs) { |
410 var lctimes = {}; | 424 var lctimes = {}; |