Client-side aspect dropdown for the people/:guid/contacts page

This commit is contained in:
cmrd Senya 2016-07-21 15:44:56 +00:00
parent d7fd735ee0
commit e7d8de298b
No known key found for this signature in database
GPG key ID: 5FCC5BA680E67BFE
4 changed files with 13 additions and 8 deletions

View file

@ -40,6 +40,8 @@ app.pages.Profile = app.views.Base.extend({
app.events.on("person:unblock:"+id, this.reload, this);
app.events.on("aspect:create", this.reload, this);
app.events.on("aspect_membership:update", this.reload, this);
app.router.renderAspectMembershipDropdowns(this.$el);
},
_populateModel: function(opts) {

View file

@ -169,7 +169,7 @@ app.Router = Backbone.Router.extend({
},
profile: function() {
this._loadAspects();
this._loadRelationshipsPreloads();
this.renderPage(function() {
return new app.pages.Profile({
el: $("body > #profile_container")
@ -179,7 +179,7 @@ app.Router = Backbone.Router.extend({
pageWithAspectMembershipDropdowns: function() {
this._loadRelationshipsPreloads();
this._renderAspectMembershipDropdowns();
this.renderAspectMembershipDropdowns($(document));
},
_loadAspects: function() {
@ -195,8 +195,8 @@ app.Router = Backbone.Router.extend({
this._loadAspects();
},
_renderAspectMembershipDropdowns: function() {
$(".aspect_membership_dropdown.placeholder").each(function() {
renderAspectMembershipDropdowns: function($context) {
$context.find(".aspect_membership_dropdown.placeholder").each(function() {
var personId = $(this).data("personId");
var view = new app.views.AspectMembership({person: app.contacts.findWhere({"person_id": personId}).person});
$(this).html(view.render().$el);

View file

@ -25,8 +25,9 @@ Feature: show contacts
Then I should see "Contacts" within "#profile-horizontal-bar"
When I press the first "#contacts_link"
And I press the first "a" within "#people_stream .media-body"
Then I should see "Bob Jones"
Then I should see "Bob Jones" within "#people_stream .media-body"
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
When I am on "bob@bob.bob"'s page

View file

@ -118,9 +118,11 @@ 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
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
with_scope(within_selector) do
toggle_aspect_via_ui(aspect_name)
end
end
When /^I post a status with the text "([^\"]*)"$/ do |text|
@me.post(:status_message, :text => text, :public => true, :to => 'all')