Commit a3d596a8 authored by danielgrippi's avatar danielgrippi

DG MS; only fetch contacts when focused in on Publisher.input(); limit...

DG MS; only fetch contacts when focused in on Publisher.input(); limit autocomplete; added uma back; fixed jasmine tests.
parent fa1ee731
var Mentions = {
initialize: function(mentionsInput) {
mentionsInput.mentionsInput(Mentions.options);
Mentions.fetchContacts();
},
fetchContacts : function(){
$.getJSON($(".selected_contacts_link").attr("href"), function(data) {
Mentions.contacts || $.getJSON($(".selected_contacts_link").attr("href"), function(data) {
Mentions.contacts = data;
});
},
......@@ -16,7 +15,7 @@ var Mentions = {
onDataRequest: function(mode, query, callback) {
var filteredResults = _.filter(Mentions.contacts, function(item) { return item.name.toLowerCase().indexOf(query.toLowerCase()) > -1 });
callback.call(this, filteredResults);
callback.call(this, filteredResults.slice(0,5));
},
templates: {
......
......@@ -118,6 +118,7 @@ var Publisher = {
}
}
},
createCounter: function(service){
var counter = $("#publisher .counter");
counter.remove();
......@@ -205,6 +206,10 @@ var Publisher = {
Mentions.initialize(Publisher.input());
Publisher.input().bind("focus", function(){
Mentions.fetchContacts();
})
if(Publisher.hiddenInput().val() === "") {
Publisher.hiddenInput().val(Publisher.input().val());
}
......
......@@ -985,6 +985,9 @@ label:not(.bootstrapped)
:display inline
:position relative
:top -2px
#status_message_fake_text
:min-height 20px
.content_creation
......@@ -1033,6 +1036,7 @@ label:not(.bootstrapped)
#publisher_textarea_wrapper
#hide_publisher
@include opacity(0.3)
:z-index 5
:padding 3px
:position absolute
:right 6px
......
......@@ -11,7 +11,7 @@ describe("app.views.Comment", function(){
})
it("doesn't have a delete link if the author is not the current user", function(){
loginAs(_.extend(this.comment.get("author"), {diaspora_id : "notbob@bob.com"})
loginAs(factory.author({diaspora_id : "notbob@bob.com"}))
expect(this.view.render().$('.delete').length).toBe(0)
})
......@@ -28,7 +28,7 @@ describe("app.views.Comment", function(){
})
it("returns false if the author diaspora_id != the current user's diaspora_id", function(){
loginAs(_.extend(this.comment.get("author"), {diaspora_id : "notbob@bob.com"})
loginAs(factory.author({diaspora_id : "notbob@bob.com"}))
expect(this.view.ownComment()).toBe(false);
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment