small fixes in backbone
This commit is contained in:
parent
bc593fe614
commit
a90eb90822
2 changed files with 6 additions and 4 deletions
|
@ -30,7 +30,7 @@ Metamaps.Backbone.Map = Backbone.Model.extend({
|
|||
name: this.get('name'),
|
||||
desc: this.get('desc'),
|
||||
username: this.getUser().get('name'),
|
||||
mkPermission: this.get("permission").substring(0, 2),
|
||||
mkPermission: this.get("permission") ? this.get("permission").substring(0, 2) : "commons",
|
||||
editPermission: this.authorizeToEdit(Metamaps.Active.Mapper) ? 'canEdit' : 'cannotEdit',
|
||||
topicCount: this.getTopics().length,
|
||||
synapseCount: this.getSynapses().length,
|
||||
|
@ -52,8 +52,8 @@ Metamaps.Backbone.MapsCollection = Backbone.Collection.extend({
|
|||
a = a.get(this.sortBy);
|
||||
b = b.get(this.sortBy);
|
||||
if (this.sortBy === 'name') {
|
||||
a = a.toLowerCase();
|
||||
b = b.toLowerCase();
|
||||
a = a ? a.toLowerCase() : "";
|
||||
b = b ? b.toLowerCase() : "";
|
||||
}
|
||||
return a > b ? 1 : a < b ? -1 : 0;
|
||||
},
|
||||
|
|
|
@ -46,6 +46,9 @@ Metamaps.Views.init = function () {
|
|||
this.listenTo(this.collection, 'errorOnFetch', this.handleError);
|
||||
},
|
||||
render: function () {
|
||||
|
||||
Metamaps.Loading.loader.hide();
|
||||
|
||||
var that = this;
|
||||
this.$el.empty();
|
||||
|
||||
|
@ -56,7 +59,6 @@ Metamaps.Views.init = function () {
|
|||
});
|
||||
},
|
||||
handleSuccess: function () {
|
||||
Metamaps.Loading.loader.hide();
|
||||
this.render();
|
||||
},
|
||||
handleError: function () {
|
||||
|
|
Loading…
Reference in a new issue