* Refactor the view of task-create.
This commit is contained in:
+187
-44
@@ -15,9 +15,6 @@ namespace zin;
|
||||
/* ====== Preparing and processing page data ====== */
|
||||
|
||||
/* zin: Set variables to define picker options for form. */
|
||||
jsVar('lifetime', $execution->lifetime);
|
||||
jsVar('attribute', $execution->attribute);
|
||||
jsVar('showFields', $showFields);
|
||||
jsVar('toTaskList', !empty($task->id));
|
||||
jsVar('blockID', $blockID);
|
||||
jsVar('executionID', $execution->id);
|
||||
@@ -26,24 +23,133 @@ jsVar('teamMemberError', $lang->task->error->teamMember);
|
||||
jsVar('vision', $config->vision);
|
||||
jsVar('requiredFields', $config->task->create->requiredFields);
|
||||
jsVar('estimateNotEmpty', sprintf($lang->error->gt, $lang->task->estimate, '0'));
|
||||
jsVar('window.lifetime', $execution->lifetime);
|
||||
jsVar('window.attribute', $execution->attribute);
|
||||
jsVar('window.lifetimeList', json_encode($lifetimeList));
|
||||
jsVar('window.attributeList', json_encode($attributeList));
|
||||
jsVar('hasProduct', $execution->hasProduct);
|
||||
jsVar('hideStory', $hideStory);
|
||||
$requiredFields = array();
|
||||
foreach(explode(',', $config->task->create->requiredFields) as $field)
|
||||
{
|
||||
if($field) $requiredFields[$field] = '';
|
||||
if($field and strpos($showFields, $field) === false) $showFields .= ',' . $field;
|
||||
}
|
||||
jsVar('showFields', $showFields);
|
||||
|
||||
/* ====== Define the page structure with zin widgets ====== */
|
||||
|
||||
/* zin: Define the form in main content. */
|
||||
formPanel
|
||||
(
|
||||
set::title($lang->task->create), // The form title is diffrent from the page title,
|
||||
formRow
|
||||
$executionBox = '';
|
||||
/* Cannot show execution field in kanban. */
|
||||
if($execution->type != 'kanban' or $this->config->vision == 'lite')
|
||||
{
|
||||
$executionBox = formGroup
|
||||
(
|
||||
set::width('1/2'),
|
||||
set::name('execution'),
|
||||
set::label($lang->task->execution),
|
||||
set::value($execution->id),
|
||||
set::items($executions),
|
||||
on::change('loadAll')
|
||||
);
|
||||
}
|
||||
|
||||
$kanbanRow = '';
|
||||
/* The region and lane fields are only showed in kanban. */
|
||||
if($execution->type == 'kanban')
|
||||
{
|
||||
$kanbanRow = formRow (
|
||||
formGroup
|
||||
(
|
||||
set::width('1/2'),
|
||||
set::name('execution'),
|
||||
set::label($lang->task->execution),
|
||||
set::value($execution->id),
|
||||
set::items($executions)
|
||||
set::name('region'),
|
||||
set::label($lang->kanbancard->region),
|
||||
set::value($regionID),
|
||||
set::items($regionPairs),
|
||||
on::change('loadLanes')
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::width('1/2'),
|
||||
set::name('lane'),
|
||||
set::label($lang->kanbancard->lane),
|
||||
set::value($laneID),
|
||||
set::items($lanePairs),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/* Set the tip when there is no story. */
|
||||
if(!empty($execution->hasProduct))
|
||||
{
|
||||
$storyEmptyPreTip = span
|
||||
(
|
||||
setClass('input-control-prefix'),
|
||||
span
|
||||
(
|
||||
$lang->task->noticeLinkStory,
|
||||
),
|
||||
a
|
||||
(
|
||||
set::href($this->createLink('execution', 'linkStory', "executionID=$execution->id")),
|
||||
setClass('text-primary'),
|
||||
$lang->execution->linkStory
|
||||
),
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$storyEmptyPreTip = span
|
||||
(
|
||||
setClass('input-control-prefix'),
|
||||
span
|
||||
(
|
||||
$lang->task->noticeLinkStory,
|
||||
),
|
||||
);
|
||||
}
|
||||
$storyPreviewBtn = span
|
||||
(
|
||||
setClass('input-group-btn flex hidden'),
|
||||
set::id('preview'),
|
||||
modalTrigger
|
||||
(
|
||||
to::trigger(
|
||||
btn(
|
||||
setClass('text-gray'),
|
||||
set::icon('eye'),
|
||||
),
|
||||
),
|
||||
set::url('')
|
||||
),
|
||||
);
|
||||
|
||||
$aftoicesRow = '';
|
||||
/* Ct redirect within pop-ups. */
|
||||
if(!isonlybody())
|
||||
{
|
||||
$afterChoicesRow = formGroup
|
||||
(
|
||||
set::width('3/4'),
|
||||
set::label($lang->task->afterSubmit),
|
||||
radioList
|
||||
(
|
||||
set::name('after'),
|
||||
set::value(!empty($task->id) ? 'toTaskList' : 'continueAdding'),
|
||||
set::items($config->task->afterOptions),
|
||||
set::inline(true)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/* ====== Define the page structure with zin widgets ====== */
|
||||
|
||||
formPanel
|
||||
(
|
||||
set::id('taskCreateForm'),
|
||||
set::title($lang->task->create),
|
||||
formRow
|
||||
(
|
||||
$executionBox,
|
||||
formGroup
|
||||
(
|
||||
set::width('1/2'),
|
||||
set::name('module'),
|
||||
@@ -52,6 +158,7 @@ formPanel
|
||||
set::items($moduleOptionMenu)
|
||||
)
|
||||
),
|
||||
$kanbanRow,
|
||||
formRow
|
||||
(
|
||||
formGroup
|
||||
@@ -70,6 +177,7 @@ formPanel
|
||||
set::id('selectTestStoryBox'),
|
||||
setClass('hidden items-center'),
|
||||
checkbox(
|
||||
set::id('selectTestStory'),
|
||||
set::name('selectTestStory'),
|
||||
set::text($lang->task->selectTestStory),
|
||||
set::rootClass('ml-4'),
|
||||
@@ -82,10 +190,14 @@ formPanel
|
||||
formGroup
|
||||
(
|
||||
set::width('1/4'),
|
||||
set::name('assignedTo[]'),
|
||||
set::label($lang->task->assignTo),
|
||||
set::value($task->assignedTo),
|
||||
set::items($members),
|
||||
select
|
||||
(
|
||||
set::id('assignedTo'),
|
||||
set::name('assignedTo[]'),
|
||||
set::value($task->assignedTo),
|
||||
set::items($members),
|
||||
),
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
@@ -112,27 +224,67 @@ formPanel
|
||||
)
|
||||
)
|
||||
),
|
||||
formGroup
|
||||
formRow
|
||||
(
|
||||
set::width('1/2'),
|
||||
set::name('story'),
|
||||
set::label($lang->task->story),
|
||||
set::value($task->story),
|
||||
set::items($stories),
|
||||
setClass($hideStory ? 'hidden' : ''),
|
||||
formGroup
|
||||
(
|
||||
set::label($lang->task->story),
|
||||
setClass(empty($stories) ? 'hidden' : ''),
|
||||
inputGroup
|
||||
(
|
||||
select
|
||||
(
|
||||
set::id('story'),
|
||||
set::name('story'),
|
||||
set::value($task->story),
|
||||
set::items($stories),
|
||||
on::change('setStoryRelated'),
|
||||
),
|
||||
$storyPreviewBtn,
|
||||
)
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::label($lang->task->story),
|
||||
setClass(!empty($stories) ? 'hidden' : ''),
|
||||
div
|
||||
(
|
||||
setClass('empty-story-tip input-control has-prefix has-suffix'),
|
||||
$storyEmptyPreTip,
|
||||
input(
|
||||
prop('readonly'),
|
||||
prop('onfocus', 'this.blur()'),
|
||||
),
|
||||
span
|
||||
(
|
||||
setClass('input-control-suffix'),
|
||||
btn(
|
||||
setClass('text-gray'),
|
||||
set::id('refreshStories'),
|
||||
set::icon('refresh'),
|
||||
on::click('loadExecutionStories'),
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
formRow
|
||||
(
|
||||
formGroup
|
||||
(
|
||||
set::width('3/4'),
|
||||
set::label($lang->task->name),
|
||||
set::name('name'),
|
||||
set::value($task->name),
|
||||
set::strong(true),
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::width('1/4'),
|
||||
setClass('no-background'),
|
||||
inputGroup
|
||||
(
|
||||
input
|
||||
(
|
||||
set::name('name'),
|
||||
set::value($task->name),
|
||||
setClass('flex-none w-3/4'),
|
||||
),
|
||||
$lang->task->pri,
|
||||
select
|
||||
(
|
||||
@@ -140,12 +292,14 @@ formPanel
|
||||
set::items($lang->task->priList),
|
||||
),
|
||||
$lang->task->estimate,
|
||||
input
|
||||
inputControl
|
||||
(
|
||||
set::name('estimate'),
|
||||
input(set::name('estimate')),
|
||||
to::suffix($lang->task->suffixHour),
|
||||
set::suffixWidth(20),
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
@@ -188,18 +342,7 @@ formPanel
|
||||
set::name('mailto[]'),
|
||||
set::items($users),
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::width('3/4'),
|
||||
set::label($lang->task->afterSubmit),
|
||||
radioList
|
||||
(
|
||||
set::name('after'),
|
||||
set::value(!empty($task->id) ? 'toTaskList' : 'continueAdding'),
|
||||
set::items($config->task->afterOptions),
|
||||
set::inline(true)
|
||||
),
|
||||
),
|
||||
$afterChoicesRow
|
||||
);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user