* finish task #2776.

This commit is contained in:
wangyidong
2016-11-21 12:03:44 +08:00
parent 21c11b9edb
commit c4e8cef7f8
7 changed files with 65 additions and 10 deletions
+1 -1
View File
@@ -1085,7 +1085,7 @@ class story extends control
*/
public function ajaxGetProjectStories($projectID, $productID = 0, $branch = 0, $moduleID = 0, $storyID = 0, $number = '', $type= 'full')
{
if($moduleID)
if($moduleID)
{
$moduleID = $this->loadModel('tree')->getStoryModule($moduleID);
$moduleID = $this->tree->getAllChildID($moduleID);
+1
View File
@@ -31,6 +31,7 @@ $lang->story->linkStory = 'Link Story';
$lang->story->unlinkStory = 'Unlink Story';
$lang->story->export = "Export Data";
$lang->story->zeroCase = "Zero Case";
$lang->story->zeroTask = "Zero Task";
$lang->story->reportChart = "Report";
$lang->story->batchChangePlan = "Batch Change Planning";
$lang->story->batchChangeBranch = "Batch Change Branch";
+1
View File
@@ -31,6 +31,7 @@ $lang->story->linkStory = '关联需求';
$lang->story->unlinkStory = '移除相关需求';
$lang->story->export = "导出数据";
$lang->story->zeroCase = "零用例需求";
$lang->story->zeroTask = "零任务需求";
$lang->story->reportChart = "统计报表";
$lang->story->batchChangePlan = "批量修改计划";
$lang->story->batchChangeBranch = "批量修改分支";
+9 -8
View File
@@ -199,14 +199,15 @@ class task extends control
$position[] = $this->lang->task->common;
$position[] = $this->lang->task->batchCreate;
$this->view->title = $title;
$this->view->position = $position;
$this->view->project = $project;
$this->view->stories = $stories;
$this->view->modules = $modules;
$this->view->storyID = $storyID;
$this->view->story = $this->loadModel('story')->getByID($storyID);
$this->view->members = $members;
$this->view->title = $title;
$this->view->position = $position;
$this->view->project = $project;
$this->view->stories = $stories;
$this->view->modules = $modules;
$this->view->storyID = $storyID;
$this->view->story = $this->story->getByID($storyID);
$this->view->storyTasks = $this->task->getStoryTaskCounts(array_keys($stories), $projectID);
$this->view->members = $members;
$this->display();
}
+5
View File
@@ -7,3 +7,8 @@
.chosen-container[id^="story"] {width: 200px;}
.chosen-container[id^="story"] .chosen-drop {min-width: 450px;!important}
.chosen-container[id^="module"] .chosen-drop {min-width: 400px;!important}
#zeroTaskStory{background-color: #fafafa; color: #808080; padding: 5px 8px; text-align: center; margin-left: 10px; border: 1px solid #ddd; }
#zeroTaskStory .icon{display:none;}
#zeroTaskStory.zeroTask {background-color: #114f8e; color: #fff; border-color: #114f8e; }
#zeroTaskStory.zeroTask .icon{display:inline;}
+46 -1
View File
@@ -12,8 +12,20 @@ function setStories(moduleID, projectID, num)
var storyID = $('#story' + num).val();
if(!stories) stories = '<select id="story' + num + '" name="story[' + num + ']" class="form-control"></select>';
$('#story' + num).replaceWith(stories);
if(moduleID == 0) $('#story' + num).append("<option value='ditto'>" + ditto + "</option>")
if(moduleID == 0) $('#story' + num).append("<option value='ditto'>" + ditto + "</option>");
$('#story' + num).val(storyID);
if($('#zeroTaskStory').hasClass('zeroTask'))
{
$('#story' + num).find('option').each(function()
{
value = $(this).attr('value');
if(value != 'ditto' && storyTasks[value] > 0)
{
$(this).hide();
if(storyID == value) $('#story' + num).val('');
}
})
}
$("#story" + num + "_chosen").remove();
$("#story" + num).chosen(defaultChosenOptions);
});
@@ -44,6 +56,38 @@ function setStoryRelated(num)
}
}
/* Toggle zero task story. */
function toggleZeroTaskStory()
{
if($('#zeroTaskStory').hasClass('zeroTask'))
{
$('#zeroTaskStory').removeClass('zeroTask');
zeroTask = false;
}
else
{
$('#zeroTaskStory').addClass('zeroTask');
zeroTask = true;
}
$.cookie('zeroTask', zeroTask, {expires:config.cookieLife, path:config.webRoot});
$('select[name^="story"]').each(function()
{
selectVal = $(this).val();
$(this).find('option').each(function()
{
value = $(this).attr('value');
$(this).show();
if(value != 'ditto' && storyTasks[value] > 0 && zeroTask)
{
$(this).hide();
if(selectVal == value) selectVal = '';
}
})
$(this).val(selectVal);
$(this).trigger("chosen:updated");
})
}
$(document).on('click', '.chosen-with-drop', function()
{
var select = $(this).prev('select');
@@ -94,4 +138,5 @@ $(function()
/* Adjust width for ie chosen width. */
$('#module0_chosen').width($('#module1_chosen').width());
$('#story0_chosen').width($('#story1_chosen').width());
if($.cookie('zeroTask') == 'true') toggleZeroTaskStory();
})
+2
View File
@@ -16,6 +16,7 @@
<div class='heading'>
<span class='prefix'><?php echo html::icon($lang->icons['task']);?></span>
<strong><small class='text-muted'><?php echo html::icon($lang->icons['batchCreate']);?></small> <?php echo $lang->task->batchCreate . $lang->task->common;?></strong>
<span><small><a href='javascript:toggleZeroTaskStory();' id='zeroTaskStory'><?php echo $lang->story->zeroTask;?><i class='icon icon-remove'></i></a></small></span>
<div class='actions'>
<?php echo html::commonButton($lang->pasteText, "data-toggle='myModal'")?>
<button type="button" class="btn btn-default" data-toggle="customModal"><i class='icon icon-cog'></i> </button>
@@ -126,6 +127,7 @@ foreach(explode(',', $showFields) as $field)
</tr>
</tbody>
</table>
<?php js::set('storyTasks', $storyTasks);?>
<?php js::set('mainField', 'name');?>
<?php js::set('ditto', $lang->task->ditto);?>
<?php $customLink = $this->createLink('custom', 'ajaxSaveCustomFields', 'module=task&section=custom&key=batchCreateFields')?>