Skip to content

Commit

Permalink
Merge branch 'bugfixFor1.3.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
GEROMAX committed Sep 14, 2017
2 parents 03c4f79 + d15cf44 commit c42ea44
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 48 deletions.
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 @@ -18,7 +18,7 @@
var _contextMenuShow = contextMenuShow;
isHideMenuSla = false;
contextMenuShow = function(event){
if ($(event.target).parents("div[id='relations']").size() == 1)
if ($(event.target).parents("div[id='relations']").size() == 1 || !$("table.list > tbody > tr").is(".idnt-1"))
{
//hide this plugin menu
isHideMenuSla = true;
Expand Down
17 changes: 12 additions & 5 deletions init.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
require "subtask_list_accordion_hook"
require "subtask_list_accordion_helper_patch"
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'

Rails.configuration.to_prepare do
SubtaskListAccordionUserPreferencePatch.apply
ActionDispatch::Callbacks.to_prepare do
unless UserPreference.included_modules.include?(RedmineSubtaskListAccordion::Patches::UserPreferencePatch)
UserPreference.send :prepend, RedmineSubtaskListAccordion::Patches::UserPreferencePatch
end

unless IssuesHelper.included_modules.include?(RedmineSubtaskListAccordion::Patches::IssuesHelperPatch)
IssuesHelper.send :prepend, RedmineSubtaskListAccordion::Patches::IssuesHelperPatch
end
end

Redmine::Plugin.register :redmine_subtask_list_accordion do
name 'Redmine Subtask List Accordion plugin'
author 'Ryuta Tobita'
description 'This plugin provide accordion to subtask list of issue.'
version '1.3.2'
version '1.3.3'
url 'https://github.com/GEROMAX/redmine_subtask_list_accordion'
author_url 'https://github.com/GEROMAX'
end
File renamed without changes.
19 changes: 19 additions & 0 deletions lib/redmine_subtask_list_accordion/patches/issues_helper_patch.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require_dependency("issues_helper")

module RedmineSubtaskListAccordion
module Patches
module IssuesHelperPatch
extend ActiveSupport::Concern

# add method to IssuesHelper
def expand_tree_at_first?(issue, user)
return issue.descendants.visible.count <= user.pref.subtasks_default_expand_limit_upper
end

def has_grandson_issues?(issue)
return issue.descendants.visible.where(["issues.parent_id <> ?", issue.id]).count > 0
end

end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require_dependency 'user_preference'

module RedmineSubtaskListAccordion
module Patches
module UserPreferencePatch

def self.prepended(base)
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

end
end
end
29 changes: 0 additions & 29 deletions lib/subtask_list_accordion_helper_patch.rb

This file was deleted.

13 changes: 0 additions & 13 deletions lib/subtask_list_accordion_user_preference_patch.rb

This file was deleted.

0 comments on commit c42ea44

Please sign in to comment.