Fix hovercards on profile edit page

This commit is contained in:
Steffen van Bergerem 2016-08-09 00:55:44 +02:00
parent 020f8c51b4
commit 09aff30648
No known key found for this signature in database
GPG key ID: 2F08F75F9525C7E0
4 changed files with 24 additions and 18 deletions

View file

@ -47,6 +47,7 @@ var app = {
this.setupDummyPreloads();
this.setupUser();
this.setupAspects();
this.setupHeader();
this.setupBackboneLinks();
this.setupGlobalViews();
@ -83,6 +84,10 @@ var app = {
app.currentUser = app.user(window.gon.user) || new app.models.User();
},
setupAspects: function() {
app.aspects = new app.collections.Aspects(app.currentUser.get("aspects"));
},
setupHeader: function() {
if(app.currentUser.authenticated()) {
app.header = new app.views.Header();

View file

@ -62,7 +62,7 @@ app.Router = Backbone.Router.extend({
contacts: function() {
app.aspect = new app.models.Aspect(gon.preloads.aspect);
this._loadRelationshipsPreloads();
this._loadContacts();
var stream = new app.views.ContactStream({
collection: app.contacts,
@ -73,7 +73,6 @@ app.Router = Backbone.Router.extend({
},
gettingStarted: function() {
this._loadAspects();
this.renderPage(function() {
return new app.pages.GettingStarted({inviter: new app.models.Person(app.parsePreload("inviter"))});
});
@ -107,14 +106,13 @@ app.Router = Backbone.Router.extend({
},
stream : function() {
this._loadAspects();
app.stream = new app.models.Stream();
app.stream.fetch();
this._initializeStreamView();
},
photos : function(guid) {
this._loadRelationshipsPreloads();
this._loadContacts();
this.renderPage(function() {
return new app.pages.Profile({
person_id: guid,
@ -146,7 +144,6 @@ app.Router = Backbone.Router.extend({
},
aspects: function() {
this._loadAspects();
app.aspectSelections = app.aspectSelections ||
new app.collections.AspectSelections(app.currentUser.get("aspects"));
this.aspectsList = this.aspectsList || new app.views.AspectsList({collection: app.aspectSelections});
@ -170,7 +167,7 @@ app.Router = Backbone.Router.extend({
},
profile: function() {
this._loadRelationshipsPreloads();
this._loadContacts();
this.renderPage(function() {
return new app.pages.Profile({
el: $("body > #profile_container")
@ -179,23 +176,14 @@ app.Router = Backbone.Router.extend({
},
pageWithAspectMembershipDropdowns: function() {
this._loadRelationshipsPreloads();
this._loadContacts();
this.renderAspectMembershipDropdowns($(document));
},
_loadAspects: function() {
app.aspects = new app.collections.Aspects(app.currentUser.get("aspects"));
},
_loadContacts: function() {
app.contacts = new app.collections.Contacts(app.parsePreload("contacts"));
},
_loadRelationshipsPreloads: function() {
this._loadContacts();
this._loadAspects();
},
renderAspectMembershipDropdowns: function($context) {
$context.find(".aspect_membership_dropdown.placeholder").each(function() {
var personId = $(this).data("personId");

View file

@ -118,11 +118,24 @@ Feature: Notifications
And I add the person to my "Besties" aspect
And I sign out
When I sign in as "alice@alice.alice"
And I go to the edit profile page
And I follow "Notifications" in the header
And I active the first hovercard after loading the notifications page
And I activate the first hovercard after loading the notifications page
When I press the aspect dropdown
Then the aspect dropdown should be visible
Scenario: show hovercard in notification dropdown
When I sign in as "bob@bob.bob"
And I am on "alice@alice.alice"'s page
And I add the person to my "Besties" aspect
And I sign out
When I sign in as "alice@alice.alice"
And I follow "Notifications" in the header
Then the notification dropdown should be visible
When I activate the first hovercard after loading the notifications page
And I press the aspect dropdown
Then the aspect dropdown should be visible
Scenario: scrollbar shows up when >5 notifications
Given a user with email "bob@bob.bob" is connected with "alice@alice.alice"
And Alice has 6 posts mentioning Bob

View file

@ -324,7 +324,7 @@ Then(/^I should have a validation error on "(.*?)"$/) do |field_list|
check_fields_validation_error field_list
end
And /^I active the first hovercard after loading the notifications page$/ do
And /^I activate the first hovercard after loading the notifications page$/ do
page.should have_css '.notifications .hovercardable'
first('.notifications .hovercardable').hover
end