-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathinit.rb
More file actions
72 lines (61 loc) · 2.53 KB
/
init.rb
File metadata and controls
72 lines (61 loc) · 2.53 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
69
70
71
72
# redmine_pastebin -- A real pastebin plugin for Redmine.
#
# Copyright (C) 2011 Alex Shuglin <ash@commandprompt.com>
#
# 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'
require 'dispatcher'
Dispatcher.to_prepare :redmine_model_dependencies do
require_dependency 'project'
require_dependency 'user'
unless Project.included_modules.include? RedminePastebin::ProjectPastesPatch
Project.send(:include, RedminePastebin::ProjectPastesPatch)
end
unless User.included_modules.include? RedminePastebin::UserPastesPatch
User.send(:include, RedminePastebin::UserPastesPatch)
end
end
Redmine::Plugin.register :redmine_pastebin do
name 'Redmine Pastebin plugin'
author 'Alex Shulgin <ash@commandprompt.com>'
description 'A real pastebin plugin for redmine'
version '0.0.1'
url 'https://github.com/commandprompt/redmine_pastebin/'
# author_url 'http://example.com/about'
requires_redmine :version_or_higher => '1.1.0'
project_module :pastes do
permission :view_pastes, :pastes => [:index, :show]
permission :add_pastes, :pastes => [:new, :create]
permission :edit_pastes, :pastes => [:edit, :update]
permission :delete_pastes, :pastes => [:destroy]
end
menu :application_menu, :pastes,
{ :controller => 'pastes', :action => 'index' },
:caption => :label_paste_all,
:if => Proc.new{ User.current.admin? }
menu :project_menu, :pastes, { :controller => 'pastes', :action => 'index' },
:caption => :label_paste_plural, :after => :label_wiki,
:param => :project_id
# removed new pasted link from project tab to link in pastes tab
# menu :project_menu, :new_paste, { :controller => 'pastes', :action => 'new' },
# :caption => :label_paste_new, :after => :label_paste_plural,
# :param => :project_id
end
Redmine::Activity.map do |activity|
activity.register :pastes
end
Redmine::Search.map do |search|
search.register :pastes
end