Client-side aspect dropdown for the people/:guid/contacts page
This commit is contained in:
parent
d7fd735ee0
commit
e7d8de298b
4 changed files with 13 additions and 8 deletions
|
|
@ -40,6 +40,8 @@ app.pages.Profile = app.views.Base.extend({
|
||||||
app.events.on("person:unblock:"+id, this.reload, this);
|
app.events.on("person:unblock:"+id, this.reload, this);
|
||||||
app.events.on("aspect:create", this.reload, this);
|
app.events.on("aspect:create", this.reload, this);
|
||||||
app.events.on("aspect_membership:update", this.reload, this);
|
app.events.on("aspect_membership:update", this.reload, this);
|
||||||
|
|
||||||
|
app.router.renderAspectMembershipDropdowns(this.$el);
|
||||||
},
|
},
|
||||||
|
|
||||||
_populateModel: function(opts) {
|
_populateModel: function(opts) {
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@ app.Router = Backbone.Router.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
profile: function() {
|
profile: function() {
|
||||||
this._loadAspects();
|
this._loadRelationshipsPreloads();
|
||||||
this.renderPage(function() {
|
this.renderPage(function() {
|
||||||
return new app.pages.Profile({
|
return new app.pages.Profile({
|
||||||
el: $("body > #profile_container")
|
el: $("body > #profile_container")
|
||||||
|
|
@ -179,7 +179,7 @@ app.Router = Backbone.Router.extend({
|
||||||
|
|
||||||
pageWithAspectMembershipDropdowns: function() {
|
pageWithAspectMembershipDropdowns: function() {
|
||||||
this._loadRelationshipsPreloads();
|
this._loadRelationshipsPreloads();
|
||||||
this._renderAspectMembershipDropdowns();
|
this.renderAspectMembershipDropdowns($(document));
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadAspects: function() {
|
_loadAspects: function() {
|
||||||
|
|
@ -195,8 +195,8 @@ app.Router = Backbone.Router.extend({
|
||||||
this._loadAspects();
|
this._loadAspects();
|
||||||
},
|
},
|
||||||
|
|
||||||
_renderAspectMembershipDropdowns: function() {
|
renderAspectMembershipDropdowns: function($context) {
|
||||||
$(".aspect_membership_dropdown.placeholder").each(function() {
|
$context.find(".aspect_membership_dropdown.placeholder").each(function() {
|
||||||
var personId = $(this).data("personId");
|
var personId = $(this).data("personId");
|
||||||
var view = new app.views.AspectMembership({person: app.contacts.findWhere({"person_id": personId}).person});
|
var view = new app.views.AspectMembership({person: app.contacts.findWhere({"person_id": personId}).person});
|
||||||
$(this).html(view.render().$el);
|
$(this).html(view.render().$el);
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,9 @@ Feature: show contacts
|
||||||
Then I should see "Contacts" within "#profile-horizontal-bar"
|
Then I should see "Contacts" within "#profile-horizontal-bar"
|
||||||
|
|
||||||
When I press the first "#contacts_link"
|
When I press the first "#contacts_link"
|
||||||
And I press the first "a" within "#people_stream .media-body"
|
Then I should see "Bob Jones" within "#people_stream .media-body"
|
||||||
Then I should see "Bob Jones"
|
When I add the person to my "Besties" aspect within "#people_stream"
|
||||||
|
Then I should see a flash message containing "You have started sharing with Bob Jones!"
|
||||||
|
|
||||||
Scenario: don't see contacts of an invisible aspect list
|
Scenario: don't see contacts of an invisible aspect list
|
||||||
When I am on "bob@bob.bob"'s page
|
When I am on "bob@bob.bob"'s page
|
||||||
|
|
|
||||||
|
|
@ -118,8 +118,10 @@ Then /^I should have (\d) contacts? in "([^"]*)"$/ do |n_contacts, aspect_name|
|
||||||
@me.aspects.where(:name => aspect_name).first.contacts.count.should == n_contacts.to_i
|
@me.aspects.where(:name => aspect_name).first.contacts.count.should == n_contacts.to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
When /^I (?:add|remove) the person (?:to|from) my "([^\"]*)" aspect$/ do |aspect_name|
|
When /^I (?:add|remove) the person (?:to|from) my "([^\"]*)" aspect(?: within "([^"]*)")?$/ do |aspect_name, within_selector| # rubocop:disable Metrics/LineLength
|
||||||
toggle_aspect_via_ui(aspect_name)
|
with_scope(within_selector) do
|
||||||
|
toggle_aspect_via_ui(aspect_name)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
When /^I post a status with the text "([^\"]*)"$/ do |text|
|
When /^I post a status with the text "([^\"]*)"$/ do |text|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue