Skip to content
Extraits de code Groupes Projets
Non vérifiée Valider 71ecd7b8 rédigé par cmrd Senya's avatar cmrd Senya
Parcourir les fichiers

Notifications and search page frontend updates

Updates introduce usage of client-side aspect dropdown rendering
parent 94ce3834
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -28,7 +28,8 @@ app.Router = Backbone.Router.extend({
"tags/:name": "followed_tags",
"people/:id/photos": "photos",
"people/:id/contacts": "profile",
"people": "_loadAspects",
"people": "pageWithAspectMembershipDropdowns",
"notifications": "pageWithAspectMembershipDropdowns",
"people/:id": "profile",
"u/:name": "profile"
......@@ -61,8 +62,7 @@ app.Router = Backbone.Router.extend({
contacts: function() {
app.aspect = new app.models.Aspect(gon.preloads.aspect);
app.contacts = new app.collections.Contacts(app.parsePreload("contacts"));
this._loadAspects();
this._loadRelationshipsPreloads();
var stream = new app.views.ContactStream({
collection: app.contacts,
......@@ -177,10 +177,32 @@ app.Router = Backbone.Router.extend({
});
},
pageWithAspectMembershipDropdowns: function() {
this._loadRelationshipsPreloads();
this._renderAspectMembershipDropdowns();
},
_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() {
$(".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);
});
},
_hideInactiveStreamLists: function() {
if(this.aspectsList && Backbone.history.fragment !== "aspects") {
this.aspectsList.hideAspectsList();
......
......@@ -37,7 +37,7 @@ class ContactsController < ApplicationController
@contacts = contacts_by_type(type)
@contacts_size = @contacts.length
gon.preloads[:contacts] = @contacts.map{ |c| ContactPresenter.new(c, current_user).full_hash_with_person }
gon.preloads[:contacts] = @contacts.map {|c| ContactPresenter.new(c, current_user).full_hash_with_person }
end
def contacts_by_type(type)
......
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