MS DG; mentions work in new publisher
This commit is contained in:
parent
fd0065598c
commit
4c46cc4246
8 changed files with 52 additions and 10 deletions
|
|
@ -31,6 +31,7 @@ javascripts:
|
|||
- public/javascripts/vendor/jquery.idle-timer.js
|
||||
- public/javascripts/jquery.infinitescroll-custom.js
|
||||
- public/javascripts/jquery.autocomplete-custom.js
|
||||
- public/javascripts/vendor/jquery.textchange.min.js
|
||||
- public/javascripts/keycodes.js
|
||||
- public/javascripts/fileuploader-custom.js
|
||||
|
||||
|
|
@ -93,7 +94,6 @@ javascripts:
|
|||
- public/javascripts/friend-finder.js
|
||||
home:
|
||||
- public/javascripts/publisher.js
|
||||
- public/javascripts/vendor/jquery.textchange.min.js
|
||||
- public/javascripts/aspect-edit-pane.js
|
||||
- public/javascripts/fileuploader-custom.js
|
||||
people:
|
||||
|
|
|
|||
|
|
@ -6,6 +6,17 @@ When /^I write "([^"]*)"$/ do |text|
|
|||
fill_in :text, :with => text
|
||||
end
|
||||
|
||||
Then /I mention "([^"]*)"$/ do |text|
|
||||
fill_in_autocomplete('textarea.text', '@a')
|
||||
sleep(5)
|
||||
find("li.active").click
|
||||
end
|
||||
|
||||
def fill_in_autocomplete(selector, value)
|
||||
page.execute_script %Q{$('#{selector}').val('#{value}').keyup()}
|
||||
end
|
||||
|
||||
|
||||
def aspects_dropdown
|
||||
find(".dropdown-toggle")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -20,3 +20,12 @@ Feature: Creating a new post
|
|||
When I go to "/stream"
|
||||
Then I should see "This is super skrunkle" as the first post in my stream
|
||||
Then "This is super skrunkle" should be a limited post in my stream
|
||||
|
||||
Scenario: Mention a contact
|
||||
Given a user named "Alice Smith" with email "alice@alice.alice"
|
||||
And a user with email "bob@bob.bob" is connected with "alice@alice.alice"
|
||||
And I mention "alice@alice.alice"
|
||||
And I press "Share"
|
||||
And I go to "/stream"
|
||||
Then I follow "Alice Smith"
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ app.forms.Post = app.forms.Base.extend({
|
|||
},
|
||||
|
||||
formAttrs : {
|
||||
"textarea.text" : "text",
|
||||
"textarea#text_with_markup" : "text",
|
||||
"input.aspect_ids" : "aspect_ids",
|
||||
'input.service:checked' : 'services'
|
||||
},
|
||||
|
|
@ -15,5 +15,22 @@ app.forms.Post = app.forms.Base.extend({
|
|||
initialize : function() {
|
||||
this.aspectsDropdown = new app.views.AspectsDropdown();
|
||||
this.servicesSelector = new app.views.ServicesSelector();
|
||||
},
|
||||
|
||||
postRenderTemplate : function() {
|
||||
this.prepAndBindMentions()
|
||||
},
|
||||
|
||||
prepAndBindMentions : function(){
|
||||
Mentions.initialize(this.$("textarea.text"));
|
||||
Mentions.fetchContacts();
|
||||
|
||||
this.$("textarea.text").bind("textchange", $.proxy(this.updateTextWithMarkup, this))
|
||||
},
|
||||
|
||||
updateTextWithMarkup : function() {
|
||||
this.$("form textarea.text").mentionsInput('val', function(markup){
|
||||
$('#text_with_markup').val(markup);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -17,6 +17,7 @@ app.models.StatusMessage = app.models.Post.extend({
|
|||
}
|
||||
|
||||
function mungeServices (values) {
|
||||
if(!values) { return; }
|
||||
return values.length > 1 ? values : [values]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,16 @@
|
|||
<div class='row'>
|
||||
<div class='span12'>
|
||||
<form class="new-post well">
|
||||
<label>text<textarea class="text"/></label>
|
||||
<div class="service_selector"/>
|
||||
<div class="aspect_selector"/>
|
||||
<label>
|
||||
text
|
||||
<textarea class="text span8"/>
|
||||
<textarea id="text_with_markup" style="display:none;"/>
|
||||
</label>
|
||||
<div class="service_selector"></div>
|
||||
<div class="aspect_selector"></div>
|
||||
<br/>
|
||||
|
||||
<input type="submit" class="btn-primary" value="Share"></input>
|
||||
<input type="submit" class="btn-primary" value="Share" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
var Mentions = {
|
||||
initialize: function(mentionsInput) {
|
||||
mentionsInput.mentionsInput(Mentions.options);
|
||||
return mentionsInput.mentionsInput(Mentions.options);
|
||||
},
|
||||
|
||||
fetchContacts : function(){
|
||||
Mentions.contacts || $.getJSON($(".selected_contacts_link").attr("href"), function(data) {
|
||||
Mentions.contacts || $.getJSON("/contacts", function(data) {
|
||||
Mentions.contacts = data;
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ describe("app.forms.Post", function(){
|
|||
|
||||
describe("submitting a valid form", function(){
|
||||
beforeEach(function(){
|
||||
this.view.$("form .text").val("Oh My")
|
||||
this.view.$("form #text_with_markup").val("Oh My")
|
||||
this.view.$("form .aspect_ids").val("public")
|
||||
|
||||
/* appending checkboxes */
|
||||
|
|
|
|||
Loading…
Reference in a new issue