Notifications and search page frontend updates
Updates introduce usage of client-side aspect dropdown rendering
This commit is contained in:
parent
94ce383498
commit
71ecd7b866
2 changed files with 26 additions and 4 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue