Files
galaxy/static/scripts/packed/galaxy-app-base.js
T

1 line
1.8 KiB
JavaScript

define(["mvc/user/user-model","utils/metrics-logger","utils/add-logging","utils/localization","bootstrapped-data"],function(b,d,h,e,a){function i(o){var n=this;return n._init(o||{})}h(i,"GalaxyApp");i.prototype.defaultOptions={patchExisting:true,root:"/"};i.prototype._init=function l(o){var n=this;_.extend(n,Backbone.Events);n._processOptions(o);n.debug("GalaxyApp.options: ",n.options);n._patchGalaxy(window.Galaxy);n._initLogger(o.loggerOptions||{});n.debug("GalaxyApp.logger: ",n.logger);n._initLocale();n.debug("GalaxyApp.localize: ",n.localize);n.config=o.config||a.config||{};n.debug("GalaxyApp.config: ",n.config);n._initUser(o.user||a.user||{});n.debug("GalaxyApp.user: ",n.user);n.trigger("ready",n);n._setUpListeners();return n};i.prototype._processOptions=function g(p){var o=this,q=o.defaultOptions;o.debug("_processOptions: ",p);o.options={};for(var n in q){if(q.hasOwnProperty(n)){o.options[n]=(p.hasOwnProperty(n))?(p[n]):(q[n])}}return o};i.prototype._patchGalaxy=function g(n){var p=this;if(p.options.patchExisting&&n){p.debug("found existing Galaxy object:",n);for(var o in n){if(n.hasOwnProperty(o)){p.debug("\t patching in "+o+" to Galaxy");p[o]=n[o]}}}};i.prototype._initLogger=function m(o){var n=this;n.debug("_initLogger:",o);n.logger=new d.MetricsLogger(o);return n};i.prototype._initLocale=function k(o){var n=this;n.debug("_initLocale:",o);n.localize=e;window._l=n.localize;return n};i.prototype._initUser=function j(o){var n=this;n.debug("_initUser:",o);n.user=new b.User(o);n.currUser=n.user;return n};i.prototype._setUpListeners=function f(){var n=this;n.lastAjax={};$(document).bind("ajaxSend",function(q,s,o){var r=o.data;try{r=JSON.parse(r)}catch(p){}n.lastAjax={url:location.href.slice(0,-1)+o.url,data:r}})};i.prototype.toString=function c(){var n=this.user.get("email")||"(anonymous)";return"GalaxyApp("+n+")"};return{GalaxyApp:i}});