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

Commit 04e843e

Browse files
committed
Merge pull request #1586 from mariodian/addressbar_autocomplete
Add autocomplete suggestions for tags and handles
2 parents 9b86e53 + 1b6a9ef commit 04e843e

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
@@ -1770,6 +1770,33 @@ removed because I don't think we're using the trick to hide the borders any more
17701770
left: 168px;
17711771
}
17721772
1773+
.suggestionsList {
1774+
position: absolute;
1775+
width: 100%;
1776+
max-height: 155px;
1777+
background: #fff;
1778+
margin-top: 14px;
1779+
border-bottom-left-radius: 3px;
1780+
border-bottom-right-radius: 3px;
1781+
overflow-y: scroll;
1782+
}
1783+
1784+
.suggestionsList a {
1785+
display: block;
1786+
color: #000;
1787+
padding: 8px 20px;
1788+
}
1789+
.suggestionsList a:last-child {
1790+
border-bottom-left-radius: 3px;
1791+
border-bottom-right-radius: 3px;
1792+
}
1793+
.suggestionsList a:hover, .suggestionsList a:focus {
1794+
text-decoration: none;
1795+
}
1796+
.suggestionsList a:hover, .suggestionsList a.selected {
1797+
background-color: #efefef;
1798+
}
1799+
17731800
.txtField-bar,
17741801
input[type="text"].txtField-bar {
17751802
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
@@ -154,6 +154,8 @@ <h2 class="ion-android-close custCol-text clickable"></h2>
154154
<%= polyglot.t('nav.testMode') %>
155155
</div>
156156
<% } %>
157+
158+
<div class="suggestionsList js-addressBarSuggestions"></div>
157159
</div>
158160
</div>
159161
<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
@@ -495,17 +495,21 @@ module.exports = baseVw.extend({
495495

496496
searchItems: function(searchItemsText){
497497
if (searchItemsText){
498+
var hashedItem = "#" + searchItemsText;
499+
500+
window.obEventBus.trigger('searchingText', hashedItem);
501+
498502
this.searchItemsText = searchItemsText;
499503
this.clearItems();
500504
this.socketItemsID = "";
501505
this.socketSearchID = Math.random().toString(36).slice(2);
502506
this.socketView.search(this.socketSearchID, searchItemsText);
503507
this.setSocketTimeout();
504-
this.$el.find('.js-discoverHeading').html("#" + searchItemsText);
508+
this.$el.find('.js-discoverHeading').html(hashedItem);
505509
this.$el.find('.js-loadingText').html(
506510
this.$el.find('.js-loadingText')
507511
.data('searchingText')
508-
.replace('%{tag}', `<span class="btn-pill color-secondary">#${searchItemsText}</span>`)
512+
.replace('%{tag}', `<span class="btn-pill color-secondary">${hashedItem}</span>`)
509513
);
510514
this.$el.find('.js-homeSearchItemsClear').removeClass('hide');
511515
this.setState('products', searchItemsText);

0 commit comments

Comments
 (0)