* build: fix link bug and story with searchForm not work.

This commit is contained in:
sunhao
2023-11-20 09:41:42 +08:00
parent 00a153af5d
commit afc9aa58d6
4 changed files with 40 additions and 12 deletions
+18 -8
View File
@@ -28,11 +28,22 @@ $(document).off('click','.dtable-footer .batch-btn').on('click', '.dtable-footer
window.appendLinkBtn();
});
window.showLink = function(obj)
window.showLink = function(type, params, onlyUpdateTable)
{
var $this = $(obj);
var idName = $this.data('type') == 'story' ? '#story' : '#bug';
$(idName).load($this.data('linkurl'));
const url = $.createLink(buildModule, type === 'story' ? 'linkStory' : 'linkBug', 'buildID=' + buildID + (params || '&browseType=&param='));
if(onlyUpdateTable)
{
loadComponent($('#' + type).find('.dtable').attr('id'), {url: url, component: 'dtable', partial: true});
return;
}
loadTarget({url: url, target: type});
};
window.onSearchLinks = function(type, result)
{
const params = $.parseLink(result.load).vars[3];
showLink(type, params ? atob(params[1]) : null, true);
return false;
};
$(document).on('click', '.linkObjectBtn', function()
@@ -60,8 +71,7 @@ $(document).on('click', '.linkObjectBtn', function()
$.ajaxSubmit({"url": $(this).data('url'), "data": postData});
});
if(initLink == 'true')
$(function()
{
var idName = type == 'story' ? '#story' : '#bug';
window.showLink($(idName).find('.link'));
}
if(initLink == 'true') window.showLink(type, linkParams);
});
+2 -1
View File
@@ -32,7 +32,8 @@ searchForm
(
set::module('bug'),
set::simple(true),
set::show(true)
set::show(true),
set::onSearch(jsRaw("window.onSearchLinks.bind(null, 'bug')"))
);
dtable
+2 -1
View File
@@ -28,7 +28,8 @@ searchForm
(
set::module('story'),
set::simple(true),
set::show(true)
set::show(true),
set::onSearch(jsRaw("window.onSearchLinks.bind(null, 'story')"))
);
dtable
+18 -2
View File
@@ -58,10 +58,12 @@ detailHeader
jsVar('initLink', $link);
jsVar('type', $type);
jsVar('linkParams', $decodeParam);
jsVar('buildID', $build->id);
jsVar('confirmDelete', $lang->build->confirmDelete);
jsVar('currentAccount', $app->user->account);
jsVar('buildProduct', $build->product);
jsVar('buildModule', $buildModule);
/* Story's batch btn. */
$canBatchUnlinkStory = $canBeChanged && common::hasPriv($buildModule, 'batchUnlinkStory');
@@ -118,7 +120,13 @@ detailBody
div
(
setClass('tab-actions'),
!common::hasPriv($buildModule, 'linkStory') ? null : btn(set::text($lang->build->linkStory), setClass('primary link'), set::icon('link'), set::onclick('showLink(this)'), set('data-type', 'story'), set('data-linkurl', createLink($buildModule, 'linkStory', "buildID={$build->id}" . (($link == 'true' && $type == 'story') ? $decodeParam : "&browseType=&param="))))
common::hasPriv($buildModule, 'linkStory') ? btn
(
set::text($lang->build->linkStory),
set::icon('link'),
set::type('primary'),
bind::click("window.showLink('story')")
) : null
),
dtable
(
@@ -129,6 +137,7 @@ detailBody
set::checkable($canBatchUnlinkStory || $canBatchCloseStory),
set::sortLink(createLink($buildModule, 'view', "buildID={$build->id}&type=story&link={$link}&param={$param}&orderBy={name}_{sortType}")),
set::orderBy($orderBy),
set::extraHeight('+144'),
set::footToolbar($storyFootToolbar),
set::footPager(usePager('storyPager', '', array(
'recPerPage' => $storyPager->recPerPage,
@@ -148,7 +157,13 @@ detailBody
div
(
setClass('tab-actions'),
!common::hasPriv($buildModule, 'linkBug') ? null : btn(set::text($lang->build->linkBug), setClass('primary link'), set::icon('link'), set::onclick('showLink(this)'), set('data-type', 'bug'), set('data-linkurl', createLink($buildModule, 'linkBug', "buildID={$build->id}" . (($link == 'true' && $type == 'bug') ? $decodeParam : "&browseType=&param="))))
common::hasPriv($buildModule, 'linkBug') ? btn
(
set::text($lang->build->linkBug),
set::type('primary'),
set::icon('link'),
bind::click("window.showLink('bug')")
) : null
),
dtable
(
@@ -159,6 +174,7 @@ detailBody
set::checkable($canBatchUnlinkBug || $canBatchCloseBug),
set::sortLink(createLink($buildModule, 'view', "buildID={$build->id}&type=bug&link={$link}&param={$param}&orderBy={name}_{sortType}")),
set::orderBy($orderBy),
set::extraHeight('+144'),
set::footToolbar($bugFootToolbar),
set::footPager(usePager('bugPager', '', array(
'recPerPage' => $bugPager->recPerPage,