From fdff89596eeae060b626e1f376eead7e79437180 Mon Sep 17 00:00:00 2001 From: guerler Date: Mon, 17 Oct 2016 13:43:23 -0400 Subject: [PATCH] Revise main view handling --- .../scripts/mvc/user/user-preferences.js | 23 ++++++++----------- static/maps/mvc/user/user-preferences.js.map | 2 +- static/scripts/mvc/user/user-preferences.js | 2 +- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/client/galaxy/scripts/mvc/user/user-preferences.js b/client/galaxy/scripts/mvc/user/user-preferences.js index a49bdf5d5b0..3df48327a65 100644 --- a/client/galaxy/scripts/mvc/user/user-preferences.js +++ b/client/galaxy/scripts/mvc/user/user-preferences.js @@ -4,7 +4,7 @@ define( [ 'mvc/user/change-user-information', 'mvc/user/change-password', 'mvc/u initialize: function ( ) { this.setElement( '
' ); - this.getUserPreferencesData(); + this.render(); }, /** Redirect to manage user information view */ @@ -74,24 +74,19 @@ define( [ 'mvc/user/change-user-information', 'mvc/user/change-password', 'mvc/u var self = this; var url = Galaxy.root + 'api/user_preferences/change_communication'; $.getJSON( url, function( response ) { - changeCommunication = new ChangeCommunication.ChangeCommunication( self, response ); + changeCommunication = new ChangeCommunication( self, response ); self.$( '.user-preferences-all' ).append( changeCommunication.$el ); }); }, - /** Fetch data for user preferences */ - getUserPreferencesData: function() { - var url = Galaxy.root + 'api/user_preferences', - self = this; - $.getJSON( url, function( data ) { - self.render(data); - }); - }, - /** Render the user preferences list */ - render: function( data ) { - var template = "", - self = this; + render: function() { + var self = this; + $.getJSON( Galaxy.root + 'api/user_preferences', function( data ) { + self.render(data); + }); + + var template = ""; if( data["id"] !== null ) { template = "
" template = template + '

User preferences

' + diff --git a/static/maps/mvc/user/user-preferences.js.map b/static/maps/mvc/user/user-preferences.js.map index 9b1d89d1a14..ebb31cfbf86 100644 --- a/static/maps/mvc/user/user-preferences.js.map +++ b/static/maps/mvc/user/user-preferences.js.map @@ -1 +1 @@ -{"version":3,"file":"user-preferences.js","sources":["../../../src/mvc/user/user-preferences.js"],"names":["define","Manage","Password","Permissions","Keys","ToolboxFilter","ChangeCommunication","UserPreferences","Backbone","View","extend","initialize","this","setElement","getUserPreferencesData","callManageInfo","self","$","hide","getJSON","Galaxy","root","data","userInfo","ManageUserInformation","append","$el","callChangePassword","changePassword","ChangePassword","showPreferences","show","callChangePermissions","url","changePermissions","ChangePermissions","callApiKeys","message","status","response","apiKey","APIKeys","callManageToolboxFilter","toolbox","callChangeCommunication","changeCommunication","render","template","empty","on"],"mappings":"AACAA,QAAU,mCAAoC,2BAA4B,8BAA+B,0BAA2B,iCAAkC,iCAAmC,SAAUC,EAAQC,EAAUC,EAAaC,EAAMC,EAAeC,GACnQ,GAAIC,GAAkBC,SAASC,KAAKC,QAEhCC,WAAY,WACRC,KAAKC,WAAY,UACjBD,KAAKE,0BAITC,eAAgB,WACZ,GAAIC,GAAOJ,IACXK,GAAG,cAAeC,OAClBD,EAAEE,QAASC,OAAOC,KAAO,uCAAwC,SAAUC,GACvE,GAAIC,GAAW,GAAItB,GAAOuB,sBAAuBR,EAAMM,EACvDN,GAAKC,EAAG,yBAA0BQ,OAAQF,EAASG,QAK3DC,mBAAoB,WAChB,GAAIX,GAAOJ,IACXK,GAAG,cAAeC,OAClBD,EAAEE,QAASC,OAAOC,KAAO,uCAAwC,SAAUC,GACvE,GAAIM,GAAiB,GAAI1B,GAAS2B,eAAgBb,EAAMM,EACxDN,GAAKC,EAAG,yBAA0BQ,OAAQG,EAAeF,QAKjEI,gBAAiB,WACblB,KAAKK,EAAG,cAAec,QAI3BC,sBAAuB,WACnB,GAAIC,GAAMb,OAAOC,KAAO,0CACpBL,EAAOJ,KACPc,EAAMT,EAAG,wBACbA,GAAG,cAAeC,OAClBD,EAAEE,QAASc,EAAK,SAAUX,GACtBY,kBAAoB,GAAI/B,GAAYgC,kBAAmBnB,EAAMM,EAAMI,MAK3EU,YAAa,WACT,GAAIH,GAAMb,OAAOC,KAAO,sCACpBC,KACAN,EAAOJ,IACXK,GAAG,cAAeC,OAClBI,GAAS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AEtBnC,KAAKc,IAAIsB,QAAQvB,OAAQsB,GACzB9B,EAAG,oBAAqBgC,GAAI,QAAS,WAAajC,EAAKD,mBACvDE,EAAG,oBAAqBgC,GAAI,QAAS,WAAajC,EAAKW,uBACvDV,EAAG,uBAAwBgC,GAAI,QAAS,WAAajC,EAAKgB,0BAC1Df,EAAG,oBAAqBgC,GAAI,QAAS,WAAajC,EAAKoB,gBACvDnB,EAAG,2BAA4BgC,GAAI,QAAS,WAAajC,EAAK0B,4BAC9DzB,EAAG,iCAAkCgC,GAAI,QAAS,WAAajC,EAAK4B,8BAI5E,QACIrC,gBAAiBA"} \ No newline at end of file +{"version":3,"file":"user-preferences.js","sources":["../../../src/mvc/user/user-preferences.js"],"names":["define","Manage","Password","Permissions","Keys","ToolboxFilter","ChangeCommunication","UserPreferences","Backbone","View","extend","initialize","this","setElement","render","callManageInfo","self","$","hide","getJSON","Galaxy","root","data","userInfo","ManageUserInformation","append","$el","callChangePassword","changePassword","ChangePassword","showPreferences","show","callChangePermissions","url","changePermissions","ChangePermissions","callApiKeys","message","status","response","apiKey","APIKeys","callManageToolboxFilter","toolbox","callChangeCommunication","changeCommunication","template","empty","on"],"mappings":"AACAA,QAAU,mCAAoC,2BAA4B,8BAA+B,0BAA2B,iCAAkC,iCAAmC,SAAUC,EAAQC,EAAUC,EAAaC,EAAMC,EAAeC,GACnQ,GAAIC,GAAkBC,SAASC,KAAKC,QAEhCC,WAAY,WACRC,KAAKC,WAAY,UACjBD,KAAKE,UAITC,eAAgB,WACZ,GAAIC,GAAOJ,IACXK,GAAG,cAAeC,OAClBD,EAAEE,QAASC,OAAOC,KAAO,uCAAwC,SAAUC,GACvE,GAAIC,GAAW,GAAItB,GAAOuB,sBAAuBR,EAAMM,EACvDN,GAAKC,EAAG,yBAA0BQ,OAAQF,EAASG,QAK3DC,mBAAoB,WAChB,GAAIX,GAAOJ,IACXK,GAAG,cAAeC,OAClBD,EAAEE,QAASC,OAAOC,KAAO,uCAAwC,SAAUC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,MAAI,QACnEwB,GAAsB,OACC,WAAnBxB,KAAa,QACRA,KAAkB,cAChBwB,GACA,kMAGPA,GACW,4YAKPxB,KAAa,SAAMA,KAAkB,cACrCwB,GACO,sGAIXA,GACW,+WAKfA,GAAsB,QAEC,WAAnBxB,KAAa,SACbwB,EAAWA,EAAW,4BACXxB,KAAiB,WAAI,mDAC5BA,KAAoB,gBACpBwB,EAAWA,EAAW,+BAAiCxB,KAAY,MAAI,cAE3EwB,GAAsB,wMAItBA,GAAsB,UAIrBxB,KAAc,UACfwB,GAAsB,2CAE1BA,GAAsB,uJAI1BA,GAAsB,eAEtBlC,KAAKc,IAAIqB,QAAQtB,OAAQqB,GACzB7B,EAAG,oBAAqB+B,GAAI,QAAS,WAAahC,EAAKD,mBACvDE,EAAG,oBAAqB+B,GAAI,QAAS,WAAahC,EAAKW,uBACvDV,EAAG,uBAAwB+B,GAAI,QAAS,WAAahC,EAAKgB,0BAC1Df,EAAG,oBAAqB+B,GAAI,QAAS,WAAahC,EAAKoB,gBACvDnB,EAAG,2BAA4B+B,GAAI,QAAS,WAAahC,EAAK0B,4BAC9DzB,EAAG,iCAAkC+B,GAAI,QAAS,WAAahC,EAAK4B,8BAI5E,QACIrC,gBAAiBA"} \ No newline at end of file diff --git a/static/scripts/mvc/user/user-preferences.js b/static/scripts/mvc/user/user-preferences.js index 7a811cd21d7..cf7725db550 100644 --- a/static/scripts/mvc/user/user-preferences.js +++ b/static/scripts/mvc/user/user-preferences.js @@ -1,2 +1,2 @@ -define(["mvc/user/change-user-information","mvc/user/change-password","mvc/user/change-permissions","mvc/user/change-api-key","mvc/user/change-toolbox-filter","mvc/user/change-communication"],function(a,b,c,d,e,f){var g=Backbone.View.extend({initialize:function(){this.setElement("
"),this.getUserPreferencesData()},callManageInfo:function(){var b=this;$(".user-pref").hide(),$.getJSON(Galaxy.root+"api/user_preferences/get_information",function(c){var d=new a.ManageUserInformation(b,c);b.$(".user-preferences-all").append(d.$el)})},callChangePassword:function(){var a=this;$(".user-pref").hide(),$.getJSON(Galaxy.root+"api/user_preferences/change_password",function(c){var d=new b.ChangePassword(a,c);a.$(".user-preferences-all").append(d.$el)})},showPreferences:function(){this.$(".user-pref").show()},callChangePermissions:function(){var a=Galaxy.root+"api/user_preferences/change_permissions",b=this,d=$(".user-preferences-all");$(".user-pref").hide(),$.getJSON(a,function(a){changePermissions=new c.ChangePermissions(b,a,d)})},callApiKeys:function(){var a=Galaxy.root+"api/user_preferences/change_api_key",b={},c=this;$(".user-pref").hide(),b={message:"",status:""},$.getJSON(a,b,function(a){apiKey=new d.APIKeys(c,a),c.$(".user-preferences-all").append(apiKey.$el)})},callManageToolboxFilter:function(){var a=Galaxy.root+"api/user_preferences/change_toolbox_filters",b=this;$(".user-pref").hide(),$.getJSON(a,function(a){toolbox=new e.ToolboxFilter(b,a),b.$(".user-preferences-all").append(toolbox.$el)})},callChangeCommunication:function(){$(".user-pref").hide();var a=this,b=Galaxy.root+"api/user_preferences/change_communication";$.getJSON(b,function(b){changeCommunication=new f.ChangeCommunication(a,b),a.$(".user-preferences-all").append(changeCommunication.$el)})},getUserPreferencesData:function(){var a=Galaxy.root+"api/user_preferences",b=this;$.getJSON(a,function(a){b.render(a)})},render:function(a){var b="",c=this;null!==a.id?(b="
",b=b+'

User preferences

You are currently logged in as '+a.email+".

",b+="","galaxy"===a.webapp&&(b=b+"

You are using "+a.disk_usage+" of disk space in this Galaxy instance.",a.enable_quotas&&(b=b+"Your disk quota is: "+a.quota+"."),b+='Is your usage more than expected? See the documentation for tips on how to find all of the data in your account.',b+="

")):(a.message||(b+="

You are currently not logged in.

"),b+=""),b+="
",this.$el.empty().append(b),$(".manage-userinfo").on("click",function(){c.callManageInfo()}),$(".change-password").on("click",function(){c.callChangePassword()}),$(".change-permissions").on("click",function(){c.callChangePermissions()}),$(".manage-api-keys").on("click",function(){c.callApiKeys()}),$(".manage-toolbox-filters").on("click",function(){c.callManageToolboxFilter()}),$(".change-communication-setting").on("click",function(){c.callChangeCommunication()})}});return{UserPreferences:g}}); +define(["mvc/user/change-user-information","mvc/user/change-password","mvc/user/change-permissions","mvc/user/change-api-key","mvc/user/change-toolbox-filter","mvc/user/change-communication"],function(a,b,c,d,e,f){var g=Backbone.View.extend({initialize:function(){this.setElement("
"),this.render()},callManageInfo:function(){var b=this;$(".user-pref").hide(),$.getJSON(Galaxy.root+"api/user_preferences/get_information",function(c){var d=new a.ManageUserInformation(b,c);b.$(".user-preferences-all").append(d.$el)})},callChangePassword:function(){var a=this;$(".user-pref").hide(),$.getJSON(Galaxy.root+"api/user_preferences/change_password",function(c){var d=new b.ChangePassword(a,c);a.$(".user-preferences-all").append(d.$el)})},showPreferences:function(){this.$(".user-pref").show()},callChangePermissions:function(){var a=Galaxy.root+"api/user_preferences/change_permissions",b=this,d=$(".user-preferences-all");$(".user-pref").hide(),$.getJSON(a,function(a){changePermissions=new c.ChangePermissions(b,a,d)})},callApiKeys:function(){var a=Galaxy.root+"api/user_preferences/change_api_key",b={},c=this;$(".user-pref").hide(),b={message:"",status:""},$.getJSON(a,b,function(a){apiKey=new d.APIKeys(c,a),c.$(".user-preferences-all").append(apiKey.$el)})},callManageToolboxFilter:function(){var a=Galaxy.root+"api/user_preferences/change_toolbox_filters",b=this;$(".user-pref").hide(),$.getJSON(a,function(a){toolbox=new e.ToolboxFilter(b,a),b.$(".user-preferences-all").append(toolbox.$el)})},callChangeCommunication:function(){$(".user-pref").hide();var a=this,b=Galaxy.root+"api/user_preferences/change_communication";$.getJSON(b,function(b){changeCommunication=new f(a,b),a.$(".user-preferences-all").append(changeCommunication.$el)})},render:function(){var a=this;$.getJSON(Galaxy.root+"api/user_preferences",function(b){a.render(b)});var b="";null!==data.id?(b="
",b=b+'

User preferences

You are currently logged in as '+data.email+".

",b+="","galaxy"===data.webapp&&(b=b+"

You are using "+data.disk_usage+" of disk space in this Galaxy instance.",data.enable_quotas&&(b=b+"Your disk quota is: "+data.quota+"."),b+='Is your usage more than expected? See the documentation for tips on how to find all of the data in your account.',b+="

")):(data.message||(b+="

You are currently not logged in.

"),b+=""),b+="
",this.$el.empty().append(b),$(".manage-userinfo").on("click",function(){a.callManageInfo()}),$(".change-password").on("click",function(){a.callChangePassword()}),$(".change-permissions").on("click",function(){a.callChangePermissions()}),$(".manage-api-keys").on("click",function(){a.callApiKeys()}),$(".manage-toolbox-filters").on("click",function(){a.callManageToolboxFilter()}),$(".change-communication-setting").on("click",function(){a.callChangeCommunication()})}});return{UserPreferences:g}}); //# sourceMappingURL=../../../maps/mvc/user/user-preferences.js.map \ No newline at end of file