* Add project/execution story grade setting.
This commit is contained in:
@@ -843,12 +843,14 @@ class product extends control
|
||||
* 设置需求列表展示的需求等级。
|
||||
* Ajax set show grades.
|
||||
*
|
||||
* @param string $module
|
||||
* @param string $showGrades
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxSetShowGrades(string $storyType, string $showGrades)
|
||||
public function ajaxSetShowGrades(string $module, string $showGrades)
|
||||
{
|
||||
if($showGrades) $this->loadModel('setting')->updateItem("{$this->app->user->account}.$storyType.showGrades", $showGrades);
|
||||
if($showGrades) $this->loadModel('setting')->updateItem("{$this->app->user->account}.$module.showGrades", $showGrades);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -141,7 +141,8 @@ window.setShowGrades = function()
|
||||
const showGrades = $('[name^=showGrades]').zui('picker').$.state.value;
|
||||
if(oldShowGrades == showGrades) return;
|
||||
|
||||
const link = $.createLink('product', 'ajaxSetShowGrades', 'storyType=' + storyType + '&showGrades=' + showGrades);
|
||||
const module = tab == 'product' ? storyType : tab;
|
||||
const link = $.createLink('product', 'ajaxSetShowGrades', 'module=' + module + '&showGrades=' + showGrades);
|
||||
$.get(link, function()
|
||||
{
|
||||
loadCurrentPage();
|
||||
|
||||
@@ -313,16 +313,10 @@ jsVar('modulePairs', $modulePairs);
|
||||
jsVar('storyType', $storyType);
|
||||
jsVar('checkedSummary', $checkedSummary);
|
||||
|
||||
if($isProjectStory and $storyType == 'requirement')
|
||||
{
|
||||
unset($lang->projectstory->featureBar['story']['linkedexecution']);
|
||||
unset($lang->projectstory->featureBar['story']['unlinkedexecution']);
|
||||
}
|
||||
|
||||
$queryMenuLink = createLink($app->rawModule, $app->rawMethod, $projectIDParam . "productID=$productID&branch=$branch&browseType=bySearch¶m={queryID}");
|
||||
featureBar
|
||||
(
|
||||
($showGrade || $storyType != 'story') ? to::leading
|
||||
($showGrade || $storyType != 'story' || $isProjectStory) ? to::leading
|
||||
(
|
||||
picker
|
||||
(
|
||||
|
||||
@@ -1471,9 +1471,8 @@ class productZen extends product
|
||||
$this->view->stories = $stories;
|
||||
$this->view->gradeGroup = $gradeGroup;
|
||||
$this->view->showGrade = count($gradeGroup[$storyType]) > 2;
|
||||
$this->view->gradeMenu = $this->loadModel('story')->getGradeMenu($storyType);
|
||||
$this->view->gradeMenu = $this->loadModel('story')->getGradeMenu($storyType, $project);
|
||||
$this->view->gradePairs = $this->story->getGradePairs($storyType);
|
||||
$this->view->showGrades = isset($this->config->{$storyType}->showGrades) ? $this->config->{$storyType}->showGrades : $this->story->getDefaultShowGrades($this->view->gradeMenu);
|
||||
$this->view->maxGrade = $this->story->getMaxGrade($storyType);
|
||||
$this->view->storyType = $storyType;
|
||||
$this->view->browseType = $browseType;
|
||||
@@ -1485,6 +1484,9 @@ class productZen extends product
|
||||
$this->view->branchTagOption = $branchTagOpt;
|
||||
$this->view->projectProducts = $projectProducts;
|
||||
|
||||
$module = $this->app->tab == 'product' ? $storyType : $this->app->tab;
|
||||
$this->view->showGrades = isset($this->config->{$module}->showGrades) ? $this->config->{$module}->showGrades : $this->story->getDefaultShowGrades($this->view->gradeMenu);
|
||||
|
||||
$storyType = $isProjectStory ? 'all' : $storyType;
|
||||
$this->view->summary = $this->product->summary($stories, $storyType);
|
||||
$this->view->plans = $this->loadModel('productplan')->getPairs($productID, ($branch === 'all' || empty($branch)) ? '' : $branch, 'unexpired,noclosed', true);
|
||||
|
||||
@@ -5073,13 +5073,18 @@ class storyModel extends model
|
||||
* Get grade menu in story list.
|
||||
*
|
||||
* @param string $storyType
|
||||
* @param object $project
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getGradeMenu(string $storyType): array
|
||||
public function getGradeMenu(string $storyType, object $project = null): array
|
||||
{
|
||||
$storyTypes = isset($project->storyType) ? explode(',', $project->storyType) : array();
|
||||
$showEpic = $storyType == 'epic' || in_array('epic', $storyTypes);
|
||||
$showRequirement = $showEpic || $storyType == 'requirement' || in_array('requirement', $storyTypes);
|
||||
|
||||
$menu = array();
|
||||
if($storyType == 'epic')
|
||||
if($showEpic)
|
||||
{
|
||||
$items = array();
|
||||
$gradePairs = $this->getGradePairs('epic', 'all');
|
||||
@@ -5087,7 +5092,7 @@ class storyModel extends model
|
||||
$menu[] = array('text' => $this->lang->preview . $this->lang->ERCommon, 'value' => 'epic', 'items' => $items);
|
||||
}
|
||||
|
||||
if($storyType == 'requirement' || $storyType == 'epic')
|
||||
if($showRequirement)
|
||||
{
|
||||
$items = array();
|
||||
$gradePairs = $this->getGradePairs('requirement', 'all');
|
||||
|
||||
Reference in New Issue
Block a user