Barış Soner Uşaklı 6 years ago
parent dd2a9c7288
commit 169a6680d5

@ -13,6 +13,30 @@ define('categorySelector', ['benchpress', 'translator'], function (Benchpress, t
categorySelector.selectCategory(categoryEl.attr('data-cid'));
callback(selectedCategory);
});
var searchEl = el.find('[component="category-selector-search"]');
var categoryEls = el.find('.category-dropdown-menu .category');
el.on('show.bs.dropdown', function () {
function updateList() {
var val = searchEl.find('input').val().toLowerCase();
categoryEls.each(function () {
var liEl = $(this);
liEl.toggleClass('hidden', liEl.attr('data-name').toLowerCase().indexOf(val) === -1);
});
}
searchEl.removeClass('hidden').on('click', function (ev) {
ev.preventDefault();
ev.stopPropagation();
});
searchEl.find('input').val('').on('keyup', updateList);
updateList();
});
el.on('hide.bs.dropdown', function () {
searchEl.addClass('hidden').off('click');
searchEl.find('input').off('keyup');
});
};
categorySelector.getSelectedCategory = function () {

Loading…
Cancel
Save