* Add project/execution story grade setting.

This commit is contained in:
sunguangming
2024-04-18 15:00:08 +08:00
parent 62b519574b
commit 2af5c1731e
5 changed files with 19 additions and 15 deletions
+4 -2
View File
@@ -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);
}
/**
+2 -1
View File
@@ -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();
+1 -7
View File
@@ -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&param={queryID}");
featureBar
(
($showGrade || $storyType != 'story') ? to::leading
($showGrade || $storyType != 'story' || $isProjectStory) ? to::leading
(
picker
(
+4 -2
View File
@@ -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);
+8 -3
View File
@@ -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');