diff --git a/module/bug/control.php b/module/bug/control.php index e0da9901d7..f383f77f08 100755 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -1185,7 +1185,6 @@ class bug extends control $this->view->moduleOptionMenu = $moduleOptionMenu; $this->view->currentModuleID = $currentModuleID; $this->view->executions = $executions; - $this->view->stories = $bug->execution ? $this->story->getExecutionStoryPairs($bug->execution) : $this->story->getProductStoryPairs($bug->product, $bug->branch, 0, 'all', 'id_desc', 0, 'full', 'story', false); $this->view->branchOption = $branchOption; $this->view->branchTagOption = $branchTagOption; $this->view->tasks = $this->task->getExecutionTaskPairs($bug->execution); @@ -1202,7 +1201,7 @@ class bug extends control * * @param int $bugID * @access public - * @return 1 + * @return int */ public function ajaxGetAllBuilds($bugID) { @@ -1254,7 +1253,7 @@ class bug extends control * * @param int $bugID * @access public - * @return 1 + * @return int */ public function ajaxGetTestTasks($bugID) { @@ -1265,6 +1264,23 @@ class bug extends control return print(helper::jsonEncode($testTasks)); } + /** + * Ajax get stories. + * + * @param int $bugID + * @access public + * @return int + */ + public function ajaxGetStories($bugID) + { + $bug = $this->bug->getById($bugID); + $stories = $bug->execution ? $this->story->getExecutionStoryPairs($bug->execution) : $this->story->getProductStoryPairs($bug->product, $bug->branch, 0, 'all', 'id_desc', 0, 'full', 'story', false); + if(isset($stories[0])) unset($stories[0]); + $stories = $this->bug->convertArrayToObjectArray($stories); + + return print(helper::jsonEncode($stories)); + } + /** * Batch edit bug. * diff --git a/module/bug/js/common.js b/module/bug/js/common.js index 5c2ab06066..cc77ae25bf 100644 --- a/module/bug/js/common.js +++ b/module/bug/js/common.js @@ -319,7 +319,7 @@ function loadProductStories(productID) if(typeof(branch) == 'undefined') branch = 0; if(typeof(oldStoryID) == 'undefined') oldStoryID = 0; link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branch + '&moduleId=0&storyID=' + oldStoryID); - $('#storyIdBox').load(link, function(){$('#story').chosen();}); + $('#storyIdBox').load(link, function(){$('#story').picker();}); } /** @@ -773,7 +773,7 @@ function setStories(moduleID, productID, storyID) $('#story').replaceWith(stories); $('#story_chosen').remove(); $('#story').next('.picker').remove(); - $("#story").chosen(); + $("#story").picker(); }); } diff --git a/module/bug/js/edit.js b/module/bug/js/edit.js index 509d40112e..65b81da550 100644 --- a/module/bug/js/edit.js +++ b/module/bug/js/edit.js @@ -17,6 +17,7 @@ $(function() initPicker($('#duplicateBug')); renderBuilds(); renderTestTasks(); + renderStories(); $('#duplicateBug').picker( { @@ -98,6 +99,22 @@ function renderTestTasks() }, 'json'); } +/** + * render stories. + * + * @access public + * @return void + */ +function renderStories() +{ + $.get(createLink('bug', 'ajaxGetStories', 'bugID=' + bugID), function(data) + { + $('#story').data('zui.picker').destroy(); + $('#story').picker({list: data, allowSingleDeselect: 'true'}); + $('#story').data('zui.picker').setValue(oldStoryID); + }, 'json'); +} + /** * Set duplicate field. * diff --git a/module/bug/view/edit.html.php b/module/bug/view/edit.html.php index f538071be9..327884b86b 100644 --- a/module/bug/view/edit.html.php +++ b/module/bug/view/edit.html.php @@ -221,7 +221,7 @@ if($this->app->tab == 'project') js::set('objectID', $bug->project);