forked from planio-gmbh/redmine_newissuealerts
-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.rb
46 lines (41 loc) · 2.21 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
38
39
40
41
42
43
44
45
46
require 'redmine'
# Patches to the Redmine core.
require 'dispatcher'
Dispatcher.to_prepare :redmine_newissuealerts do
require_dependency 'issue'
# Guards against including the module multiple time (like in tests)
# and registering multiple callbacks
unless Issue.included_modules.include? RedmineNewissuealerts::IssuePatch
Issue.send(:include, RedmineNewissuealerts::IssuePatch)
end
require_dependency 'projects_helper'
unless ProjectsHelper.included_modules.include? RedmineNewissuealerts::ProjectsHelperPatch
ProjectsHelper.send(:include, RedmineNewissuealerts::ProjectsHelperPatch)
end
end
# It requires the file in lib/redmine_newissuealerts/hooks.rb
require_dependency 'redmine_newissuealerts/hooks'
Redmine::Plugin.register :redmine_newissuealerts do
name 'Redmine Newissuealerts plugin'
author 'Emmanuel Bretelle'
description 'Send an email to a list of addresses when a new issue is created'
version '0.0.2'
author_url 'http://www.debuntu.org'
url 'http://redmine.debuntu.org/projects/redmine-newissuealerts'
# This plugin adds a project module
# It can be enabled/disabled at project level (Project settings -> Modules)
project_module :newissuealerts do
# These permissions has to be explicitly given
# They will be listed on the permissions screen
#
# The commented line will make all elements public
#permission :newissuealerts, {:newissuealerts => [:index, :edit, :new]}, :public => true
#permission :view_newissuealerts, :newissuealerts => :index
permission :edit_newissuealerts, {:projects => :settings, :newissuealerts => [:index, :edit]}, :require => :member
permission :new_newissuealerts, {:projects => :settings, :newissuealerts => [:index, :new]}, :require => :member
permission :view_newissuealerts, {:projects => :settings, :newissuealerts => :index}, :require => :member
end
# A new item is added to the project menu
#menu :project_menu, :newissuealerts, { :controller => 'newissuealerts', :action => 'index' }, :caption => 'New Issue Alerts', :after => :activity, :param => :project_id
#menu :project_menu, :newissuealerts, { :controller => 'newissuealerts', :action => 'index' }, :caption => :newissuealert_menuitem, :param => :project_id
end