diff --git a/README.md b/README.md index c86379b..b0f1034 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ This plugin provide accordion to subtask list of issue. +* http://www.redmine.org/plugins/redmine_subtask_list_accordion + ## Features * Add accordion feature to subtask-list. @@ -14,6 +16,7 @@ Redmine 3.3 stable Tested on: * 3.3.2 +* 3.3.3 ## Installation diff --git a/assets/javascripts/subtask_list_accordion.js b/assets/javascripts/subtask_list_accordion.js index 779b1f2..7572045 100644 --- a/assets/javascripts/subtask_list_accordion.js +++ b/assets/javascripts/subtask_list_accordion.js @@ -15,18 +15,20 @@ function getParentIssue(startPos, rank, sameTreeOnly) var issuesSelector = "table.list > tbody > tr"; var rankAttr = rank <= 0 ? ":not(.idnt)" : "tr.idnt-" + rank; var nextAttr = "tr.idnt-" + (rank + 1 - 0); - var selectorP = ":gt(" + startPos.val + ")" + rankAttr; + var selectorP = (startPos.val + rank) > 0 ? ":gt(" + startPos.val + ")" + rankAttr : rankAttr; var selectorC = nextAttr + ":first"; var pp = $(issuesSelector + selectorP + " + " + selectorC); + if (pp.size() != 1) { + //no parent return $(); } - + //get parent startPos.val = pp.index() - 1; return slaTRs.filter(function(index){ - return index == pp.index() - 1; + return index == startPos.val; }); } @@ -65,7 +67,7 @@ function getChildIssues(startPos, rank) break; } } - while (cc < slaTRsSize) + while (cc < slaTRsSize); startPos.val = endIdx; return slaTRs.filter(function(index){ return index >= startIdx && index <= endIdx; }); @@ -208,13 +210,16 @@ function allExpandNext() //make rank for (var rank = 0; rank <= (parentTR.attr("rank") - 0 + 1); rank++) { - var parentFound = false; - var parentPos = { val: 0 }; - do + if (rank > 0) { - parentFound = setAccordion(parentPos, rank, true, false); + var parentFound = false; + var parentPos = { val: 0 }; + do + { + parentFound = setAccordion(parentPos, rank, true, false); + } + while(parentFound); } - while(parentFound); //show if (rank <= (parentTR.attr("rank") - 0)) diff --git a/init.rb b/init.rb index 928bac9..d3e5168 100644 --- a/init.rb +++ b/init.rb @@ -6,7 +6,7 @@ name 'Redmine Subtask List Accordion plugin' author 'Ryuta Tobita' description 'This plugin provide accordion to subtask list of issue.' - version '1.3.0' + version '1.3.1' url 'https://github.com/GEROMAX/redmine_subtask_list_accordion' author_url 'https://github.com/GEROMAX' end