format groups and remotes in autocomplete list

This commit is contained in:
Arthur Schiwon 2015-09-12 12:17:15 +02:00 committed by Vincent Petry
parent 5fad379bf1
commit 4c702aa8fd
1 changed files with 19 additions and 1 deletions

View File

@ -132,6 +132,24 @@
}); });
}, },
autocompleteRenderItem: function(ul, item) {
var insert = $("<a>");
var text = item.label;
if (item.value.shareType === OC.Share.SHARE_TYPE_GROUP) {
text = text + ' ('+t('core', 'group')+')';
} else if (item.value.shareType === OC.Share.SHARE_TYPE_REMOTE) {
text = text + ' ('+t('core', 'remote')+')';
}
insert.text(text);
if(item.value.shareType === OC.Share.SHARE_TYPE_GROUP) {
insert = insert.wrapInner('<strong></strong>');
}
return $("<li>")
.addClass((item.value.shareType === OC.Share.SHARE_TYPE_GROUP) ? 'group' : 'user')
.append(insert)
.appendTo(ul);
},
render: function() { render: function() {
var baseTemplate = this._getTemplate('base', TEMPLATE_BASE); var baseTemplate = this._getTemplate('base', TEMPLATE_BASE);
@ -155,7 +173,7 @@
expiration: expiration expiration: expiration
}); });
} }
}); }).data('ui-autocomplete')._renderItem = this.autocompleteRenderItem;
this.resharerInfoView.$el = this.$el.find('.resharerInfoView'); this.resharerInfoView.$el = this.$el.find('.resharerInfoView');
this.resharerInfoView.render(); this.resharerInfoView.render();