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

Commit 1b6a9ef

Browse files
committed
Add autocomplete suggestions for tags and handles
1 parent 9ae2fdc commit 1b6a9ef

File tree

7 files changed

+320
-23
lines changed

7 files changed

+320
-23
lines changed

css/obBase.css

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,6 +1760,33 @@ removed because I don't think we're using the trick to hide the borders any more
17601760
left: 168px;
17611761
}
17621762
1763+
.suggestionsList {
1764+
position: absolute;
1765+
width: 100%;
1766+
max-height: 155px;
1767+
background: #fff;
1768+
margin-top: 14px;
1769+
border-bottom-left-radius: 3px;
1770+
border-bottom-right-radius: 3px;
1771+
overflow-y: scroll;
1772+
}
1773+
1774+
.suggestionsList a {
1775+
display: block;
1776+
color: #000;
1777+
padding: 8px 20px;
1778+
}
1779+
.suggestionsList a:last-child {
1780+
border-bottom-left-radius: 3px;
1781+
border-bottom-right-radius: 3px;
1782+
}
1783+
.suggestionsList a:hover, .suggestionsList a:focus {
1784+
text-decoration: none;
1785+
}
1786+
.suggestionsList a:hover, .suggestionsList a.selected {
1787+
background-color: #efefef;
1788+
}
1789+
17631790
.txtField-bar,
17641791
input[type="text"].txtField-bar {
17651792
background: none;

js/config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ module.exports = {
3030
restart: 'f'
3131
},
3232

33+
maxTagHistory: 1000,
34+
maxHandleHistory: 1000,
35+
3336
setTestnet: function(testNetBoolean){
3437
localStorage.setItem('testnet', testNetBoolean);
3538
}

js/templates/pageNav.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ <h3 class="margin0 marginTop25"><%= polyglot.t('Discover') %></h3>
164164
<%= polyglot.t('nav.testMode') %>
165165
</div>
166166
<% } %>
167+
168+
<div class="suggestionsList js-addressBarSuggestions"></div>
167169
</div>
168170
</div>
169171
<div class="ctrlGroup">
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<a class="js-suggestion" href="<%= ob.itemUrl %>"><%= ob.itemTitle %></a>

js/views/homeVw.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,17 +470,21 @@ module.exports = baseVw.extend({
470470

471471
searchItems: function(searchItemsText){
472472
if (searchItemsText){
473+
var hashedItem = "#" + searchItemsText;
474+
475+
window.obEventBus.trigger('searchingText', hashedItem);
476+
473477
this.searchItemsText = searchItemsText;
474478
this.clearItems();
475479
this.socketItemsID = "";
476480
this.socketSearchID = Math.random().toString(36).slice(2);
477481
this.socketView.search(this.socketSearchID, searchItemsText);
478482
this.setSocketTimeout();
479-
this.$el.find('.js-discoverHeading').html("#" + searchItemsText);
483+
this.$el.find('.js-discoverHeading').html(hashedItem);
480484
this.$el.find('.js-loadingText').html(
481485
this.$el.find('.js-loadingText')
482486
.data('searchingText')
483-
.replace('%{tag}', `<span class="btn-pill color-secondary">#${searchItemsText}</span>`)
487+
.replace('%{tag}', `<span class="btn-pill color-secondary">${hashedItem}</span>`)
484488
);
485489
this.$el.find('.js-homeSearchItemsClear').removeClass('hide');
486490
this.setState('products', searchItemsText);

0 commit comments

Comments
 (0)