* Add page of gitlab-browse.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
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')
|
||||
{
|
||||
var browseProjectLink = $.createLink('gitlab', 'browseProject', 'gitlabID=' + row.data.id);
|
||||
if(canBrowseProject) result[0] = {html:'<a href="' + browseProjectLink + '">' + row.data.name + '</a>', style:{flexDirection:"column"}};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
if(col.name === 'url')
|
||||
{
|
||||
result[0] = {html:'<a href="' + row.data.url + '" target="_blank">' + row.data.url + '</a>', style:{flexDirection:"column"}};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* The browse view file of gitlab module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
|
||||
* @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
||||
* @author Ke Zhao<zhaoke@easycorp.ltd>
|
||||
* @package gitlab
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
|
||||
namespace zin;
|
||||
|
||||
featureBar();
|
||||
|
||||
/* zin: Define the toolbar on main menu. */
|
||||
$canCreate = hasPriv('gitlab', 'create');
|
||||
$createLink = $this->createLink('gitlab', 'create');
|
||||
$createItem = array('text' => $lang->gitlab->create, 'url' => $createLink, 'class' => 'primary', 'icon' => 'plus');
|
||||
|
||||
$tableData = initTableData($gitlabList, $config->gitlab->dtable->fieldList, $this->gitlab);
|
||||
|
||||
toolbar
|
||||
(
|
||||
$canCreate ? item(set($createItem)) : null,
|
||||
);
|
||||
|
||||
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::onRenderCell(jsRaw('window.renderCell')),
|
||||
set::footPager(usePager()),
|
||||
);
|
||||
|
||||
render();
|
||||
Reference in New Issue
Block a user