Skip to content
Extraits de code Groupes Projets
Non vérifiée Valider 09aff306 rédigé par Steffen van Bergerem's avatar Steffen van Bergerem
Parcourir les fichiers

Fix hovercards on profile edit page

parent 020f8c51
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -47,6 +47,7 @@ var app = { ...@@ -47,6 +47,7 @@ var app = {
this.setupDummyPreloads(); this.setupDummyPreloads();
this.setupUser(); this.setupUser();
this.setupAspects();
this.setupHeader(); this.setupHeader();
this.setupBackboneLinks(); this.setupBackboneLinks();
this.setupGlobalViews(); this.setupGlobalViews();
...@@ -83,6 +84,10 @@ var app = { ...@@ -83,6 +84,10 @@ var app = {
app.currentUser = app.user(window.gon.user) || new app.models.User(); 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() { setupHeader: function() {
if(app.currentUser.authenticated()) { if(app.currentUser.authenticated()) {
app.header = new app.views.Header(); app.header = new app.views.Header();
......
...@@ -62,7 +62,7 @@ app.Router = Backbone.Router.extend({ ...@@ -62,7 +62,7 @@ app.Router = Backbone.Router.extend({
contacts: function() { contacts: function() {
app.aspect = new app.models.Aspect(gon.preloads.aspect); app.aspect = new app.models.Aspect(gon.preloads.aspect);
this._loadRelationshipsPreloads(); this._loadContacts();
var stream = new app.views.ContactStream({ var stream = new app.views.ContactStream({
collection: app.contacts, collection: app.contacts,
...@@ -73,7 +73,6 @@ app.Router = Backbone.Router.extend({ ...@@ -73,7 +73,6 @@ app.Router = Backbone.Router.extend({
}, },
gettingStarted: function() { gettingStarted: function() {
this._loadAspects();
this.renderPage(function() { this.renderPage(function() {
return new app.pages.GettingStarted({inviter: new app.models.Person(app.parsePreload("inviter"))}); return new app.pages.GettingStarted({inviter: new app.models.Person(app.parsePreload("inviter"))});
}); });
...@@ -107,14 +106,13 @@ app.Router = Backbone.Router.extend({ ...@@ -107,14 +106,13 @@ app.Router = Backbone.Router.extend({
}, },
stream : function() { stream : function() {
this._loadAspects();
app.stream = new app.models.Stream(); app.stream = new app.models.Stream();
app.stream.fetch(); app.stream.fetch();
this._initializeStreamView(); this._initializeStreamView();
}, },
photos : function(guid) { photos : function(guid) {
this._loadRelationshipsPreloads(); this._loadContacts();
this.renderPage(function() { this.renderPage(function() {
return new app.pages.Profile({ return new app.pages.Profile({
person_id: guid, person_id: guid,
...@@ -146,7 +144,6 @@ app.Router = Backbone.Router.extend({ ...@@ -146,7 +144,6 @@ app.Router = Backbone.Router.extend({
}, },
aspects: function() { aspects: function() {
this._loadAspects();
app.aspectSelections = app.aspectSelections || app.aspectSelections = app.aspectSelections ||
new app.collections.AspectSelections(app.currentUser.get("aspects")); new app.collections.AspectSelections(app.currentUser.get("aspects"));
this.aspectsList = this.aspectsList || new app.views.AspectsList({collection: app.aspectSelections}); this.aspectsList = this.aspectsList || new app.views.AspectsList({collection: app.aspectSelections});
...@@ -170,7 +167,7 @@ app.Router = Backbone.Router.extend({ ...@@ -170,7 +167,7 @@ app.Router = Backbone.Router.extend({
}, },
profile: function() { profile: function() {
this._loadRelationshipsPreloads(); this._loadContacts();
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,23 +176,14 @@ app.Router = Backbone.Router.extend({ ...@@ -179,23 +176,14 @@ app.Router = Backbone.Router.extend({
}, },
pageWithAspectMembershipDropdowns: function() { pageWithAspectMembershipDropdowns: function() {
this._loadRelationshipsPreloads(); this._loadContacts();
this.renderAspectMembershipDropdowns($(document)); this.renderAspectMembershipDropdowns($(document));
}, },
_loadAspects: function() {
app.aspects = new app.collections.Aspects(app.currentUser.get("aspects"));
},
_loadContacts: function() { _loadContacts: function() {
app.contacts = new app.collections.Contacts(app.parsePreload("contacts")); app.contacts = new app.collections.Contacts(app.parsePreload("contacts"));
}, },
_loadRelationshipsPreloads: function() {
this._loadContacts();
this._loadAspects();
},
renderAspectMembershipDropdowns: function($context) { renderAspectMembershipDropdowns: function($context) {
$context.find(".aspect_membership_dropdown.placeholder").each(function() { $context.find(".aspect_membership_dropdown.placeholder").each(function() {
var personId = $(this).data("personId"); var personId = $(this).data("personId");
......
...@@ -118,11 +118,24 @@ Feature: Notifications ...@@ -118,11 +118,24 @@ Feature: Notifications
And I add the person to my "Besties" aspect And I add the person to my "Besties" aspect
And I sign out And I sign out
When I sign in as "alice@alice.alice" 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 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 When I press the aspect dropdown
Then the aspect dropdown should be visible 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 Scenario: scrollbar shows up when >5 notifications
Given a user with email "bob@bob.bob" is connected with "alice@alice.alice" Given a user with email "bob@bob.bob" is connected with "alice@alice.alice"
And Alice has 6 posts mentioning Bob And Alice has 6 posts mentioning Bob
......
...@@ -324,7 +324,7 @@ Then(/^I should have a validation error on "(.*?)"$/) do |field_list| ...@@ -324,7 +324,7 @@ Then(/^I should have a validation error on "(.*?)"$/) do |field_list|
check_fields_validation_error field_list check_fields_validation_error field_list
end 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' page.should have_css '.notifications .hovercardable'
first('.notifications .hovercardable').hover first('.notifications .hovercardable').hover
end end
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter