Rename contacts[:count] to contacts_count in gon
This commit is contained in:
parent
ed7fc10043
commit
d8687ccb3a
5 changed files with 8 additions and 14 deletions
|
|
@ -24,8 +24,8 @@ app.pages.Profile = app.views.Base.extend({
|
||||||
if(app.hasPreload("photos")){
|
if(app.hasPreload("photos")){
|
||||||
this.photos = app.parsePreload("photos");
|
this.photos = app.parsePreload("photos");
|
||||||
}
|
}
|
||||||
if(app.hasPreload("contacts")){
|
if (app.hasPreload("contacts_count")) {
|
||||||
this.contacts = app.parsePreload("contacts");
|
this.contacts = app.parsePreload("contacts_count");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.streamCollection = _.has(opts, "streamCollection") ? opts.streamCollection : null;
|
this.streamCollection = _.has(opts, "streamCollection") ? opts.streamCollection : null;
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ app.views.ProfileHeader = app.views.Base.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_shouldShowContacts: function() {
|
_shouldShowContacts: function() {
|
||||||
return (this.contacts && this.contacts.count > 0);
|
return (this.contacts && this.contacts > 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
showMentionModal: function(){
|
showMentionModal: function(){
|
||||||
|
|
|
||||||
|
|
@ -88,13 +88,13 @@
|
||||||
<a href="{{urlTo 'contacts'}}" id="contacts_link">
|
<a href="{{urlTo 'contacts'}}" id="contacts_link">
|
||||||
<i class="entypo-users"></i>
|
<i class="entypo-users"></i>
|
||||||
{{t 'profile.contacts'}}
|
{{t 'profile.contacts'}}
|
||||||
<div class="badge badge-default">{{contacts.count}}</div>
|
<div class="badge badge-default">{{contacts}}</div>
|
||||||
</a>
|
</a>
|
||||||
{{else}}
|
{{else}}
|
||||||
<a href="{{urlTo 'personContacts' guid}}" id="contacts_link">
|
<a href="{{urlTo 'personContacts' guid}}" id="contacts_link">
|
||||||
<i class="entypo-users"></i>
|
<i class="entypo-users"></i>
|
||||||
{{t 'profile.contacts'}}
|
{{t 'profile.contacts'}}
|
||||||
<div class="badge badge-default">{{contacts.count}}</div>
|
<div class="badge badge-default">{{contacts}}</div>
|
||||||
</a>
|
</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</li>
|
</li>
|
||||||
|
|
|
||||||
|
|
@ -78,9 +78,7 @@ class PeopleController < ApplicationController
|
||||||
gon.preloads[:photos] = {
|
gon.preloads[:photos] = {
|
||||||
count: Photo.visible(current_user, @person).count(:all)
|
count: Photo.visible(current_user, @person).count(:all)
|
||||||
}
|
}
|
||||||
gon.preloads[:contacts] = {
|
gon.preloads[:contacts_count] = Contact.contact_contacts_for(current_user, @person).count(:all)
|
||||||
count: Contact.contact_contacts_for(current_user, @person).count(:all),
|
|
||||||
}
|
|
||||||
respond_with @person, layout: "with_header"
|
respond_with @person, layout: "with_header"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -140,9 +138,7 @@ class PeopleController < ApplicationController
|
||||||
gon.preloads[:photos] = {
|
gon.preloads[:photos] = {
|
||||||
count: Photo.visible(current_user, @person).count(:all)
|
count: Photo.visible(current_user, @person).count(:all)
|
||||||
}
|
}
|
||||||
gon.preloads[:contacts] = {
|
gon.preloads[:contacts_count] = @contacts_of_contact.count(:all)
|
||||||
count: @contacts_of_contact.count(:all),
|
|
||||||
}
|
|
||||||
@contacts_of_contact = @contacts_of_contact.paginate(page: params[:page], per_page: (params[:limit] || 15))
|
@contacts_of_contact = @contacts_of_contact.paginate(page: params[:page], per_page: (params[:limit] || 15))
|
||||||
@hashes = hashes_for_people @contacts_of_contact, @aspects
|
@hashes = hashes_for_people @contacts_of_contact, @aspects
|
||||||
respond_with @person, layout: "with_header"
|
respond_with @person, layout: "with_header"
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,7 @@ class PhotosController < ApplicationController
|
||||||
gon.preloads[:photos] = {
|
gon.preloads[:photos] = {
|
||||||
count: Photo.visible(current_user, @person).count(:all)
|
count: Photo.visible(current_user, @person).count(:all)
|
||||||
}
|
}
|
||||||
gon.preloads[:contacts] = {
|
gon.preloads[:contacts_count] = Contact.contact_contacts_for(current_user, @person).count(:all)
|
||||||
count: Contact.contact_contacts_for(current_user, @person).count(:all),
|
|
||||||
}
|
|
||||||
render "people/show", layout: "with_header"
|
render "people/show", layout: "with_header"
|
||||||
end
|
end
|
||||||
format.mobile { render "people/show" }
|
format.mobile { render "people/show" }
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue