forked from haru/redmine_code_review
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.rb
More file actions
68 lines (62 loc) · 3.32 KB
/
Copy pathinit.rb
File metadata and controls
68 lines (62 loc) · 3.32 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Code Review plugin for Redmine
# Copyright (C) 2009- Haruyuki Iida
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require "redmine"
begin
require "config/initializers/session_store.rb"
rescue LoadError
end
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/lib"
require "code_review_application_hooks"
require "code_review_change_patch"
require "code_review_changeset_patch"
require "code_review_issue_patch"
require "code_review_issue_hooks"
require "code_review_projects_helper_patch"
require "code_review_attachment_patch"
Redmine::Plugin.register :redmine_code_review do
name "Redmine Code Review plugin"
author "Haruyuki Iida"
author_url "http://twitter.com/haru_iida"
url "http://www.redmine.org/plugins/redmine_code_review" if respond_to?(:url)
description "This is a Code Review plugin for Redmine"
version "1.2.2"
requires_redmine :version_or_higher => "6.0.0"
project_module :code_review do
permission :view_code_review, { :code_review => [:update_diff_view, :update_attachment_view, :update_revisions_view, :index, :show] }, { :read => true }
permission :add_code_review, { :code_review => [:new, :reply, :forward_to_revision, :preview] }, :require => :member
permission :edit_code_review, { :code_review => [:update] }, :require => :member
permission :delete_code_review, { :code_review => [:destroy] }, :require => :member
permission :assign_code_review, { :code_review => [:assign] }, :require => :member
permission :code_review_setting, { :code_review_settings => [:show, :update, :add_filter, :edit_filter, :sort] }, :require => :member
end
menu :project_menu, :code_review, { :controller => "code_review", :action => "index" }, :caption => :code_reviews,
:if => Proc.new { |project|
setting = CodeReviewProjectSetting.find_or_create(project)
project.repository != nil and setting and !setting.hide_code_review_tab
}, :after => :repository
Redmine::WikiFormatting::Macros.register do
desc "This is my macro link to code review"
macro :review do |obj, args|
return nil if args.length == 0
review_id = args[0].to_i
return nil if review_id == 0
review = CodeReview.find(review_id)
return nil unless review
link_to(l(:label_review) + "#" + review.id.to_s, :controller => "code_review", :action => "show", :id => review.project, :review_id => review.id)
end
end
end