DG MS; only fetch contacts when focused in on Publisher.input(); limit autocomplete; added uma back; fixed jasmine tests.
This commit is contained in:
parent
fa1ee731af
commit
a3d596a853
6 changed files with 13 additions and 5 deletions
|
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 67 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
|
@ -1,11 +1,10 @@
|
|||
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);
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue