* Adjust for create story in task kanban.

This commit is contained in:
wangyidong
2023-11-14 17:32:54 +08:00
parent 8948fffdfc
commit 14e43e71dc
6 changed files with 24 additions and 19 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ function importLines(target, field)
const $modal = $(target).closest('.modal');
const $dialog = $modal.find('.modal-dialog');
const $lines = $modal.find('textarea');
const $form = $modal.closest('.container').find('form.form-batch');
const $form = $modal.closest('body').find('form.form-batch[data-zui-batchform]');
const modalID = $modal.attr('id');
$dialog.addClass('loading');
+2 -2
View File
@@ -137,14 +137,14 @@ window.buildColCardActions = function(col)
let actions = [];
if(col.type == 'backlog')
{
if(priv.canCreateStory) actions.push({text: storyLang.create, url:$.createLink('story', 'create', 'productID=' + productID + '&branch=0&moduleID=0&storyID=0&objectID=' + executionID), 'data-toggle': 'modal'});
if(priv.canCreateStory) actions.push({text: storyLang.create, url:$.createLink('story', 'create', 'productID=' + productID + '&branch=0&moduleID=0&storyID=0&objectID=' + executionID), 'data-toggle': 'modal', 'data-size': 'lg'});
if(priv.canBatchCreateStory) actions.push({text: executionLang.batchCreateStory, url: $.createLink('story', 'batchcreate', 'productID=' + productID + '&branch=0&moduleID=0&storyID=0&executionID=' + executionID), 'data-toggle': 'modal', 'data-size': 'lg'});
if(priv.canLinkStory) actions.push({text: executionLang.linkStory, url: $.createLink('execution', 'linkStory', 'executionID=' + executionID), 'data-toggle': 'modal', 'data-size': 'lg'});
if(priv.canLinkStoryByPlan) actions.push({text: executionLang.linkStoryByPlan, url: '#linkStoryByPlan', 'data-toggle': 'modal'});
}
else if(col.type == 'unconfirmed')
{
if(priv.canCreateBug) actions.push({text: bugLang.create, url: $.createLink('bug', 'create', 'productID=0&moduleID=0&extra=executionID=' + executionID), 'data-toggle': 'modal'});
if(priv.canCreateBug) actions.push({text: bugLang.create, url: $.createLink('bug', 'create', 'productID=0&moduleID=0&extra=executionID=' + executionID), 'data-toggle': 'modal', 'data-size': 'lg'});
if(priv.canBatchCreateBug)
{
if(productNum > 1) actions.push({text: bugLang.batchCreate, url: '#batchCreateBug', 'data-toggle': 'modal', 'data-size': 'lg'});
+8 -7
View File
@@ -26,7 +26,7 @@ window.customSubmit = function(e)
if($this.prop('tagName') != 'BUTTON') $this = $this.closest('button');
var storyStatus = 'active';
if(!$dataform.hasClass('form-batch')) storyStatus = !$('#reviewer').zui('picker').$.value || $('#needNotReview').prop('checked') ? 'active' : 'reviewing';
if(!$dataform.hasClass('form-batch')) storyStatus = !$('[name=reviewer]').val() || $('#needNotReview').prop('checked') ? 'active' : 'reviewing';
if($this.attr('id') == 'saveDraftButton')
{
storyStatus = 'draft';
@@ -38,6 +38,7 @@ window.customSubmit = function(e)
$.ajaxSubmit(
{
headers: $this.closest('.modal').length > 0 ? {'X-Zui-Modal': 'modal'} : {},
data: new FormData($dataform[0]),
url: $dataform.attr('action'),
onSuccess: function(result) {loadPage(result.load)},
@@ -111,10 +112,10 @@ window.toggleFeedback = function(obj)
window.loadURS = function(allURS)
{
var productID = $('#product').zui('picker').$.state.value;
var branchID = $('#branch').length == 0 ? 0 : $('#branch').zui('picker').$.state.value;
var moduleID = typeof(allURS) == 'undefined' ? $('#module').zui('picker').$.state.value : 0;
var requirementList = $('#URS').zui('picker').$.state.value;
var productID = $('[name=product]').val();
var branchID = $('[name=branch]').length == 0 ? 0 : $('[name=#branch]').val();
var moduleID = typeof(allURS) == 'undefined' ? $('[name=module]').val() : 0;
var requirementList = $('[name=URS]').val();
requirementList = requirementList ? encodeURIComponent(requirementList.join(',')) : '';
if(typeof(branchID) == 'undefined') branchID = 0;
@@ -177,8 +178,8 @@ window.loadProductPlans = function(productID, branch)
window.loadBranch = function()
{
var branch = $('#branch').val();
var productID = $('#product').val();
var branch = $('[name=branch]').val();
var productID = $('[name=product]').val();
if(typeof(branch) == 'undefined') branch = 0;
loadProductModules(productID, branch);
+6 -3
View File
@@ -5,7 +5,7 @@ window.toggleReviewer = function(obj)
const $this = $(obj);
const isChecked = $this.prop('checked');
$reviewer = $('#reviewer').zui('picker');
$reviewer = $('[name=reviewer]').zui('picker');
options = $reviewer.options;
if(isChecked)
{
@@ -46,7 +46,10 @@ window.loadProduct = function(e)
{
const $this = $(e.target);
const productID = $this.val();
loadPage($.createLink('story', 'create', 'productID=' + productID + '&' + createParams))
const $modal = $this.closest('.modal');
const inModal = $modal.length > 0;
if(inModal) loadModal($.createLink('story', 'create', 'productID=' + productID + '&' + createParams), $modal.attr('id'));
if(!inModal) loadPage($.createLink('story', 'create', 'productID=' + productID + '&' + createParams));
};
window.loadBranchRelation = function(e)
@@ -65,7 +68,7 @@ window.loadBranchRelation = function(e)
window.addBranchesBox = function(e)
{
const productID = $('#product').zui('picker').$.value;
const productID = $('[name=product]').val();
const $formRow = $(e.target).closest('.form-row');
const $branchPicker = $('.switchBranch #branchBox .picker-box').zui('picker');
const $modulePicker = $('.switchBranch #moduleIdBox .picker-box').zui('picker');
+5 -5
View File
@@ -40,16 +40,16 @@ formPanel
set::customFields(true),
formRow
(
on::change('#product', 'loadProduct'),
on::change('#branch', 'loadBranch'),
on::change('[name=product]', 'loadProduct'),
on::change('[name=branch]', 'loadBranch'),
formGroup
(
set::label($lang->story->product),
set::width('1/2'),
inputGroup
(
picker(setID('product'), set::name('product'), set::value($fields['product']['default']), set::items($fields['product']['options'])),
isset($fields['branch']) && $type != 'story' ? picker(setID('branch'), set::name('branch'), set::items($fields['branch']['options']), set::value($fields['branch']['default'])) : null,
picker(set::name('product'), set::value($fields['product']['default']), set::items($fields['product']['options'])),
isset($fields['branch']) && $type != 'story' ? picker(set::name('branch'), set::items($fields['branch']['options']), set::value($fields['branch']['default'])) : null,
),
set::required(true),
),
@@ -167,7 +167,7 @@ formPanel
span
(
set::id('planIdBox'),
picker(setID('plan'), set::name('plan'), set::items($fields['plan']['options']), set::value($fields['plan']['default'])),
picker(set::name('plan'), set::items($fields['plan']['options']), set::value($fields['plan']['default'])),
),
empty($fields['plan']['options']) ? btn(set::url($this->createLink('productplan', 'create', "productID=$productID&branch=$branch")), set('data-toggle', 'modal'), set::title($lang->productplan->create), icon('plus')) : null,
empty($fields['plan']['options']) ? btn(setClass('refresh'), set::title($lang->refresh), set('onclick', "loadProductPlans($productID)"), icon('refresh')) : null,
+2 -1
View File
@@ -1072,9 +1072,10 @@ class storyZen extends story
protected function getAssignMeBlockID(): int
{
if(!isonlybody()) return 0;
return (int)$this->dao->select('id')->from(TABLE_BLOCK)->where('block')->eq('assigntome')
return (int)$this->dao->select('id')->from(TABLE_BLOCK)->where('module')->eq('assigntome')
->andWhere('module')->eq('my')
->andWhere('account')->eq($this->app->user->account)
->andWhere('vision')->eq($this->config->vision)
->orderBy('order_desc')
->limit(1)
->fetch('id');