reset search on tags page if input is empty

v1.18.x
barisusakli 10 years ago
parent fc79b3a932
commit 9170ee831a

@ -16,7 +16,7 @@ define('forum/tags', ['forum/infinitescroll'], function(infinitescroll) {
}
if (!$('#tag-search').val().length) {
return;
return resetSearch();
}
timeoutId = setTimeout(function() {
@ -51,6 +51,17 @@ define('forum/tags', ['forum/infinitescroll'], function(infinitescroll) {
});
};
function resetSearch() {
socket.emit('topics.loadMoreTags', {
after: 0
}, function(err, data) {
if (err) {
return app.alertError(err.message);
}
onTagsLoaded(data.tags, true);
});
}
function onTagsLoaded(tags, replace, callback) {
callback = callback || function() {};
infinitescroll.parseAndTranslate('tags', 'tags', {tags: tags}, function(html) {

@ -556,7 +556,7 @@ SocketTopics.searchAndLoadTags = function(socket, data, callback) {
};
SocketTopics.loadMoreTags = function(socket, data, callback) {
if(!data || !data.after) {
if(!data || !utils.isNumber(data.after)) {
return callback(new Error('[[error:invalid-data]]'));
}

Loading…
Cancel
Save