Skip to content

support Redmine 5.0 #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/views/issues/_subtask_list_accordion_partial.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
var _contextMenuShow = contextMenuShow;
isHideMenuSla = false;
contextMenuShow = function(event){
if ($(event.target).parents("div[id='relations']").size() == 1 || !$("table.list > tbody > tr").is(".idnt-1"))
if ($(event.target).parents("div[id='relations']").length == 1 || !$("table.list > tbody > tr").is(".idnt-1"))
{
//hide this plugin menu
isHideMenuSla = true;
Expand Down
8 changes: 4 additions & 4 deletions assets/javascripts/subtask_list_accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function childIssueShowOrHide(parentTR)
function seletedTreeOpen()
{
var targetParents = slaTRs.filter("tr:has(td.checkbox > input:checked)");
for (var i = 0; i < targetParents.size(); i++)
for (var i = 0; i < targetParents.length; i++)
{
var parentTR = targetParents.eq(i);
if (!parentTR.hasClass("haschild"))
Expand All @@ -39,7 +39,7 @@ function seletedTreeOpen()
function seletedTreeClose()
{
var targetParents = slaTRs.filter("tr:has(td.checkbox > input:checked)");
for (var i = 0; i < targetParents.size(); i++)
for (var i = 0; i < targetParents.length; i++)
{
var parentTR = targetParents.eq(i);
if (!parentTR.hasClass("haschild"))
Expand All @@ -59,7 +59,7 @@ function seletedTreeClose()
function allExpandNext()
{
var parentTR = slaTRs.filter("tr:has(td.checkbox > input:checked)");
if (parentTR.size() != 1)
if (parentTR.length != 1)
{
exit;
}
Expand Down Expand Up @@ -92,7 +92,7 @@ $(document).ready(function()
slaTRs.show().filter(".haschild").removeClass("collapse").addClass("expand");

//for debug
if (slaTRs.filter("tr:visible").size() != slaTRs.size()) alert("NG");
if (slaTRs.filter("tr:visible").length != slaTRs.length) alert("NG");

return false;
});
Expand Down
14 changes: 7 additions & 7 deletions assets/javascripts/subtask_list_accordion_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function getParentIssue(startPos, rank, sameTreeOnly)
var selectorC = nextAttr + ":first";
var pp = $(issuesSelector + selectorP + " + " + selectorC);

if (pp.size() != 1)
if (pp.length != 1)
{
//no parent
return $();
Expand Down Expand Up @@ -99,7 +99,7 @@ function childIssueShowOrHide(parentTR)
function setAccordion(parentPos, rank, isHiding, sameTreeOnly)
{
var parentTR = getParentIssue(parentPos, rank, sameTreeOnly);
if (parentTR.size() != 1)
if (parentTR.length != 1)
{
return false;
}
Expand Down Expand Up @@ -145,7 +145,7 @@ function setAccordion(parentPos, rank, isHiding, sameTreeOnly)
function seletedTreeOpen()
{
var targetParents = slaTRs.filter("tr:has(td.checkbox > input:checked)");
for (var i = 0; i < targetParents.size(); i++)
for (var i = 0; i < targetParents.length; i++)
{
var parentTR = targetParents.eq(i);
if (!parentTR.hasClass("haschild"))
Expand Down Expand Up @@ -178,7 +178,7 @@ function seletedTreeOpen()
function seletedTreeClose()
{
var targetParents = slaTRs.filter("tr:has(td.checkbox > input:checked)");
for (var i = 0; i < targetParents.size(); i++)
for (var i = 0; i < targetParents.length; i++)
{
var parentTR = targetParents.eq(i);
if (!parentTR.hasClass("haschild"))
Expand All @@ -198,7 +198,7 @@ function seletedTreeClose()
function allExpandNext()
{
var parentTR = slaTRs.filter("tr:has(td.checkbox > input:checked)");
if (parentTR.size() != 1)
if (parentTR.length != 1)
{
exit;
}
Expand Down Expand Up @@ -236,7 +236,7 @@ $(document).ready(function()
var expandTreeAtFirst = window.subtaskListAccordionExpandTreeAtFirst;
//make rank first time
slaTRs = $("table.list > tbody > tr");
slaTRsSize = slaTRs.size();
slaTRsSize = slaTRs.length;
var analyzeTo = expandTreeAtFirst ? 10 : 1;
var isHiding = !expandTreeAtFirst;
var isSameTreeOnly = isHiding;
Expand Down Expand Up @@ -268,7 +268,7 @@ $(document).ready(function()
slaTRs.show().filter(".haschild").removeClass("collapse").addClass("expand");

//for debug
if (slaTRs.filter("tr:visible").size() != slaTRsSize)
if (slaTRs.filter("tr:visible").length != slaTRsSize)
{
alert("NG");
}
Expand Down
6 changes: 3 additions & 3 deletions init.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require_dependency 'redmine_subtask_list_accordion/hooks/subtask_list_accordion_hook'
require_dependency 'redmine_subtask_list_accordion/patches/issues_helper_patch'
require_dependency 'redmine_subtask_list_accordion/patches/user_preference_patch'
require_dependency File.expand_path('../lib/redmine_subtask_list_accordion/hooks/subtask_list_accordion_hook', __FILE__)
require_dependency File.expand_path('../lib/redmine_subtask_list_accordion/patches/issues_helper_patch', __FILE__)
require_dependency File.expand_path('../lib/redmine_subtask_list_accordion/patches/user_preference_patch', __FILE__)

reloader = defined?(ActiveSupport::Reloader) ? ActiveSupport::Reloader : ActionDispatch::Reloader
reloader.to_prepare do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
class SubtaskListAccordionHook < Redmine::Hook::ViewListener
render_on :view_issues_show_description_bottom, :partial => 'issues/subtask_list_accordion_partial'
render_on :view_my_account_preferences, :partial => 'my/subtask_list_accordion_preferences'

def view_issues_context_menu_start(context={})
if isIssuePage?(context[:back])
context[:controller].send(:render_to_string, {
:partial => "context_menus/accordion_menu",
:locals => context
})
module RedmineSubtaskListAccordion
module Hooks
class SubtaskListAccordionHook < Redmine::Hook::ViewListener
render_on :view_issues_show_description_bottom, :partial => 'issues/subtask_list_accordion_partial'
render_on :view_my_account_preferences, :partial => 'my/subtask_list_accordion_preferences'

def view_issues_context_menu_start(context={})
if isIssuePage?(context[:back])
context[:controller].send(:render_to_string, {
:partial => "context_menus/accordion_menu",
:locals => context
})
end
end

private
def isIssuePage?(path)
path =~ Regexp.new("issues/+[0-9]")
end
end
end

private
def isIssuePage?(path)
path =~ Regexp.new("issues/+[0-9]")
end
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require_dependency("issues_helper")
require_dependency 'issues_helper'

module RedmineSubtaskListAccordion
module Patches
Expand Down Expand Up @@ -108,3 +108,5 @@ def sla_use_css
end
end
end

IssuesController.send :helper, RedmineSubtaskListAccordion::Patches::IssuesHelperPatch
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,22 @@ module Patches
module UserPreferencePatch

def self.prepended(base)
base.send(:include, InstanceMethods)
base.class_eval do
if defined? safe_attributes
safe_attributes :subtasks_default_expand_limit_upper
end
end
end

def subtasks_default_expand_limit_upper; (self[:subtasks_default_expand_limit_upper] || 0).to_i; end
def subtasks_default_expand_limit_upper=(val); self[:subtasks_default_expand_limit_upper] = val; end


module InstanceMethods
def subtasks_default_expand_limit_upper; (self[:subtasks_default_expand_limit_upper] || 0).to_i; end
def subtasks_default_expand_limit_upper=(val); self[:subtasks_default_expand_limit_upper] = val; end
end
end
end
end

base = UserPreference
patch = RedmineSubtaskListAccordion::Patches::UserPreferencePatch
base.send(:prepend, patch) unless base.included_modules.include?(patch)