Skip to content
Snippets Groups Projects
Commit 6bb644f0 authored by Jonne Haß's avatar Jonne Haß
Browse files

Sort tag followings alphabetically, not in reverse, fixes #3986

parent 5d46baf3
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
* Move custom splash page logic into the controller [#3991](https://github.com/diaspora/diaspora/issues/3991) * Move custom splash page logic into the controller [#3991](https://github.com/diaspora/diaspora/issues/3991)
* Fixed removing images from publisher on the profile and tags pages. [#3995](https://github.com/diaspora/diaspora/pull/3995) * Fixed removing images from publisher on the profile and tags pages. [#3995](https://github.com/diaspora/diaspora/pull/3995)
* Wrap text if too long in mobile notifications. [#3990](https://github.com/diaspora/diaspora/pull/3990) * Wrap text if too long in mobile notifications. [#3990](https://github.com/diaspora/diaspora/pull/3990)
* Sort tag followings alphabetically, not in reverse [#3986](https://github.com/diaspora/diaspora/issues/3986)
# 0.0.3.0 # 0.0.3.0
......
app.collections.TagFollowings = Backbone.Collection.extend({ app.collections.TagFollowings = Backbone.Collection.extend({
model: app.models.TagFollowing, model: app.models.TagFollowing,
url : "/tag_followings", url : "/tag_followings",
comparator: function(first_tf, second_tf) {
return first_tf.get("name") < second_tf.get("name");
},
create : function(model) { create : function(model) {
var name = model.name || model.get("name"); var name = model.name || model.get("name");
......
...@@ -73,7 +73,7 @@ app.Router = Backbone.Router.extend({ ...@@ -73,7 +73,7 @@ app.Router = Backbone.Router.extend({
$("#tags_list").replaceWith(followedTagsView.render().el); $("#tags_list").replaceWith(followedTagsView.render().el);
followedTagsView.setupAutoSuggest(); followedTagsView.setupAutoSuggest();
app.tagFollowings.add(preloads.tagFollowings); app.tagFollowings.reset(preloads.tagFollowings);
if(name) { if(name) {
var followedTagsAction = new app.views.TagFollowingAction( var followedTagsAction = new app.views.TagFollowingAction(
......
...@@ -14,7 +14,8 @@ app.views.TagFollowingList = app.views.Base.extend({ ...@@ -14,7 +14,8 @@ app.views.TagFollowingList = app.views.Base.extend({
}, },
initialize : function(){ initialize : function(){
this.collection.bind("add", this.appendTagFollowing, this); this.collection.on("add", this.appendTagFollowing, this);
this.collection.on("reset", this.postRenderTemplate, this);
}, },
postRenderTemplate : function() { postRenderTemplate : function() {
...@@ -72,4 +73,4 @@ app.views.TagFollowingList = app.views.Base.extend({ ...@@ -72,4 +73,4 @@ app.views.TagFollowingList = app.views.Base.extend({
}).render().el); }).render().el);
} }
}); });
\ No newline at end of file
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
<form accept-charset="UTF-8" action="/tag_followings" id="new_tag_following" method="post"> <form accept-charset="UTF-8" action="/tag_followings" id="new_tag_following" method="post">
<input class="tag_input" type="text" name="name" placeholder="{{t "stream.followed_tag.add_a_tag"}}" /> <input class="tag_input" type="text" name="name" placeholder="{{t "stream.followed_tag.add_a_tag"}}" />
</form> </form>
</li> </li>
\ No newline at end of file
...@@ -3,6 +3,14 @@ describe("app.collections.TagFollowings", function(){ ...@@ -3,6 +3,14 @@ describe("app.collections.TagFollowings", function(){
this.collection = new app.collections.TagFollowings(); this.collection = new app.collections.TagFollowings();
}) })
describe("comparator", function() {
it("should compare in reverse order", function() {
var a = new app.models.TagFollowing({name: "aaa"}),
b = new app.models.TagFollowing({name: "zzz"})
expect(this.collection.comparator(a, b)).toBe(true)
})
})
describe("create", function(){ describe("create", function(){
it("should not allow duplicates", function(){ it("should not allow duplicates", function(){
this.collection.create({"name":"name"}) this.collection.create({"name":"name"})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment