2012-02-10 12:48:14 -08:00
|
|
|
NEWSBLUR.Models.SocialSubscription = Backbone.Model.extend({
|
|
|
|
|
2012-03-14 12:38:59 -07:00
|
|
|
initialize: function() {
|
2012-03-14 17:48:28 -07:00
|
|
|
if (!this.get('page_url')) {
|
|
|
|
this.set('page_url', '/social/page/' + this.get('user_id'));
|
2012-03-14 12:38:59 -07:00
|
|
|
}
|
2012-05-18 16:59:39 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
is_social: function() {
|
|
|
|
return true;
|
2012-03-14 12:38:59 -07:00
|
|
|
}
|
|
|
|
|
2012-02-10 12:48:14 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
NEWSBLUR.Collections.SocialSubscriptions = Backbone.Collection.extend({
|
|
|
|
|
2012-04-24 13:18:08 -07:00
|
|
|
model : NEWSBLUR.Models.SocialSubscription,
|
|
|
|
|
|
|
|
comparator: function(a, b) {
|
|
|
|
var sort_order = NEWSBLUR.reader.model.preference('feed_order');
|
2012-04-25 12:18:26 -07:00
|
|
|
var title_a = a.get('feed_title') || '';
|
|
|
|
var title_b = b.get('feed_title') || '';
|
|
|
|
title_a = title_a.toLowerCase();
|
|
|
|
title_b = title_b.toLowerCase();
|
2012-04-24 13:18:08 -07:00
|
|
|
|
|
|
|
if (sort_order == 'MOSTUSED') {
|
|
|
|
var opens_a = a.get('feed_opens');
|
|
|
|
var opens_b = b.get('feed_opens');
|
|
|
|
if (opens_a > opens_b) return -1;
|
|
|
|
if (opens_a < opens_b) return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// if (!sort_order || sort_order == 'ALPHABETICAL')
|
|
|
|
if (title_a > title_b) return 1;
|
|
|
|
else if (title_a < title_b) return -1;
|
|
|
|
return 0;
|
|
|
|
}
|
2012-02-10 12:48:14 -08:00
|
|
|
|
|
|
|
});
|