From de09522cfc17f9a657be69f7bf4583aa7d3f3d2a Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Mon, 6 Nov 2023 11:13:35 +0800 Subject: [PATCH] * Adjust dtable sort init. --- module/gitlab/js/browse.ui.js | 8 -------- module/gitlab/js/browsegroup.ui.js | 8 -------- module/gitlab/js/browseproject.ui.js | 8 -------- module/gitlab/js/browseuser.ui.js | 8 -------- module/gitlab/ui/browse.html.php | 7 ++----- module/gitlab/ui/browsegroup.html.php | 4 +--- module/gitlab/ui/browseproject.html.php | 5 ++--- module/gitlab/ui/browseuser.html.php | 7 ++----- 8 files changed, 7 insertions(+), 48 deletions(-) diff --git a/module/gitlab/js/browse.ui.js b/module/gitlab/js/browse.ui.js index 5f37b3086f..ce93f3e431 100644 --- a/module/gitlab/js/browse.ui.js +++ b/module/gitlab/js/browse.ui.js @@ -1,11 +1,3 @@ -window.createSortLink = function(col) -{ - var sort = col.name + '_asc'; - if(sort == orderBy) sort = col.name + '_desc'; - - return sortLink.replace('{orderBy}', sort); -} - window.renderCell = function(result, {col, row}) { if(col.name === 'name') diff --git a/module/gitlab/js/browsegroup.ui.js b/module/gitlab/js/browsegroup.ui.js index 71dc6fc791..a63105cb7e 100644 --- a/module/gitlab/js/browsegroup.ui.js +++ b/module/gitlab/js/browsegroup.ui.js @@ -9,14 +9,6 @@ window.renderCell = function(result, {col, row}) return result; }; -window.createSortLink = function(col) -{ - var sort = col.name + '_asc'; - if(sort == orderBy) sort = col.name + '_desc'; - - return sortLink.replace('{orderBy}', sort); -} - function searchGroup() { loadPage({method:'post', data: {keyword: $('#keyword').val()}, target: '#table-gitlab-browsegroup>*'}); diff --git a/module/gitlab/js/browseproject.ui.js b/module/gitlab/js/browseproject.ui.js index 403f48ad52..fb99fb7329 100644 --- a/module/gitlab/js/browseproject.ui.js +++ b/module/gitlab/js/browseproject.ui.js @@ -1,11 +1,3 @@ -window.createSortLink = function(col) -{ - var sort = col.name + '_asc'; - if(sort == orderBy) sort = col.name + '_desc'; - - return sortLink.replace('{orderBy}', sort); -} - window.renderCell = function(result, {col, row}) { if(col.name === 'star') diff --git a/module/gitlab/js/browseuser.ui.js b/module/gitlab/js/browseuser.ui.js index ff3e808496..3d1453d99d 100644 --- a/module/gitlab/js/browseuser.ui.js +++ b/module/gitlab/js/browseuser.ui.js @@ -1,11 +1,3 @@ -window.createSortLink = function(col) -{ - var sort = col.name + '_asc'; - if(sort == orderBy) sort = col.name + '_desc'; - - return sortLink.replace('{orderBy}', sort); -} - function searchUser() { loadPage({method:'post', data: {keyword: $('#keyword').val()}, target: '#table-gitlab-browseuser>*'}); diff --git a/module/gitlab/ui/browse.html.php b/module/gitlab/ui/browse.html.php index 96161ca10b..8ed12c785d 100644 --- a/module/gitlab/ui/browse.html.php +++ b/module/gitlab/ui/browse.html.php @@ -27,17 +27,14 @@ toolbar ); jsVar('confirmDelete', $lang->gitlab->confirmDelete); -jsVar('orderBy', $orderBy); jsVar('canBrowseProject', common::hasPriv('gitlab', 'browseProject')); -jsVar('sortLink', helper::createLink('gitlab', 'browse', "orderBy={orderBy}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")); dtable ( set::cols(array_values($config->gitlab->dtable->fieldList)), set::data($tableData), - set::sortLink(jsRaw('createSortLink')), + set::orderBy($orderBy), + set::sortLink(createLink('gitlab', 'browse', "orderBy={name}_{sortType}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")), set::onRenderCell(jsRaw('window.renderCell')), set::footPager(usePager()), ); - -render(); diff --git a/module/gitlab/ui/browsegroup.html.php b/module/gitlab/ui/browsegroup.html.php index dd563239c2..fafee5f076 100644 --- a/module/gitlab/ui/browsegroup.html.php +++ b/module/gitlab/ui/browsegroup.html.php @@ -10,8 +10,6 @@ declare(strict_types=1); */ namespace zin; -jsVar('orderBy', $orderBy); -jsVar('sortLink', helper::createLink('gitlab', 'browseGroup', "gitlabID={$gitlabID}&orderBy={orderBy}")); jsVar('gitlabUrl', $gitlab->url); $canCreate = hasPriv('instance', 'manage'); @@ -99,7 +97,7 @@ dtable ( set::cols($config->gitlab->dtable->group->fieldList), set::data($gitlabGroupList), - set::sortLink(jsRaw('createSortLink')), + set::sortLink(createLink('gitlab', 'browseGroup', "gitlabID={$gitlabID}&orderBy={name}_{sortType}")), set::onRenderCell(jsRaw('window.renderCell')), set::orderBy($orderBy), ); diff --git a/module/gitlab/ui/browseproject.html.php b/module/gitlab/ui/browseproject.html.php index 72cb1527d9..3c66ccd942 100644 --- a/module/gitlab/ui/browseproject.html.php +++ b/module/gitlab/ui/browseproject.html.php @@ -10,8 +10,6 @@ declare(strict_types=1); */ namespace zin; -jsVar('orderBy', $orderBy); -jsVar('sortLink', helper::createLink('gitlab', 'browseProject', "gitlabID={$gitlabID}&orderBy={orderBy}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")); jsVar('projectStar', $lang->gitlab->project->star); jsVar('projectFork', $lang->gitlab->project->fork); @@ -100,7 +98,8 @@ dtable ( set::cols($config->gitlab->dtable->project->fieldList), set::data($gitlabProjectList), - set::sortLink(jsRaw('createSortLink')), + set::orderBy($orderBy), + set::sortLink(createLink('gitlab', 'browseProject', "gitlabID={$gitlabID}&orderBy={name}_{sortType}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")), set::onRenderCell(jsRaw('window.renderCell')), set::footPager(usePager()) ); diff --git a/module/gitlab/ui/browseuser.html.php b/module/gitlab/ui/browseuser.html.php index 6b14b4d91f..f627254d66 100644 --- a/module/gitlab/ui/browseuser.html.php +++ b/module/gitlab/ui/browseuser.html.php @@ -10,8 +10,7 @@ declare(strict_types=1); */ namespace zin; -jsVar('orderBy', $orderBy); -jsVar('sortLink', helper::createLink('gitlab', 'browseUser', "gitlabID={$gitlabID}&orderBy={orderBy}")); +jsVar('gitlabUrl', $gitlab->url); $canCreate = hasPriv('instance', 'manage'); @@ -94,9 +93,7 @@ dtable ( set::cols($config->gitlab->dtable->user->fieldList), set::data($gitlabUserList), - set::sortLink(jsRaw('createSortLink')), + set::sortLink(createLink('gitlab', 'browseUser', "gitlabID={$gitlabID}&orderBy={name}_{sortType}")), set::onRenderCell(jsRaw('window.renderCell')), set::orderBy($orderBy), ); - -render();