Skip to content

Commit

Permalink
fix: closes #12115 , toggle hasmore as well
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Oct 24, 2023
1 parent 7134265 commit 728d63f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions public/src/admin/manage/categories.js
Expand Up @@ -46,6 +46,10 @@ define('admin/manage/categories', [
const el = $(this);
el.find('i').toggleClass('fa-chevron-down').toggleClass('fa-chevron-right');
el.closest('[data-cid]').find('> ul[data-cid]').toggleClass('hidden');
const hasMoreEl = el.closest('[data-cid]').find('> ul.has-more-categories');
if (parseInt(hasMoreEl.attr('data-hasmore'), 10) === 1) {
hasMoreEl.toggleClass('hidden');
}
});

$('.categories').on('click', '.set-order', function () {
Expand Down
7 changes: 5 additions & 2 deletions src/views/admin/partials/categories/category-rows.tpl
Expand Up @@ -55,8 +55,11 @@
</div>
</div>

<ul class="list-unstyled has-more-categories {{{ if !../hasMoreSubCategories}}}hidden{{{ end }}}">
<li>
<ul class="list-unstyled has-more-categories mt-2 {{{ if !./hasMoreSubCategories}}}hidden{{{ end }}}" data-hasmore="{{{ if ./hasMoreSubCategories}}}1{{{ else }}}0{{{ end }}}">
<li class="d-flex gap-2">
<div class="invisible toggle text-center text-sm">
<i class="fa fa-chevron-down"></i>
</div>
<a href="{config.relative_path}/admin/manage/categories?cid={categories.cid}&page={categories.showMorePage}" class="btn btn-sm btn-light">[[category:x-more-categories, {../subCategoriesLeft}]]</a>
</li>
</ul>
Expand Down

0 comments on commit 728d63f

Please sign in to comment.