Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit cc00d77

Browse files
committed
Merge pull request #1637 from mariodian/fix_search_bar
Fix search bar message
2 parents 6751351 + 625edb4 commit cc00d77

File tree

3 files changed

+31
-5
lines changed

3 files changed

+31
-5
lines changed

js/languages/en-US.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@
8989
"SearchForItemsPlaceholder": "Type #games, #shoes or any #tag...",
9090
"SearchForPagesPlaceholder": "Search by name or keyword",
9191
"SearchFeedPlaceholder": "Type a keyword...",
92-
"SearchForFollowersPlaceholder": "Search for a name in your currently loaded followers (scroll to load more).",
92+
"SearchForFollowersPlaceholder": "Search for a name in your currently loaded followers.",
93+
"SearchForFollowersPlaceholderMore": "Search for a name in your currently loaded followers (scroll to load more).",
94+
"SearchForFollowingPlaceholder": "Search for a name in your currently loaded pages.",
95+
"SearchForFollowingPlaceholderMore": "Search for a name in your currently loaded pages (scroll to load more).",
9396
"SearchForUsersPlaceholder": "Type a name...",
9497
"SearchOnUserStorePlaceholder": "Type a title...",
9598
"EstDeliveryDomesticPlaceholder": "3-5 Business Days",

js/templates/userPage.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ <h1 class="page-userNameLarge floatLeft fancy-heading fontSize20 colorWhiteForce
468468
<div class="flexRow height54">
469469
<!--<div class="txtFieldWrapper searchWrapper searchWrapperWithPill borderBottom custCol-border">-->
470470
<div class="txtFieldWrapper searchWrapper borderBottom custCol-border">
471-
<input type="text" id="inputFollowing" class="txtField txtField-bar search" placeholder="<%= polyglot.t('SearchForFollowersPlaceholder') %>" />
471+
<input type="text" id="inputFollowing" class="txtField txtField-bar search" placeholder="<%= polyglot.t('SearchForFollowingPlaceholder') %>" />
472472
</div>
473473
<!--
474474
<div class="selectPill pull-up43">

js/views/userPageVw.js

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,22 @@ UserPageVw = pageVw.extend({
604604
}
605605
}
606606
},
607+
608+
setFollowingPlaceholder: function(totalLength, currentLength) {
609+
if (totalLength > currentLength) {
610+
this.$('#inputFollowing').attr('placeholder', window.polyglot.t('SearchForFollowingPlaceholderMore'));
611+
} else {
612+
this.$('#inputFollowing').attr('placeholder', window.polyglot.t('SearchForFollowingPlaceholder'));
613+
}
614+
},
615+
616+
setFollowersPlaceholder: function(totalLength, currentLength) {
617+
if (totalLength > currentLength) {
618+
this.$('#inputFollowers').attr('placeholder', window.polyglot.t('SearchForFollowersPlaceholderMore'));
619+
} else {
620+
this.$('#inputFollowers').attr('placeholder', window.polyglot.t('SearchForFollowersPlaceholder'));
621+
}
622+
},
607623

608624
categoryChanged: function() {
609625
this.renderItems(this.listings.get('listings'));
@@ -689,6 +705,8 @@ UserPageVw = pageVw.extend({
689705
return followingObject.guid;
690706
});
691707
self.renderFollowing(followingArray);
708+
self.setFollowingPlaceholder(followingArray.length, self.ownFollowing.length);
709+
692710
//call followers 2nd so list of following is available
693711
self.fetchFollowers();
694712
} else {
@@ -703,8 +721,11 @@ UserPageVw = pageVw.extend({
703721
return followingObject.guid;
704722
});
705723
self.renderFollowing(followingArray);
724+
self.setFollowingPlaceholder(followingArray.length, self.ownFollowing.length);
725+
706726
//call followers 2nd so list of following is available
707727
self.fetchFollowers();
728+
708729
//mark whether page is following you
709730
if (self.options.ownPage === false && Boolean(__.findWhere(followingArray, {guid: self.userID}))){
710731
self.$('.js-followsMe').removeClass('hide');
@@ -713,7 +734,6 @@ UserPageVw = pageVw.extend({
713734
if (self.options.ownPage === false){
714735
self.toggleFollowButtons(Boolean(__.findWhere(ownFollowingData.following, {guid: self.pageID})));
715736
}
716-
717737
}).fail(function(jqXHR, status, errorThrown){
718738
if (self.isRemoved()) return;
719739
console.log(jqXHR);
@@ -770,6 +790,7 @@ UserPageVw = pageVw.extend({
770790
if (followerArray.length || this.followerFetchTotal == 0){
771791
//always render the first time so the no followers message is shown for no followers
772792
this.renderFollowers(followerArray, this.followerFetchTotal);
793+
this.setFollowersPlaceholder(this.followerFetchTotal, this.followerFetchStart)
773794
}
774795
},
775796
error: function(){
@@ -909,7 +930,7 @@ UserPageVw = pageVw.extend({
909930
});
910931
},
911932

912-
renderFollowing: function (model) {
933+
renderFollowing: function (model) {
913934
model = model || [];
914935
this.followingList = new personListView({
915936
model: model,
@@ -933,11 +954,13 @@ UserPageVw = pageVw.extend({
933954
});
934955
}
935956

936-
this.listenTo(this.followerList, 'usersAdded', ()=>{
957+
this.listenTo(this.followingList, 'usersAdded', ()=>{
937958
var searchTerms = this.$('#inputFollowing').val();
938959
if (this.followingSearch){
939960
this.followingSearch.reIndex();
940961
searchTerms && this.followingSearch.search(searchTerms);
962+
963+
this.setFollowingPlaceholder(model.length, this.followingSearch.size());
941964
}
942965
});
943966
},

0 commit comments

Comments
 (0)