mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #3718 from guerler/add_tags_to_label_000
Show tags in select search field
This commit is contained in:
@@ -130,8 +130,11 @@ var View = Backbone.View.extend({
|
||||
if ( this.model.get( 'searchable' ) ) {
|
||||
this.data2 = [];
|
||||
_.each( this.data, function( option, index ) {
|
||||
var tags = _.reduce( option.tags, function( memo, tag ) { return memo + ' ' + tag }, '');
|
||||
self.data2.push( { order: index, id: option.value, text: option.label, tags: tags } );
|
||||
var filterstr = _.reduce( option.tags, function( memo, tag ) { return memo + tag + ' ' }, '' );
|
||||
var filterhtml = '<div class="ui-tags">' +
|
||||
_.reduce( option.tags, function( memo, tag ) { return memo + ' <div class="label label-info">' + tag + '</div>' }, '' )
|
||||
+ '</div>';
|
||||
self.data2.push( { order: index, id: option.value, text: option.label, filterhtml: filterhtml, filterstr: filterstr } );
|
||||
});
|
||||
this.$select.data( 'select2' ) && this.$select.select2( 'destroy' );
|
||||
this.$select.select2({
|
||||
@@ -141,12 +144,15 @@ var View = Backbone.View.extend({
|
||||
query : function( q ) {
|
||||
var pagesize = self.model.get( 'pagesize' );
|
||||
var results = _.filter( self.data2, function ( e ) {
|
||||
return self._match( q.term, e.text ) || self._match( q.term, e.tags );
|
||||
return self._match( q.term, e.text ) || self._match( q.term, e.filterstr );
|
||||
});
|
||||
q.callback({
|
||||
results: results.slice( ( q.page - 1 ) * pagesize, q.page * pagesize ),
|
||||
more : results.length >= q.page * pagesize
|
||||
});
|
||||
},
|
||||
formatResult : function( result ) {
|
||||
return result.text + result.filterhtml;
|
||||
}
|
||||
});
|
||||
this.$( '.select2-container .select2-search input' ).off( 'blur' );
|
||||
|
||||
@@ -68,6 +68,11 @@
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.ui-tags {
|
||||
word-wrap: break-word;
|
||||
padding-right: 25px;
|
||||
}
|
||||
|
||||
.ui-message {
|
||||
padding: 2px 10px 2px 10px;
|
||||
margin-top: @ui-margin-vertical-large;
|
||||
|
||||
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
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
Reference in New Issue
Block a user