fix highlighting of text in search, make title bigger

This commit is contained in:
Sam 2015-07-28 09:43:03 +10:00
parent 52f4ff9a2f
commit a97fa571a1
4 changed files with 18 additions and 15 deletions

View File

@ -0,0 +1,13 @@
export default Ember.Component.extend({
tagName: 'span',
_highlightOnInsert: function() {
const term = this.get('highlight');
const self = this;
if(!_.isEmpty(term)) {
self.$().highlight(term.split(/\s+/), {className: 'search-highlight'});
}
}.observes('highlight').on('didInsertElement')
});

View File

@ -26,7 +26,9 @@
{{/if}}
</span>
{{#if result.blurb}}
{{{unbound result.blurb}}}
{{#highlight-text highlight=controller.q}}
{{{unbound result.blurb}}}
{{/highlight-text}}
{{/if}}
</div>
</div>

View File

@ -2,16 +2,4 @@ import ScrollTop from 'discourse/mixins/scroll-top';
export default Ember.View.extend(ScrollTop, {
_highlightOnInsert: function() {
const term = this.get('controller.q');
const self = this;
if(!_.isEmpty(term)) {
Em.run.next(function(){
self.$('.blurb').highlight(term.split(/\s+/), {className: 'search-highlight'});
// we can highlight title, but I feel its a bit too much
// self.$('.topic-title').highlight(term.split(/\s+/), {className: 'search-highlight'} );
});
}
}.observes('controller.model').on('didInsertElement')
});

View File

@ -14,12 +14,12 @@
}
.avatar {
position: relative;
top: -2px;
top: -3px;
margin-right: 4px;
}
.search-link {
.topic-statuses, .topic-title {
font-size: 1.25em;
font-size: 1.4em;
}
}
.blurb {