redmine_issue_templates/lib/issue_templates_projects_helper_patch.rb
2014-03-29 18:50:41 +09:00

27 lines
767 B
Ruby

require_dependency 'projects_helper'
module IssueTemplatesProjectsHelperPatch
def self.included(base)
base.send(:include, ProjectsHelperMethodsIssueTemplates)
base.class_eval do
alias_method_chain :project_settings_tabs, :issue_templates
end
end
end
module ProjectsHelperMethodsIssueTemplates
# Append tab for issue templates to project settings tabs.
def project_settings_tabs_with_issue_templates
tabs = project_settings_tabs_without_issue_templates
action = {:name => 'issue_templates',
:controller => 'issue_templates_settings',
:action => :show,
:partial => 'issue_templates_settings/show', :label => :issue_templates}
tabs << action if User.current.allowed_to?(action, @project)
tabs
end
end