-
Notifications
You must be signed in to change notification settings - Fork 11
/
init.rb
37 lines (35 loc) · 1.76 KB
/
init.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require 'redmine'
require_relative 'lib/redmine_templates/hooks'
Redmine::Plugin.register :redmine_templates do
name 'Redmine Issue Templates plugin'
description 'This plugin add the ability to create and use issue templates.'
author 'Vincent ROBERT'
author_url 'mailto:[email protected]'
version '0.1'
url 'https://github.com/nanego/redmine_templates'
requires_redmine :version_or_higher => '2.5.0'
requires_redmine_plugin :redmine_base_deface, :version_or_higher => '0.0.1'
requires_redmine_plugin :redmine_base_stimulusjs, :version_or_higher => '1.1.1'
permission :create_issue_templates, {:issue_templates => [:init, :new, :create, :edit, :copy, :update, :index, :destroy]}
permission :manage_project_issue_templates, {}
permission :manage_issue_templates_visibility_per_project, {}
settings :default => {'custom_fields' => [], 'disable_templates' => false},
:partial => 'settings/redmine_plugin_templates_settings'
menu :admin_menu, :issue_templates, '/issue_templates',
:caption => :label_issue_templates,
:html => {:class => 'icon'}
end
Redmine::MenuManager.map :project_menu do |menu|
menu.push :new_issue_sub, {:controller => 'issues', :action => 'new', :copy_from => nil},
:param => :project_id,
:caption => :label_other_issue,
:html => {:accesskey => Redmine::AccessKeys.key_for(:new_issue)},
:if => Proc.new {|p| Issue.allowed_target_trackers(p).any? &&
p.present? &&
p.issue_templates.present? &&
p.issue_templates.present? &&
(Issue.allowed_target_trackers(p) & p.issue_templates.map(&:tracker)).any?},
:permission => :add_issues,
:parent => :new_issue,
:last => true
end