From c81eb18623e35446c32bedfada358649ad9603f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Sat, 1 Oct 2022 22:02:01 -0400 Subject: [PATCH] fix more categories button not moving with parent fix order issue --- public/src/admin/manage/categories.js | 8 ++++++-- src/views/admin/partials/categories/category-rows.tpl | 11 ++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/public/src/admin/manage/categories.js b/public/src/admin/manage/categories.js index 83f88898c0..ca974bbdbe 100644 --- a/public/src/admin/manage/categories.js +++ b/public/src/admin/manage/categories.js @@ -202,7 +202,7 @@ define('admin/manage/categories', [ // this makes sure order is correct when drag & drop is used on pages > 1 const baseIndex = (ajaxify.data.pagination.currentPage - 1) * ajaxify.data.categoriesPerPage; modified[cid] = { - order: baseIndex + e.newIndex + 1, + order: baseIndex + e.newIndex, }; if (isCategoryUpdate) { @@ -263,7 +263,11 @@ define('admin/manage/categories', [ categories: categories, parentCategory: parentCategory, }, function (html) { - container.append(html); + if (container.find('.category-row').length) { + container.find('.category-row').after(html); + } else { + container.append(html); + } // Disable expand toggle if (!categories.length) { diff --git a/src/views/admin/partials/categories/category-rows.tpl b/src/views/admin/partials/categories/category-rows.tpl index 4f4becf95c..4a1e964a81 100644 --- a/src/views/admin/partials/categories/category-rows.tpl +++ b/src/views/admin/partials/categories/category-rows.tpl @@ -44,11 +44,12 @@ + + - {{{ if ../hasMoreSubCategories}}} -
  • - [[category:x-more-categories, {../subCategoriesLeft}]] -
  • - {{{ end }}} {{{ end }}}