Only compose tag:value one time on the client.

This commit is contained in:
Dannon Baker
2017-03-06 17:29:33 -05:00
parent d20e19e85a
commit 942f0d98d9
6 changed files with 9 additions and 7 deletions
@@ -130,9 +130,11 @@ var View = Backbone.View.extend({
if ( this.model.get( 'searchable' ) ) {
this.data2 = [];
_.each( this.data, function( option, index ) {
var filterstr = _.reduce( option.tags, function( memo, tag ) { return memo + tag[0] + (tag[1] ? ":"+tag[1] : '' ) + ' ' }, '' );
var tags_with_values = [];
_.each(option.tags, function(tag){ tags_with_values.push(tag[0] + (tag[1] ? ":"+tag[1] : '' ))});
var filterstr = _.reduce( tags_with_values, function( memo, tag ) { return memo + tag + ' ' }, '' );
var filterhtml = '<div class="ui-tags">' +
_.reduce( option.tags, function( memo, tag ) { return memo + '&nbsp;<div class="label label-info">' + tag[0] + (tag[1] ? ":"+tag[1] : '' ) + '</div>' }, '' )
_.reduce( tags_with_values, function( memo, tag ) { return memo + '&nbsp;<div class="label label-info">' + tag + '</div>' }, '' )
+ '</div>';
self.data2.push( { order: index, id: option.value, text: option.label, filterhtml: filterhtml, filterstr: filterstr } );
});
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long