add root prefix to all library BB model urls

This commit is contained in:
Martin Cech
2015-03-24 11:14:11 -04:00
parent cbe953cb70
commit 9eed7ddb56
3 changed files with 23 additions and 23 deletions
@@ -4,7 +4,7 @@ define([], function() {
// LIBRARY RELATED MODELS
var Library = Backbone.Model.extend({
urlRoot: '/api/libraries/',
urlRoot: ( window.galaxy_config ? galaxy_config.root : '/' ) + 'api/libraries/',
/** based on show_deleted would this lib show in the list of lib's?
* @param {Boolean} show_deleted are we including deleted libraries?
@@ -19,7 +19,7 @@ define([], function() {
});
var Libraries = Backbone.Collection.extend({
url: '/api/libraries',
url: ( window.galaxy_config ? galaxy_config.root : '/' ) + 'api/libraries',
model: Library,
@@ -84,15 +84,15 @@ define([], function() {
// FOLDER RELATED MODELS
var Item = Backbone.Model.extend({
urlRoot : '/api/libraries/datasets/'
urlRoot : ( window.galaxy_config ? galaxy_config.root : '/' ) + 'api/libraries/datasets/'
});
var Ldda = Backbone.Model.extend({
urlRoot : '/api/libraries/datasets/'
urlRoot : ( window.galaxy_config ? galaxy_config.root : '/' ) + 'api/libraries/datasets/'
});
var FolderAsModel = Backbone.Model.extend({
urlRoot: '/api/folders'
urlRoot: ( window.galaxy_config ? galaxy_config.root : '/' ) + 'api/folders'
});
var Folder = Backbone.Collection.extend({
@@ -152,7 +152,7 @@ define([], function() {
var FolderContainer = Backbone.Model.extend({
defaults : {
folder : new Folder(),
urlRoot : "/api/folders/",
urlRoot : ( window.galaxy_config ? galaxy_config.root : '/' ) + 'api/folders/',
id : "unknown"
},
parse : function(obj) {
@@ -169,11 +169,11 @@ define([], function() {
// TODO UNITE
var HistoryItem = Backbone.Model.extend({
urlRoot : '/api/histories/'
urlRoot : ( window.galaxy_config ? galaxy_config.root : '/' ) + 'api/histories/'
});
var HistoryContents = Backbone.Collection.extend({
urlRoot : '/api/histories/',
urlRoot : ( window.galaxy_config ? galaxy_config.root : '/' ) + 'api/histories/',
initialize: function(options){
this.id = options.id;
},
@@ -184,11 +184,11 @@ define([], function() {
});
var GalaxyHistory = Backbone.Model.extend({
urlRoot : '/api/histories/'
urlRoot : ( window.galaxy_config ? galaxy_config.root : '/' ) + 'api/histories/'
});
var GalaxyHistories = Backbone.Collection.extend({
url : '/api/histories',
url : ( window.galaxy_config ? galaxy_config.root : '/' ) + 'api/histories',
model : GalaxyHistory
});
@@ -199,7 +199,7 @@ define([], function() {
*/
var Jstree = Backbone.Model.extend({
urlRoot: '/api/remote_files'
urlRoot: ( window.galaxy_config ? galaxy_config.root : '/' ) + 'api/remote_files'
});
return {
+11 -11
View File
@@ -4,7 +4,7 @@ define([], function() {
// LIBRARY RELATED MODELS
var Library = Backbone.Model.extend({
urlRoot: '/api/libraries/',
urlRoot: ( window.galaxy_config ? galaxy_config.root : '/' ) + 'api/libraries/',
/** based on show_deleted would this lib show in the list of lib's?
* @param {Boolean} show_deleted are we including deleted libraries?
@@ -19,7 +19,7 @@ define([], function() {
});
var Libraries = Backbone.Collection.extend({
url: '/api/libraries',
url: ( window.galaxy_config ? galaxy_config.root : '/' ) + 'api/libraries',
model: Library,
@@ -84,15 +84,15 @@ define([], function() {
// FOLDER RELATED MODELS
var Item = Backbone.Model.extend({
urlRoot : '/api/libraries/datasets/'
urlRoot : ( window.galaxy_config ? galaxy_config.root : '/' ) + 'api/libraries/datasets/'
});
var Ldda = Backbone.Model.extend({
urlRoot : '/api/libraries/datasets/'
urlRoot : ( window.galaxy_config ? galaxy_config.root : '/' ) + 'api/libraries/datasets/'
});
var FolderAsModel = Backbone.Model.extend({
urlRoot: '/api/folders'
urlRoot: ( window.galaxy_config ? galaxy_config.root : '/' ) + 'api/folders'
});
var Folder = Backbone.Collection.extend({
@@ -152,7 +152,7 @@ define([], function() {
var FolderContainer = Backbone.Model.extend({
defaults : {
folder : new Folder(),
urlRoot : "/api/folders/",
urlRoot : ( window.galaxy_config ? galaxy_config.root : '/' ) + 'api/folders/',
id : "unknown"
},
parse : function(obj) {
@@ -169,11 +169,11 @@ define([], function() {
// TODO UNITE
var HistoryItem = Backbone.Model.extend({
urlRoot : '/api/histories/'
urlRoot : ( window.galaxy_config ? galaxy_config.root : '/' ) + 'api/histories/'
});
var HistoryContents = Backbone.Collection.extend({
urlRoot : '/api/histories/',
urlRoot : ( window.galaxy_config ? galaxy_config.root : '/' ) + 'api/histories/',
initialize: function(options){
this.id = options.id;
},
@@ -184,11 +184,11 @@ define([], function() {
});
var GalaxyHistory = Backbone.Model.extend({
urlRoot : '/api/histories/'
urlRoot : ( window.galaxy_config ? galaxy_config.root : '/' ) + 'api/histories/'
});
var GalaxyHistories = Backbone.Collection.extend({
url : '/api/histories',
url : ( window.galaxy_config ? galaxy_config.root : '/' ) + 'api/histories',
model : GalaxyHistory
});
@@ -199,7 +199,7 @@ define([], function() {
*/
var Jstree = Backbone.Model.extend({
urlRoot: '/api/remote_files'
urlRoot: ( window.galaxy_config ? galaxy_config.root : '/' ) + 'api/remote_files'
});
return {
@@ -1 +1 @@
define([],function(){var f=Backbone.Model.extend({urlRoot:"/api/libraries/",isVisible:function(n){var m=true;if((!n)&&(this.get("deleted"))){m=false}return m}});var i=Backbone.Collection.extend({url:"/api/libraries",model:f,sort_key:"name",sort_order:null,initialize:function(m){m=m||{}},getVisible:function(n,o){o=o||[];var m=new i(this.filter(function(p){return p.isVisible(n)}));return m},sortByNameAsc:function(){this.comparator=function(n,m){if(n.get("name").toLowerCase()>m.get("name").toLowerCase()){return 1}if(m.get("name").toLowerCase()>n.get("name").toLowerCase()){return -1}return 0};this.sort();return this},sortByNameDesc:function(){this.comparator=function(n,m){if(n.get("name").toLowerCase()>m.get("name").toLowerCase()){return -1}if(m.get("name").toLowerCase()>n.get("name").toLowerCase()){return 1}return 0};this.sort();return this}});var g=Backbone.Model.extend({urlRoot:"/api/libraries/datasets/"});var l=Backbone.Model.extend({urlRoot:"/api/libraries/datasets/"});var a=Backbone.Model.extend({urlRoot:"/api/folders"});var c=Backbone.Collection.extend({model:g,sortByNameAsc:function(){this.comparator=function(n,m){if(n.get("type")===m.get("type")){if(n.get("name").toLowerCase()>m.get("name").toLowerCase()){return 1}if(m.get("name").toLowerCase()>n.get("name").toLowerCase()){return -1}return 0}else{if(n.get("type")==="folder"){return -1}else{return 1}}};this.sort();return this},sortByNameDesc:function(){this.comparator=function(n,m){if(n.get("type")===m.get("type")){if(n.get("name").toLowerCase()>m.get("name").toLowerCase()){return -1}if(m.get("name").toLowerCase()>n.get("name").toLowerCase()){return 1}return 0}else{if(n.get("type")==="folder"){return -1}else{return 1}}};this.sort();return this}});var e=Backbone.Model.extend({defaults:{folder:new c(),urlRoot:"/api/folders/",id:"unknown"},parse:function(m){this.get("folder").reset(m.folder_contents);return m}});var b=Backbone.Model.extend({urlRoot:"/api/histories/"});var d=Backbone.Collection.extend({urlRoot:"/api/histories/",initialize:function(m){this.id=m.id},url:function(){return this.urlRoot+this.id+"/contents"},model:b});var h=Backbone.Model.extend({urlRoot:"/api/histories/"});var k=Backbone.Collection.extend({url:"/api/histories",model:h});var j=Backbone.Model.extend({urlRoot:"/api/remote_files"});return{Library:f,FolderAsModel:a,Libraries:i,Item:g,Ldda:l,Folder:c,FolderContainer:e,HistoryItem:b,HistoryContents:d,GalaxyHistory:h,GalaxyHistories:k,Jstree:j}});
define([],function(){var f=Backbone.Model.extend({urlRoot:(window.galaxy_config?galaxy_config.root:"/")+"api/libraries/",isVisible:function(n){var m=true;if((!n)&&(this.get("deleted"))){m=false}return m}});var i=Backbone.Collection.extend({url:(window.galaxy_config?galaxy_config.root:"/")+"api/libraries",model:f,sort_key:"name",sort_order:null,initialize:function(m){m=m||{}},getVisible:function(n,o){o=o||[];var m=new i(this.filter(function(p){return p.isVisible(n)}));return m},sortByNameAsc:function(){this.comparator=function(n,m){if(n.get("name").toLowerCase()>m.get("name").toLowerCase()){return 1}if(m.get("name").toLowerCase()>n.get("name").toLowerCase()){return -1}return 0};this.sort();return this},sortByNameDesc:function(){this.comparator=function(n,m){if(n.get("name").toLowerCase()>m.get("name").toLowerCase()){return -1}if(m.get("name").toLowerCase()>n.get("name").toLowerCase()){return 1}return 0};this.sort();return this}});var g=Backbone.Model.extend({urlRoot:(window.galaxy_config?galaxy_config.root:"/")+"api/libraries/datasets/"});var l=Backbone.Model.extend({urlRoot:(window.galaxy_config?galaxy_config.root:"/")+"api/libraries/datasets/"});var a=Backbone.Model.extend({urlRoot:(window.galaxy_config?galaxy_config.root:"/")+"api/folders"});var c=Backbone.Collection.extend({model:g,sortByNameAsc:function(){this.comparator=function(n,m){if(n.get("type")===m.get("type")){if(n.get("name").toLowerCase()>m.get("name").toLowerCase()){return 1}if(m.get("name").toLowerCase()>n.get("name").toLowerCase()){return -1}return 0}else{if(n.get("type")==="folder"){return -1}else{return 1}}};this.sort();return this},sortByNameDesc:function(){this.comparator=function(n,m){if(n.get("type")===m.get("type")){if(n.get("name").toLowerCase()>m.get("name").toLowerCase()){return -1}if(m.get("name").toLowerCase()>n.get("name").toLowerCase()){return 1}return 0}else{if(n.get("type")==="folder"){return -1}else{return 1}}};this.sort();return this}});var e=Backbone.Model.extend({defaults:{folder:new c(),urlRoot:(window.galaxy_config?galaxy_config.root:"/")+"api/folders/",id:"unknown"},parse:function(m){this.get("folder").reset(m.folder_contents);return m}});var b=Backbone.Model.extend({urlRoot:(window.galaxy_config?galaxy_config.root:"/")+"api/histories/"});var d=Backbone.Collection.extend({urlRoot:(window.galaxy_config?galaxy_config.root:"/")+"api/histories/",initialize:function(m){this.id=m.id},url:function(){return this.urlRoot+this.id+"/contents"},model:b});var h=Backbone.Model.extend({urlRoot:(window.galaxy_config?galaxy_config.root:"/")+"api/histories/"});var k=Backbone.Collection.extend({url:(window.galaxy_config?galaxy_config.root:"/")+"api/histories",model:h});var j=Backbone.Model.extend({urlRoot:(window.galaxy_config?galaxy_config.root:"/")+"api/remote_files"});return{Library:f,FolderAsModel:a,Libraries:i,Item:g,Ldda:l,Folder:c,FolderContainer:e,HistoryItem:b,HistoryContents:d,GalaxyHistory:h,GalaxyHistories:k,Jstree:j}});