-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
52 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
19
lib/redmine_subtask_list_accordion/patches/issues_helper_patch.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
20 changes: 20 additions & 0 deletions
20
lib/redmine_subtask_list_accordion/patches/user_preference_patch.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.