Rename contacts[:count] to contacts_count in gon

This commit is contained in:
cmrd Senya 2016-07-22 23:14:34 +03:00
parent ed7fc10043
commit d8687ccb3a
No known key found for this signature in database
GPG key ID: 5FCC5BA680E67BFE
5 changed files with 8 additions and 14 deletions

View file

@ -24,8 +24,8 @@ app.pages.Profile = app.views.Base.extend({
if(app.hasPreload("photos")){
this.photos = app.parsePreload("photos");
}
if(app.hasPreload("contacts")){
this.contacts = app.parsePreload("contacts");
if (app.hasPreload("contacts_count")) {
this.contacts = app.parsePreload("contacts_count");
}
this.streamCollection = _.has(opts, "streamCollection") ? opts.streamCollection : null;

View file

@ -42,7 +42,7 @@ app.views.ProfileHeader = app.views.Base.extend({
},
_shouldShowContacts: function() {
return (this.contacts && this.contacts.count > 0);
return (this.contacts && this.contacts > 0);
},
showMentionModal: function(){

View file

@ -88,13 +88,13 @@
<a href="{{urlTo 'contacts'}}" id="contacts_link">
<i class="entypo-users"></i>
{{t 'profile.contacts'}}
<div class="badge badge-default">{{contacts.count}}</div>
<div class="badge badge-default">{{contacts}}</div>
</a>
{{else}}
<a href="{{urlTo 'personContacts' guid}}" id="contacts_link">
<i class="entypo-users"></i>
{{t 'profile.contacts'}}
<div class="badge badge-default">{{contacts.count}}</div>
<div class="badge badge-default">{{contacts}}</div>
</a>
{{/if}}
</li>

View file

@ -78,9 +78,7 @@ class PeopleController < ApplicationController
gon.preloads[:photos] = {
count: Photo.visible(current_user, @person).count(:all)
}
gon.preloads[:contacts] = {
count: Contact.contact_contacts_for(current_user, @person).count(:all),
}
gon.preloads[:contacts_count] = Contact.contact_contacts_for(current_user, @person).count(:all)
respond_with @person, layout: "with_header"
end
@ -140,9 +138,7 @@ class PeopleController < ApplicationController
gon.preloads[:photos] = {
count: Photo.visible(current_user, @person).count(:all)
}
gon.preloads[:contacts] = {
count: @contacts_of_contact.count(:all),
}
gon.preloads[:contacts_count] = @contacts_of_contact.count(:all)
@contacts_of_contact = @contacts_of_contact.paginate(page: params[:page], per_page: (params[:limit] || 15))
@hashes = hashes_for_people @contacts_of_contact, @aspects
respond_with @person, layout: "with_header"

View file

@ -30,9 +30,7 @@ class PhotosController < ApplicationController
gon.preloads[:photos] = {
count: Photo.visible(current_user, @person).count(:all)
}
gon.preloads[:contacts] = {
count: Contact.contact_contacts_for(current_user, @person).count(:all),
}
gon.preloads[:contacts_count] = Contact.contact_contacts_for(current_user, @person).count(:all)
render "people/show", layout: "with_header"
end
format.mobile { render "people/show" }