Feature #32938 » alt-0002-Move-preparation-code-to-redmine-preparation.rb.patch
config/initializers/10-patches.rb | ||
---|---|---|
1 | 1 |
# frozen_string_literal: true |
2 | 2 | |
3 | 3 |
require 'active_record' |
4 |
require 'redmine/i18n' |
|
4 | 5 | |
5 | 6 |
module ActiveRecord |
6 | 7 |
class Base |
config/initializers/30-redmine.rb | ||
---|---|---|
1 | 1 |
# frozen_string_literal: true |
2 | 2 | |
3 |
require 'redmine/i18n' |
|
4 |
require 'redmine/configuration' |
|
5 |
require 'redmine/plugin_loader' |
|
6 | ||
3 | 7 |
I18n.backend = Redmine::I18n::Backend.new |
4 | 8 |
# Forces I18n to load available locales from the backend |
5 | 9 |
I18n.config.available_locales = nil |
6 | 10 | |
7 |
require 'redmine' |
|
8 |
require 'redmine/plugin_loader' |
|
11 |
Rails.application.config.to_prepare do |
|
12 |
Redmine::Preparation.prepare |
|
13 |
end |
|
9 | 14 | |
10 | 15 |
# Load the secret token from the Redmine configuration file |
11 | 16 |
secret = Redmine::Configuration['secret_token'] |
lib/redmine.rb | ||
---|---|---|
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 | 20 |
require 'redmine/core_ext' |
21 |
require 'diff' |
|
21 | 22 | |
22 | 23 |
begin |
23 | 24 |
require 'mini_magick' unless Object.const_defined?(:MiniMagick) |
... | ... | |
35 | 36 |
# CommonMarker is not available |
36 | 37 |
end |
37 | 38 | |
38 |
require 'redmine/acts/positioned' |
|
39 | ||
40 |
require 'redmine/scm/base' |
|
41 |
require 'redmine/access_control' |
|
42 |
require 'redmine/access_keys' |
|
43 |
require 'redmine/activity' |
|
44 |
require 'redmine/activity/fetcher' |
|
45 |
require 'redmine/ciphering' |
|
46 |
require 'redmine/codeset_util' |
|
47 |
require 'redmine/field_format' |
|
48 |
require 'redmine/info' |
|
49 |
require 'redmine/menu_manager' |
|
50 |
require 'redmine/notifiable' |
|
51 |
require 'redmine/platform' |
|
52 |
require 'redmine/project_jump_box' |
|
53 |
require 'redmine/mime_type' |
|
54 |
require 'redmine/search' |
|
55 |
require 'redmine/sort_criteria' |
|
56 |
require 'redmine/syntax_highlighting' |
|
57 |
require 'redmine/thumbnail' |
|
58 |
require 'redmine/unified_diff' |
|
59 |
require 'redmine/utils' |
|
60 |
require 'redmine/version' |
|
61 |
require 'redmine/wiki_formatting/links_helper' |
|
62 |
require 'redmine/wiki_formatting' |
|
63 | ||
64 |
require 'redmine/default_data/loader' |
|
65 |
require 'redmine/helpers/calendar' |
|
66 |
require 'redmine/helpers/diff' |
|
67 |
require 'redmine/helpers/gantt' |
|
68 |
require 'redmine/helpers/time_report' |
|
69 |
require 'redmine/views/other_formats_builder' |
|
70 |
require 'redmine/views/labelled_form_builder' |
|
71 |
require 'redmine/views/builders' |
|
72 | ||
73 |
require 'redmine/themes' |
|
74 |
require 'redmine/hook' |
|
75 |
require 'redmine/hook/listener' |
|
76 |
require 'redmine/hook/view_listener' |
|
77 |
require 'redmine/plugin' |
|
78 |
require 'redmine/twofa' |
|
79 | ||
80 |
Redmine::Scm::Base.add "Subversion" |
|
81 |
Redmine::Scm::Base.add "Mercurial" |
|
82 |
Redmine::Scm::Base.add "Cvs" |
|
83 |
Redmine::Scm::Base.add "Bazaar" |
|
84 |
Redmine::Scm::Base.add "Git" |
|
85 |
Redmine::Scm::Base.add "Filesystem" |
|
86 | ||
87 |
# Permissions |
|
88 |
Redmine::AccessControl.map do |map| |
|
89 |
map.permission :view_project, {:projects => [:show, :bookmark], :activities => [:index]}, :public => true, :read => true |
|
90 |
map.permission :search_project, {:search => :index}, :public => true, :read => true |
|
91 |
map.permission :add_project, {:projects => [:new, :create]}, :require => :loggedin |
|
92 |
map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member |
|
93 |
map.permission :close_project, {:projects => [:close, :reopen]}, :require => :member, :read => true |
|
94 |
map.permission :delete_project, {:projects => :destroy}, :require => :member, :read => true |
|
95 |
map.permission :select_project_modules, {:projects => :modules}, :require => :member |
|
96 |
map.permission :view_members, {:members => [:index, :show]}, :public => true, :read => true |
|
97 |
map.permission :manage_members, {:projects => :settings, :members => [:index, :show, :new, :create, :edit, :update, :destroy, :autocomplete]}, :require => :member |
|
98 |
map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member |
|
99 |
map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member |
|
100 |
# Queries |
|
101 |
map.permission :manage_public_queries, {:queries => [:new, :create, :edit, :update, :destroy]}, :require => :member |
|
102 |
map.permission :save_queries, {:queries => [:new, :create, :edit, :update, :destroy]}, :require => :loggedin |
|
103 | ||
104 |
map.project_module :issue_tracking do |map| |
|
105 |
# Issues |
|
106 |
map.permission :view_issues, {:issues => [:index, :show, :issue_tab], |
|
107 |
:auto_complete => [:issues], |
|
108 |
:context_menus => [:issues], |
|
109 |
:versions => [:index, :show, :status_by], |
|
110 |
:journals => [:index, :diff], |
|
111 |
:queries => :index, |
|
112 |
:reports => [:issue_report, :issue_report_details]}, |
|
113 |
:read => true |
|
114 |
map.permission :add_issues, {:issues => [:new, :create], :attachments => :upload} |
|
115 |
map.permission :edit_issues, {:issues => [:edit, :update, :bulk_edit, :bulk_update], :journals => [:new], :attachments => :upload} |
|
116 |
map.permission :edit_own_issues, {:issues => [:edit, :update, :bulk_edit, :bulk_update], :journals => [:new], :attachments => :upload} |
|
117 |
map.permission :copy_issues, {:issues => [:new, :create, :bulk_edit, :bulk_update], :attachments => :upload} |
|
118 |
map.permission :manage_issue_relations, {:issue_relations => [:index, :show, :create, :destroy]} |
|
119 |
map.permission :manage_subtasks, {} |
|
120 |
map.permission :set_issues_private, {} |
|
121 |
map.permission :set_own_issues_private, {}, :require => :loggedin |
|
122 |
map.permission :add_issue_notes, {:issues => [:edit, :update], :journals => [:new], :attachments => :upload} |
|
123 |
map.permission :edit_issue_notes, {:journals => [:edit, :update]}, :require => :loggedin |
|
124 |
map.permission :edit_own_issue_notes, {:journals => [:edit, :update]}, :require => :loggedin |
|
125 |
map.permission :view_private_notes, {}, :read => true, :require => :member |
|
126 |
map.permission :set_notes_private, {}, :require => :member |
|
127 |
map.permission :delete_issues, {:issues => :destroy}, :require => :member |
|
128 |
# Watchers |
|
129 |
map.permission :view_issue_watchers, {}, :read => true |
|
130 |
map.permission :add_issue_watchers, {:watchers => [:new, :create, :append, :autocomplete_for_user]} |
|
131 |
map.permission :delete_issue_watchers, {:watchers => :destroy} |
|
132 |
map.permission :import_issues, {} |
|
133 |
# Issue categories |
|
134 |
map.permission :manage_categories, {:projects => :settings, :issue_categories => [:index, :show, :new, :create, :edit, :update, :destroy]}, :require => :member |
|
135 |
end |
|
136 | ||
137 |
map.project_module :time_tracking do |map| |
|
138 |
map.permission :view_time_entries, {:timelog => [:index, :report, :show]}, :read => true |
|
139 |
map.permission :log_time, {:timelog => [:new, :create]}, :require => :loggedin |
|
140 |
map.permission :edit_time_entries, |
|
141 |
{:timelog => [:edit, :update, :destroy, :bulk_edit, :bulk_update]}, |
|
142 |
:require => :member |
|
143 |
map.permission :edit_own_time_entries, |
|
144 |
{:timelog => [:edit, :update, :destroy, :bulk_edit, :bulk_update]}, |
|
145 |
:require => :loggedin |
|
146 |
map.permission :manage_project_activities, |
|
147 |
{:projects => :settings, :project_enumerations => [:update, :destroy]}, |
|
148 |
:require => :member |
|
149 |
map.permission :log_time_for_other_users, :require => :member |
|
150 |
map.permission :import_time_entries, {} |
|
151 |
end |
|
152 | ||
153 |
map.project_module :news do |map| |
|
154 |
map.permission :view_news, {:news => [:index, :show]}, :read => true |
|
155 |
map.permission :manage_news, {:news => [:new, :create, :edit, :update, :destroy], :comments => [:destroy], :attachments => :upload}, :require => :member |
|
156 |
map.permission :comment_news, {:comments => :create} |
|
157 |
end |
|
158 | ||
159 |
map.project_module :documents do |map| |
|
160 |
map.permission :view_documents, {:documents => [:index, :show, :download]}, :read => true |
|
161 |
map.permission :add_documents, {:documents => [:new, :create, :add_attachment], :attachments => :upload}, :require => :loggedin |
|
162 |
map.permission :edit_documents, {:documents => [:edit, :update, :add_attachment], :attachments => :upload}, :require => :loggedin |
|
163 |
map.permission :delete_documents, {:documents => [:destroy]}, :require => :loggedin |
|
164 |
end |
|
165 | ||
166 |
map.project_module :files do |map| |
|
167 |
map.permission :view_files, {:files => :index, :versions => :download}, :read => true |
|
168 |
map.permission :manage_files, {:files => [:new, :create], :attachments => :upload}, :require => :loggedin |
|
169 |
end |
|
170 | ||
171 |
map.project_module :wiki do |map| |
|
172 |
map.permission :view_wiki_pages, {:wiki => [:index, :show, :special, :date_index], :auto_complete => [:wiki_pages]}, :read => true |
|
173 |
map.permission :view_wiki_edits, {:wiki => [:history, :diff, :annotate]}, :read => true |
|
174 |
map.permission :export_wiki_pages, {:wiki => [:export]}, :read => true |
|
175 |
map.permission :edit_wiki_pages, :wiki => [:new, :edit, :update, :preview, :add_attachment], :attachments => :upload |
|
176 |
map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member |
|
177 |
map.permission :delete_wiki_pages, {:wiki => [:destroy, :destroy_version]}, :require => :member |
|
178 |
map.permission :delete_wiki_pages_attachments, {} |
|
179 |
map.permission :view_wiki_page_watchers, {}, :read => true |
|
180 |
map.permission :add_wiki_page_watchers, {:watchers => [:new, :create, :autocomplete_for_user]} |
|
181 |
map.permission :delete_wiki_page_watchers, {:watchers => :destroy} |
|
182 |
map.permission :protect_wiki_pages, {:wiki => :protect}, :require => :member |
|
183 |
map.permission :manage_wiki, {:wikis => :destroy, :wiki => :rename}, :require => :member |
|
184 |
end |
|
185 | ||
186 |
map.project_module :repository do |map| |
|
187 |
map.permission :view_changesets, {:repositories => [:show, :revisions, :revision]}, :read => true |
|
188 |
map.permission :browse_repository, {:repositories => [:show, :browse, :entry, :raw, :annotate, :changes, :diff, :stats, :graph]}, :read => true |
|
189 |
map.permission :commit_access, {} |
|
190 |
map.permission :manage_related_issues, {:repositories => [:add_related_issue, :remove_related_issue]} |
|
191 |
map.permission :manage_repository, {:projects => :settings, :repositories => [:new, :create, :edit, :update, :committers, :destroy, :fetch_changesets]}, :require => :member |
|
192 |
end |
|
193 | ||
194 |
map.project_module :boards do |map| |
|
195 |
map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :read => true |
|
196 |
map.permission :add_messages, {:messages => [:new, :reply, :quote], :attachments => :upload} |
|
197 |
map.permission :edit_messages, {:messages => :edit, :attachments => :upload}, :require => :member |
|
198 |
map.permission :edit_own_messages, {:messages => :edit, :attachments => :upload}, :require => :loggedin |
|
199 |
map.permission :delete_messages, {:messages => :destroy}, :require => :member |
|
200 |
map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin |
|
201 |
map.permission :view_message_watchers, {}, :read => true |
|
202 |
map.permission :add_message_watchers, {:watchers => [:new, :create, :autocomplete_for_user]} |
|
203 |
map.permission :delete_message_watchers, {:watchers => :destroy} |
|
204 |
map.permission :manage_boards, {:projects => :settings, :boards => [:new, :create, :edit, :update, :destroy]}, :require => :member |
|
205 |
end |
|
206 | ||
207 |
map.project_module :calendar do |map| |
|
208 |
map.permission :view_calendar, {:calendars => [:show, :update]}, :read => true |
|
209 |
end |
|
210 | ||
211 |
map.project_module :gantt do |map| |
|
212 |
map.permission :view_gantt, {:gantts => [:show, :update]}, :read => true |
|
213 |
end |
|
214 |
end |
|
215 | ||
216 |
Redmine::MenuManager.map :top_menu do |menu| |
|
217 |
menu.push :home, :home_path |
|
218 |
menu.push :my_page, {:controller => 'my', :action => 'page'}, |
|
219 |
:if => Proc.new {User.current.logged?} |
|
220 |
menu.push :projects, {:controller => 'projects', :action => 'index'}, |
|
221 |
:caption => :label_project_plural |
|
222 |
menu.push :administration, {:controller => 'admin', :action => 'index'}, |
|
223 |
:if => Proc.new {User.current.admin?}, :last => true |
|
224 |
menu.push :help, Redmine::Info.help_url, :last => true |
|
39 |
module Redmine |
|
225 | 40 |
end |
226 | ||
227 |
Redmine::MenuManager.map :account_menu do |menu| |
|
228 |
menu.push :login, :signin_path, :if => Proc.new {!User.current.logged?} |
|
229 |
menu.push :register, :register_path, |
|
230 |
:if => Proc.new {!User.current.logged? && Setting.self_registration?} |
|
231 |
menu.push :my_account, {:controller => 'my', :action => 'account'}, |
|
232 |
:if => Proc.new {User.current.logged?} |
|
233 |
menu.push :logout, :signout_path, :html => {:method => 'post'}, |
|
234 |
:if => Proc.new {User.current.logged?} |
|
235 |
end |
|
236 | ||
237 |
Redmine::MenuManager.map :application_menu do |menu| |
|
238 |
menu.push :projects, {:controller => 'projects', :action => 'index'}, |
|
239 |
:permission => nil, |
|
240 |
:caption => :label_project_plural |
|
241 |
menu.push :activity, {:controller => 'activities', :action => 'index', :id => nil} |
|
242 |
menu.push( |
|
243 |
:issues, |
|
244 |
{:controller => 'issues', :action => 'index'}, |
|
245 |
:if => |
|
246 |
Proc.new do |
|
247 |
User.current.allowed_to?(:view_issues, nil, :global => true) && |
|
248 |
EnabledModule.exists?(:project => Project.visible, :name => :issue_tracking) |
|
249 |
end, |
|
250 |
:caption => :label_issue_plural |
|
251 |
) |
|
252 |
menu.push( |
|
253 |
:time_entries, |
|
254 |
{:controller => 'timelog', :action => 'index'}, |
|
255 |
:if => |
|
256 |
Proc.new do |
|
257 |
User.current.allowed_to?(:view_time_entries, nil, :global => true) && |
|
258 |
EnabledModule.exists?(:project => Project.visible, :name => :time_tracking) |
|
259 |
end, |
|
260 |
:caption => :label_spent_time |
|
261 |
) |
|
262 |
menu.push( |
|
263 |
:gantt, |
|
264 |
{:controller => 'gantts', :action => 'show'}, |
|
265 |
:caption => :label_gantt, |
|
266 |
:if => |
|
267 |
Proc.new do |
|
268 |
User.current.allowed_to?(:view_gantt, nil, :global => true) && |
|
269 |
EnabledModule.exists?(:project => Project.visible, :name => :gantt) |
|
270 |
end |
|
271 |
) |
|
272 |
menu.push( |
|
273 |
:calendar, |
|
274 |
{:controller => 'calendars', :action => 'show'}, |
|
275 |
:caption => :label_calendar, |
|
276 |
:if => |
|
277 |
Proc.new do |
|
278 |
User.current.allowed_to?(:view_calendar, nil, :global => true) && |
|
279 |
EnabledModule.exists?(:project => Project.visible, :name => :calendar) |
|
280 |
end |
|
281 |
) |
|
282 |
menu.push( |
|
283 |
:news, |
|
284 |
{:controller => 'news', :action => 'index'}, |
|
285 |
:if => |
|
286 |
Proc.new do |
|
287 |
User.current.allowed_to?(:view_news, nil, :global => true) && |
|
288 |
EnabledModule.exists?(:project => Project.visible, :name => :news) |
|
289 |
end, |
|
290 |
:caption => :label_news_plural |
|
291 |
) |
|
292 |
end |
|
293 | ||
294 |
Redmine::MenuManager.map :admin_menu do |menu| |
|
295 |
menu.push :projects, {:controller => 'admin', :action => 'projects'}, |
|
296 |
:caption => :label_project_plural, |
|
297 |
:html => {:class => 'icon icon-projects'} |
|
298 |
menu.push :users, {:controller => 'users'}, :caption => :label_user_plural, |
|
299 |
:html => {:class => 'icon icon-user'} |
|
300 |
menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural, |
|
301 |
:html => {:class => 'icon icon-group'} |
|
302 |
menu.push :roles, {:controller => 'roles'}, |
|
303 |
:caption => :label_role_and_permissions, |
|
304 |
:html => {:class => 'icon icon-roles'} |
|
305 |
menu.push :trackers, {:controller => 'trackers'}, |
|
306 |
:caption => :label_tracker_plural, |
|
307 |
:html => {:class => 'icon icon-issue'} |
|
308 |
menu.push :issue_statuses, {:controller => 'issue_statuses'}, |
|
309 |
:caption => :label_issue_status_plural, |
|
310 |
:html => {:class => 'icon icon-issue-edit'} |
|
311 |
menu.push :workflows, {:controller => 'workflows', :action => 'edit'}, |
|
312 |
:caption => :label_workflow, |
|
313 |
:html => {:class => 'icon icon-workflows'} |
|
314 |
menu.push :custom_fields, {:controller => 'custom_fields'}, |
|
315 |
:caption => :label_custom_field_plural, |
|
316 |
:html => {:class => 'icon icon-custom-fields'} |
|
317 |
menu.push :enumerations, {:controller => 'enumerations'}, |
|
318 |
:html => {:class => 'icon icon-list'} |
|
319 |
menu.push :settings, {:controller => 'settings'}, |
|
320 |
:html => {:class => 'icon icon-settings'} |
|
321 |
menu.push :ldap_authentication, |
|
322 |
{:controller => 'auth_sources', :action => 'index'}, |
|
323 |
:html => {:class => 'icon icon-server-authentication'} |
|
324 |
menu.push :plugins, {:controller => 'admin', :action => 'plugins'}, |
|
325 |
:last => true, |
|
326 |
:html => {:class => 'icon icon-plugins'} |
|
327 |
menu.push :info, {:controller => 'admin', :action => 'info'}, |
|
328 |
:caption => :label_information_plural, |
|
329 |
:last => true, |
|
330 |
:html => {:class => 'icon icon-help'} |
|
331 |
end |
|
332 | ||
333 |
Redmine::MenuManager.map :project_menu do |menu| |
|
334 |
menu.push( |
|
335 |
:new_object, nil, :caption => ' + ', |
|
336 |
:if => Proc.new {|p| Setting.new_item_menu_tab == '2'}, |
|
337 |
:html => {:id => 'new-object', |
|
338 |
:onclick => 'toggleNewObjectDropdown(); return false;'} |
|
339 |
) |
|
340 |
menu.push( |
|
341 |
:new_issue_sub, |
|
342 |
{:controller => 'issues', :action => 'new', :copy_from => nil}, |
|
343 |
:param => :project_id, :caption => :label_issue_new, |
|
344 |
:html => {:accesskey => Redmine::AccessKeys.key_for(:new_issue)}, |
|
345 |
:if => Proc.new {|p| Issue.allowed_target_trackers(p).any?}, |
|
346 |
:permission => :add_issues, |
|
347 |
:parent => :new_object |
|
348 |
) |
|
349 |
menu.push :new_issue_category, |
|
350 |
{:controller => 'issue_categories', :action => 'new'}, |
|
351 |
:param => :project_id, :caption => :label_issue_category_new, |
|
352 |
:parent => :new_object |
|
353 |
menu.push :new_version, {:controller => 'versions', :action => 'new'}, |
|
354 |
:param => :project_id, :caption => :label_version_new, |
|
355 |
:parent => :new_object |
|
356 |
menu.push :new_timelog, {:controller => 'timelog', :action => 'new'}, |
|
357 |
:param => :project_id, :caption => :button_log_time, |
|
358 |
:parent => :new_object |
|
359 |
menu.push :new_news, {:controller => 'news', :action => 'new'}, |
|
360 |
:param => :project_id, :caption => :label_news_new, |
|
361 |
:parent => :new_object |
|
362 |
menu.push :new_document, {:controller => 'documents', :action => 'new'}, |
|
363 |
:param => :project_id, :caption => :label_document_new, |
|
364 |
:parent => :new_object |
|
365 |
menu.push :new_wiki_page, {:controller => 'wiki', :action => 'new'}, |
|
366 |
:param => :project_id, :caption => :label_wiki_page_new, |
|
367 |
:parent => :new_object |
|
368 |
menu.push :new_file, {:controller => 'files', :action => 'new'}, |
|
369 |
:param => :project_id, :caption => :label_attachment_new, |
|
370 |
:parent => :new_object |
|
371 | ||
372 |
menu.push :overview, {:controller => 'projects', :action => 'show'} |
|
373 |
menu.push :activity, {:controller => 'activities', :action => 'index'} |
|
374 |
menu.push( |
|
375 |
:roadmap, |
|
376 |
{:controller => 'versions', :action => 'index'}, |
|
377 |
:param => :project_id, |
|
378 |
:if => |
|
379 |
Proc.new do |p| |
|
380 |
if p.shared_versions.any? |
|
381 |
true |
|
382 |
else |
|
383 |
Setting.display_subprojects_issues? && p.rolled_up_versions.any? |
|
384 |
end |
|
385 |
end |
|
386 |
) |
|
387 |
menu.push :issues, {:controller => 'issues', :action => 'index'}, |
|
388 |
:param => :project_id, :caption => :label_issue_plural |
|
389 |
menu.push( |
|
390 |
:new_issue, |
|
391 |
{:controller => 'issues', :action => 'new', :copy_from => nil}, |
|
392 |
:param => :project_id, :caption => :label_issue_new, |
|
393 |
:html => {:accesskey => Redmine::AccessKeys.key_for(:new_issue)}, |
|
394 |
:if => |
|
395 |
Proc.new do |p| |
|
396 |
Setting.new_item_menu_tab == '1' && |
|
397 |
Issue.allowed_target_trackers(p).any? |
|
398 |
end, |
|
399 |
:permission => :add_issues |
|
400 |
) |
|
401 |
menu.push :time_entries, {:controller => 'timelog', :action => 'index'}, |
|
402 |
:param => :project_id, :caption => :label_spent_time |
|
403 |
menu.push :gantt, {:controller => 'gantts', :action => 'show'}, |
|
404 |
:param => :project_id, :caption => :label_gantt |
|
405 |
menu.push :calendar, {:controller => 'calendars', :action => 'show'}, |
|
406 |
:param => :project_id, :caption => :label_calendar |
|
407 |
menu.push :news, {:controller => 'news', :action => 'index'}, |
|
408 |
:param => :project_id, :caption => :label_news_plural |
|
409 |
menu.push :documents, {:controller => 'documents', :action => 'index'}, |
|
410 |
:param => :project_id, :caption => :label_document_plural |
|
411 |
menu.push :wiki, {:controller => 'wiki', :action => 'show', :id => nil}, |
|
412 |
:param => :project_id, |
|
413 |
:if => Proc.new {|p| p.wiki && !p.wiki.new_record?} |
|
414 |
menu.push :boards, {:controller => 'boards', :action => 'index', :id => nil}, |
|
415 |
:param => :project_id, |
|
416 |
:if => Proc.new {|p| p.boards.any?}, :caption => :label_board_plural |
|
417 |
menu.push :files, {:controller => 'files', :action => 'index'}, |
|
418 |
:caption => :label_file_plural, :param => :project_id |
|
419 |
menu.push :repository, |
|
420 |
{:controller => 'repositories', :action => 'show', |
|
421 |
:repository_id => nil, :path => nil, :rev => nil}, |
|
422 |
:if => Proc.new {|p| p.repository && !p.repository.new_record?} |
|
423 |
menu.push :settings, {:controller => 'projects', :action => 'settings'}, |
|
424 |
:last => true |
|
425 |
end |
|
426 | ||
427 |
Redmine::Activity.map do |activity| |
|
428 |
activity.register :issues, :class_name => %w(Issue Journal) |
|
429 |
activity.register :changesets |
|
430 |
activity.register :news |
|
431 |
activity.register :documents, :class_name => %w(Document Attachment) |
|
432 |
activity.register :files, :class_name => 'Attachment' |
|
433 |
activity.register :wiki_edits, :class_name => 'WikiContentVersion', :default => false |
|
434 |
activity.register :messages, :default => false |
|
435 |
activity.register :time_entries, :default => false |
|
436 |
end |
|
437 | ||
438 |
Redmine::Search.map do |search| |
|
439 |
search.register :issues |
|
440 |
search.register :news |
|
441 |
search.register :documents |
|
442 |
search.register :changesets |
|
443 |
search.register :wiki_pages |
|
444 |
search.register :messages |
|
445 |
search.register :projects |
|
446 |
end |
|
447 | ||
448 |
Redmine::WikiFormatting.map do |format| |
|
449 |
format.register :textile |
|
450 |
format.register :markdown if Object.const_defined?(:Redcarpet) |
|
451 |
if Object.const_defined?(:CommonMarker) |
|
452 |
format.register :common_mark, label: 'CommonMark Markdown (GitHub Flavored) - experimental' |
|
453 |
end |
|
454 |
end |
|
455 | ||
456 |
ActionView::Template.register_template_handler :rsb, Redmine::Views::ApiTemplateHandler |
lib/redmine/configuration.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
require 'redmine' |
|
21 | ||
20 | 22 |
module Redmine |
21 | 23 |
module Configuration |
22 | 24 |
lib/redmine/i18n.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
require 'redmine' |
|
21 | ||
20 | 22 |
module Redmine |
21 | 23 |
module I18n |
22 | 24 |
def self.included(base) |
lib/redmine/preparation.rb | ||
---|---|---|
1 |
# frozen_string_literal: true |
|
2 | ||
3 |
# Redmine - project management software |
|
4 |
# Copyright (C) 2006-2021 Jean-Philippe Lang |
|
5 |
# |
|
6 |
# This program is free software; you can redistribute it and/or |
|
7 |
# modify it under the terms of the GNU General Public License |
|
8 |
# as published by the Free Software Foundation; either version 2 |
|
9 |
# of the License, or (at your option) any later version. |
|
10 |
# |
|
11 |
# This program is distributed in the hope that it will be useful, |
|
12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
# GNU General Public License for more details. |
|
15 |
# |
|
16 |
# You should have received a copy of the GNU General Public License |
|
17 |
# along with this program; if not, write to the Free Software |
|
18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
19 | ||
20 |
module Redmine |
|
21 |
module Preparation |
|
22 |
def self.prepare |
|
23 |
Scm::Base.add "Subversion" |
|
24 |
Scm::Base.add "Mercurial" |
|
25 |
Scm::Base.add "Cvs" |
|
26 |
Scm::Base.add "Bazaar" |
|
27 |
Scm::Base.add "Git" |
|
28 |
Scm::Base.add "Filesystem" |
|
29 | ||
30 |
# Permissions |
|
31 |
AccessControl.map do |map| |
|
32 |
map.permission :view_project, {:projects => [:show, :bookmark], :activities => [:index]}, :public => true, :read => true |
|
33 |
map.permission :search_project, {:search => :index}, :public => true, :read => true |
|
34 |
map.permission :add_project, {:projects => [:new, :create]}, :require => :loggedin |
|
35 |
map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member |
|
36 |
map.permission :close_project, {:projects => [:close, :reopen]}, :require => :member, :read => true |
|
37 |
map.permission :delete_project, {:projects => :destroy}, :require => :member, :read => true |
|
38 |
map.permission :select_project_modules, {:projects => :modules}, :require => :member |
|
39 |
map.permission :view_members, {:members => [:index, :show]}, :public => true, :read => true |
|
40 |
map.permission :manage_members, {:projects => :settings, :members => [:index, :show, :new, :create, :edit, :update, :destroy, :autocomplete]}, :require => :member |
|
41 |
map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member |
|
42 |
map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member |
|
43 |
# Queries |
|
44 |
map.permission :manage_public_queries, {:queries => [:new, :create, :edit, :update, :destroy]}, :require => :member |
|
45 |
map.permission :save_queries, {:queries => [:new, :create, :edit, :update, :destroy]}, :require => :loggedin |
|
46 | ||
47 |
map.project_module :issue_tracking do |map| |
|
48 |
# Issues |
|
49 |
map.permission :view_issues, {:issues => [:index, :show, :issue_tab], |
|
50 |
:auto_complete => [:issues], |
|
51 |
:context_menus => [:issues], |
|
52 |
:versions => [:index, :show, :status_by], |
|
53 |
:journals => [:index, :diff], |
|
54 |
:queries => :index, |
|
55 |
:reports => [:issue_report, :issue_report_details]}, |
|
56 |
:read => true |
|
57 |
map.permission :add_issues, {:issues => [:new, :create], :attachments => :upload} |
|
58 |
map.permission :edit_issues, {:issues => [:edit, :update, :bulk_edit, :bulk_update], :journals => [:new], :attachments => :upload} |
|
59 |
map.permission :edit_own_issues, {:issues => [:edit, :update, :bulk_edit, :bulk_update], :journals => [:new], :attachments => :upload} |
|
60 |
map.permission :copy_issues, {:issues => [:new, :create, :bulk_edit, :bulk_update], :attachments => :upload} |
|
61 |
map.permission :manage_issue_relations, {:issue_relations => [:index, :show, :create, :destroy]} |
|
62 |
map.permission :manage_subtasks, {} |
|
63 |
map.permission :set_issues_private, {} |
|
64 |
map.permission :set_own_issues_private, {}, :require => :loggedin |
|
65 |
map.permission :add_issue_notes, {:issues => [:edit, :update], :journals => [:new], :attachments => :upload} |
|
66 |
map.permission :edit_issue_notes, {:journals => [:edit, :update]}, :require => :loggedin |
|
67 |
map.permission :edit_own_issue_notes, {:journals => [:edit, :update]}, :require => :loggedin |
|
68 |
map.permission :view_private_notes, {}, :read => true, :require => :member |
|
69 |
map.permission :set_notes_private, {}, :require => :member |
|
70 |
map.permission :delete_issues, {:issues => :destroy}, :require => :member |
|
71 |
# Watchers |
|
72 |
map.permission :view_issue_watchers, {}, :read => true |
|
73 |
map.permission :add_issue_watchers, {:watchers => [:new, :create, :append, :autocomplete_for_user]} |
|
74 |
map.permission :delete_issue_watchers, {:watchers => :destroy} |
|
75 |
map.permission :import_issues, {} |
|
76 |
# Issue categories |
|
77 |
map.permission :manage_categories, {:projects => :settings, :issue_categories => [:index, :show, :new, :create, :edit, :update, :destroy]}, :require => :member |
|
78 |
end |
|
79 | ||
80 |
map.project_module :time_tracking do |map| |
|
81 |
map.permission :view_time_entries, {:timelog => [:index, :report, :show]}, :read => true |
|
82 |
map.permission :log_time, {:timelog => [:new, :create]}, :require => :loggedin |
|
83 |
map.permission :edit_time_entries, |
|
84 |
{:timelog => [:edit, :update, :destroy, :bulk_edit, :bulk_update]}, |
|
85 |
:require => :member |
|
86 |
map.permission :edit_own_time_entries, |
|
87 |
{:timelog => [:edit, :update, :destroy, :bulk_edit, :bulk_update]}, |
|
88 |
:require => :loggedin |
|
89 |
map.permission :manage_project_activities, |
|
90 |
{:projects => :settings, :project_enumerations => [:update, :destroy]}, |
|
91 |
:require => :member |
|
92 |
map.permission :log_time_for_other_users, :require => :member |
|
93 |
map.permission :import_time_entries, {} |
|
94 |
end |
|
95 | ||
96 |
map.project_module :news do |map| |
|
97 |
map.permission :view_news, {:news => [:index, :show]}, :read => true |
|
98 |
map.permission :manage_news, {:news => [:new, :create, :edit, :update, :destroy], :comments => [:destroy], :attachments => :upload}, :require => :member |
|
99 |
map.permission :comment_news, {:comments => :create} |
|
100 |
end |
|
101 | ||
102 |
map.project_module :documents do |map| |
|
103 |
map.permission :view_documents, {:documents => [:index, :show, :download]}, :read => true |
|
104 |
map.permission :add_documents, {:documents => [:new, :create, :add_attachment], :attachments => :upload}, :require => :loggedin |
|
105 |
map.permission :edit_documents, {:documents => [:edit, :update, :add_attachment], :attachments => :upload}, :require => :loggedin |
|
106 |
map.permission :delete_documents, {:documents => [:destroy]}, :require => :loggedin |
|
107 |
end |
|
108 | ||
109 |
map.project_module :files do |map| |
|
110 |
map.permission :view_files, {:files => :index, :versions => :download}, :read => true |
|
111 |
map.permission :manage_files, {:files => [:new, :create], :attachments => :upload}, :require => :loggedin |
|
112 |
end |
|
113 | ||
114 |
map.project_module :wiki do |map| |
|
115 |
map.permission :view_wiki_pages, {:wiki => [:index, :show, :special, :date_index], :auto_complete => [:wiki_pages]}, :read => true |
|
116 |
map.permission :view_wiki_edits, {:wiki => [:history, :diff, :annotate]}, :read => true |
|
117 |
map.permission :export_wiki_pages, {:wiki => [:export]}, :read => true |
|
118 |
map.permission :edit_wiki_pages, :wiki => [:new, :edit, :update, :preview, :add_attachment], :attachments => :upload |
|
119 |
map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member |
|
120 |
map.permission :delete_wiki_pages, {:wiki => [:destroy, :destroy_version]}, :require => :member |
|
121 |
map.permission :delete_wiki_pages_attachments, {} |
|
122 |
map.permission :view_wiki_page_watchers, {}, :read => true |
|
123 |
map.permission :add_wiki_page_watchers, {:watchers => [:new, :create, :autocomplete_for_user]} |
|
124 |
map.permission :delete_wiki_page_watchers, {:watchers => :destroy} |
|
125 |
map.permission :protect_wiki_pages, {:wiki => :protect}, :require => :member |
|
126 |
map.permission :manage_wiki, {:wikis => :destroy, :wiki => :rename}, :require => :member |
|
127 |
end |
|
128 | ||
129 |
map.project_module :repository do |map| |
|
130 |
map.permission :view_changesets, {:repositories => [:show, :revisions, :revision]}, :read => true |
|
131 |
map.permission :browse_repository, {:repositories => [:show, :browse, :entry, :raw, :annotate, :changes, :diff, :stats, :graph]}, :read => true |
|
132 |
map.permission :commit_access, {} |
|
133 |
map.permission :manage_related_issues, {:repositories => [:add_related_issue, :remove_related_issue]} |
|
134 |
map.permission :manage_repository, {:projects => :settings, :repositories => [:new, :create, :edit, :update, :committers, :destroy, :fetch_changesets]}, :require => :member |
|
135 |
end |
|
136 | ||
137 |
map.project_module :boards do |map| |
|
138 |
map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :read => true |
|
139 |
map.permission :add_messages, {:messages => [:new, :reply, :quote], :attachments => :upload} |
|
140 |
map.permission :edit_messages, {:messages => :edit, :attachments => :upload}, :require => :member |
|
141 |
map.permission :edit_own_messages, {:messages => :edit, :attachments => :upload}, :require => :loggedin |
|
142 |
map.permission :delete_messages, {:messages => :destroy}, :require => :member |
|
143 |
map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin |
|
144 |
map.permission :view_message_watchers, {}, :read => true |
|
145 |
map.permission :add_message_watchers, {:watchers => [:new, :create, :autocomplete_for_user]} |
|
146 |
map.permission :delete_message_watchers, {:watchers => :destroy} |
|
147 |
map.permission :manage_boards, {:projects => :settings, :boards => [:new, :create, :edit, :update, :destroy]}, :require => :member |
|
148 |
end |
|
149 | ||
150 |
map.project_module :calendar do |map| |
|
151 |
map.permission :view_calendar, {:calendars => [:show, :update]}, :read => true |
|
152 |
end |
|
153 | ||
154 |
map.project_module :gantt do |map| |
|
155 |
map.permission :view_gantt, {:gantts => [:show, :update]}, :read => true |
|
156 |
end |
|
157 |
end |
|
158 | ||
159 |
MenuManager.map :top_menu do |menu| |
|
160 |
menu.push :home, :home_path |
|
161 |
menu.push :my_page, {:controller => 'my', :action => 'page'}, |
|
162 |
:if => Proc.new {User.current.logged?} |
|
163 |
menu.push :projects, {:controller => 'projects', :action => 'index'}, |
|
164 |
:caption => :label_project_plural |
|
165 |
menu.push :administration, {:controller => 'admin', :action => 'index'}, |
|
166 |
:if => Proc.new {User.current.admin?}, :last => true |
|
167 |
menu.push :help, Info.help_url, :last => true |
|
168 |
end |
|
169 | ||
170 |
MenuManager.map :account_menu do |menu| |
|
171 |
menu.push :login, :signin_path, :if => Proc.new {!User.current.logged?} |
|
172 |
menu.push :register, :register_path, |
|
173 |
:if => Proc.new {!User.current.logged? && Setting.self_registration?} |
|
174 |
menu.push :my_account, {:controller => 'my', :action => 'account'}, |
|
175 |
:if => Proc.new {User.current.logged?} |
|
176 |
menu.push :logout, :signout_path, :html => {:method => 'post'}, |
|
177 |
:if => Proc.new {User.current.logged?} |
|
178 |
end |
|
179 | ||
180 |
MenuManager.map :application_menu do |menu| |
|
181 |
menu.push :projects, {:controller => 'projects', :action => 'index'}, |
|
182 |
:permission => nil, |
|
183 |
:caption => :label_project_plural |
|
184 |
menu.push :activity, {:controller => 'activities', :action => 'index', :id => nil} |
|
185 |
menu.push( |
|
186 |
:issues, |
|
187 |
{:controller => 'issues', :action => 'index'}, |
|
188 |
:if => |
|
189 |
Proc.new do |
|
190 |
User.current.allowed_to?(:view_issues, nil, :global => true) && |
|
191 |
EnabledModule.exists?(:project => Project.visible, :name => :issue_tracking) |
|
192 |
end, |
|
193 |
:caption => :label_issue_plural |
|
194 |
) |
|
195 |
menu.push( |
|
196 |
:time_entries, |
|
197 |
{:controller => 'timelog', :action => 'index'}, |
|
198 |
:if => |
|
199 |
Proc.new do |
|
200 |
User.current.allowed_to?(:view_time_entries, nil, :global => true) && |
|
201 |
EnabledModule.exists?(:project => Project.visible, :name => :time_tracking) |
|
202 |
end, |
|
203 |
:caption => :label_spent_time |
|
204 |
) |
|
205 |
menu.push( |
|
206 |
:gantt, |
|
207 |
{:controller => 'gantts', :action => 'show'}, |
|
208 |
:caption => :label_gantt, |
|
209 |
:if => |
|
210 |
Proc.new do |
|
211 |
User.current.allowed_to?(:view_gantt, nil, :global => true) && |
|
212 |
EnabledModule.exists?(:project => Project.visible, :name => :gantt) |
|
213 |
end |
|
214 |
) |
|
215 |
menu.push( |
|
216 |
:calendar, |
|
217 |
{:controller => 'calendars', :action => 'show'}, |
|
218 |
:caption => :label_calendar, |
|
219 |
:if => |
|
220 |
Proc.new do |
|
221 |
User.current.allowed_to?(:view_calendar, nil, :global => true) && |
|
222 |
EnabledModule.exists?(:project => Project.visible, :name => :calendar) |
|
223 |
end |
|
224 |
) |
|
225 |
menu.push( |
|
226 |
:news, |
|
227 |
{:controller => 'news', :action => 'index'}, |
|
228 |
:if => |
|
229 |
Proc.new do |
|
230 |
User.current.allowed_to?(:view_news, nil, :global => true) && |
|
231 |
EnabledModule.exists?(:project => Project.visible, :name => :news) |
|
232 |
end, |
|
233 |
:caption => :label_news_plural |
|
234 |
) |
|
235 |
end |
|
236 | ||
237 |
MenuManager.map :admin_menu do |menu| |
|
238 |
menu.push :projects, {:controller => 'admin', :action => 'projects'}, |
|
239 |
:caption => :label_project_plural, |
|
240 |
:html => {:class => 'icon icon-projects'} |
|
241 |
menu.push :users, {:controller => 'users'}, :caption => :label_user_plural, |
|
242 |
:html => {:class => 'icon icon-user'} |
|
243 |
menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural, |
|
244 |
:html => {:class => 'icon icon-group'} |
|
245 |
menu.push :roles, {:controller => 'roles'}, |
|
246 |
:caption => :label_role_and_permissions, |
|
247 |
:html => {:class => 'icon icon-roles'} |
|
248 |
menu.push :trackers, {:controller => 'trackers'}, |
|
249 |
:caption => :label_tracker_plural, |
|
250 |
:html => {:class => 'icon icon-issue'} |
|
251 |
menu.push :issue_statuses, {:controller => 'issue_statuses'}, |
|
252 |
:caption => :label_issue_status_plural, |
|
253 |
:html => {:class => 'icon icon-issue-edit'} |
|
254 |
menu.push :workflows, {:controller => 'workflows', :action => 'edit'}, |
|
255 |
:caption => :label_workflow, |
|
256 |
:html => {:class => 'icon icon-workflows'} |
|
257 |
menu.push :custom_fields, {:controller => 'custom_fields'}, |
|
258 |
:caption => :label_custom_field_plural, |
|
259 |
:html => {:class => 'icon icon-custom-fields'} |
|
260 |
menu.push :enumerations, {:controller => 'enumerations'}, |
|
261 |
:html => {:class => 'icon icon-list'} |
|
262 |
menu.push :settings, {:controller => 'settings'}, |
|
263 |
:html => {:class => 'icon icon-settings'} |
|
264 |
menu.push :ldap_authentication, |
|
265 |
{:controller => 'auth_sources', :action => 'index'}, |
|
266 |
:html => {:class => 'icon icon-server-authentication'} |
|
267 |
menu.push :plugins, {:controller => 'admin', :action => 'plugins'}, |
|
268 |
:last => true, |
|
269 |
:html => {:class => 'icon icon-plugins'} |
|
270 |
menu.push :info, {:controller => 'admin', :action => 'info'}, |
|
271 |
:caption => :label_information_plural, |
|
272 |
:last => true, |
|
273 |
:html => {:class => 'icon icon-help'} |
|
274 |
end |
|
275 | ||
276 |
MenuManager.map :project_menu do |menu| |
|
277 |
menu.push( |
|
278 |
:new_object, nil, :caption => ' + ', |
|
279 |
:if => Proc.new {|p| Setting.new_item_menu_tab == '2'}, |
|
280 |
:html => {:id => 'new-object', |
|
281 |
:onclick => 'toggleNewObjectDropdown(); return false;'} |
|
282 |
) |
|
283 |
menu.push( |
|
284 |
:new_issue_sub, |
|
285 |
{:controller => 'issues', :action => 'new', :copy_from => nil}, |
|
286 |
:param => :project_id, :caption => :label_issue_new, |
|
287 |
:html => {:accesskey => AccessKeys.key_for(:new_issue)}, |
|
288 |
:if => Proc.new {|p| Issue.allowed_target_trackers(p).any?}, |
|
289 |
:permission => :add_issues, |
|
290 |
:parent => :new_object |
|
291 |
) |
|
292 |
menu.push :new_issue_category, |
|
293 |
{:controller => 'issue_categories', :action => 'new'}, |
|
294 |
:param => :project_id, :caption => :label_issue_category_new, |
|
295 |
:parent => :new_object |
|
296 |
menu.push :new_version, {:controller => 'versions', :action => 'new'}, |
|
297 |
:param => :project_id, :caption => :label_version_new, |
|
298 |
:parent => :new_object |
|
299 |
menu.push :new_timelog, {:controller => 'timelog', :action => 'new'}, |
|
300 |
:param => :project_id, :caption => :button_log_time, |
|
301 |
:parent => :new_object |
|
302 |
menu.push :new_news, {:controller => 'news', :action => 'new'}, |
|
303 |
:param => :project_id, :caption => :label_news_new, |
|
304 |
:parent => :new_object |
|
305 |
menu.push :new_document, {:controller => 'documents', :action => 'new'}, |
|
306 |
:param => :project_id, :caption => :label_document_new, |
|
307 |
:parent => :new_object |
|
308 |
menu.push :new_wiki_page, {:controller => 'wiki', :action => 'new'}, |
|
309 |
:param => :project_id, :caption => :label_wiki_page_new, |
|
310 |
:parent => :new_object |
|
311 |
menu.push :new_file, {:controller => 'files', :action => 'new'}, |
|
312 |
:param => :project_id, :caption => :label_attachment_new, |
|
313 |
:parent => :new_object |
|
314 | ||
315 |
menu.push :overview, {:controller => 'projects', :action => 'show'} |
|
316 |
menu.push :activity, {:controller => 'activities', :action => 'index'} |
|
317 |
menu.push( |
|
318 |
:roadmap, |
|
319 |
{:controller => 'versions', :action => 'index'}, |
|
320 |
:param => :project_id, |
|
321 |
:if => |
|
322 |
Proc.new do |p| |
|
323 |
if p.shared_versions.any? |
|
324 |
true |
|
325 |
else |
|
326 |
Setting.display_subprojects_issues? && p.rolled_up_versions.any? |
|
327 |
end |
|
328 |
end |
|
329 |
) |
|
330 |
menu.push :issues, {:controller => 'issues', :action => 'index'}, |
|
331 |
:param => :project_id, :caption => :label_issue_plural |
|
332 |
menu.push( |
|
333 |
:new_issue, |
|
334 |
{:controller => 'issues', :action => 'new', :copy_from => nil}, |
|
335 |
:param => :project_id, :caption => :label_issue_new, |
|
336 |
:html => {:accesskey => AccessKeys.key_for(:new_issue)}, |
|
337 |
:if => |
|
338 |
Proc.new do |p| |
|
339 |
Setting.new_item_menu_tab == '1' && |
|
340 |
Issue.allowed_target_trackers(p).any? |
|
341 |
end, |
|
342 |
:permission => :add_issues |
|
343 |
) |
|
344 |
menu.push :time_entries, {:controller => 'timelog', :action => 'index'}, |
|
345 |
:param => :project_id, :caption => :label_spent_time |
|
346 |
menu.push :gantt, {:controller => 'gantts', :action => 'show'}, |
|
347 |
:param => :project_id, :caption => :label_gantt |
|
348 |
menu.push :calendar, {:controller => 'calendars', :action => 'show'}, |
|
349 |
:param => :project_id, :caption => :label_calendar |
|
350 |
menu.push :news, {:controller => 'news', :action => 'index'}, |
|
351 |
:param => :project_id, :caption => :label_news_plural |
|
352 |
menu.push :documents, {:controller => 'documents', :action => 'index'}, |
|
353 |
:param => :project_id, :caption => :label_document_plural |
|
354 |
menu.push :wiki, {:controller => 'wiki', :action => 'show', :id => nil}, |
|
355 |
:param => :project_id, |
|
356 |
:if => Proc.new {|p| p.wiki && !p.wiki.new_record?} |
|
357 |
menu.push :boards, {:controller => 'boards', :action => 'index', :id => nil}, |
|
358 |
:param => :project_id, |
|
359 |
:if => Proc.new {|p| p.boards.any?}, :caption => :label_board_plural |
|
360 |
menu.push :files, {:controller => 'files', :action => 'index'}, |
|
361 |
:caption => :label_file_plural, :param => :project_id |
|
362 |
menu.push :repository, |
|
363 |
{:controller => 'repositories', :action => 'show', |
|
364 |
:repository_id => nil, :path => nil, :rev => nil}, |
|
365 |
:if => Proc.new {|p| p.repository && !p.repository.new_record?} |
|
366 |
menu.push :settings, {:controller => 'projects', :action => 'settings'}, |
|
367 |
:last => true |
|
368 |
end |
|
369 | ||
370 |
Activity.map do |activity| |
|
371 |
activity.register :issues, :class_name => %w(Issue Journal) |
|
372 |
activity.register :changesets |
|
373 |
activity.register :news |
|
374 |
activity.register :documents, :class_name => %w(Document Attachment) |
|
375 |
activity.register :files, :class_name => 'Attachment' |
|
376 |
activity.register :wiki_edits, :class_name => 'WikiContentVersion', :default => false |
|
377 |
activity.register :messages, :default => false |
|
378 |
activity.register :time_entries, :default => false |
|
379 |
end |
|
380 | ||
381 |
Search.map do |search| |
|
382 |
search.register :issues |
|
383 |
search.register :news |
|
384 |
search.register :documents |
|
385 |
search.register :changesets |
|
386 |
search.register :wiki_pages |
|
387 |
search.register :messages |
|
388 |
search.register :projects |
|
389 |
end |
|
390 | ||
391 |
WikiFormatting.map do |format| |
|
392 |
format.register :textile |
|
393 |
format.register :markdown if Object.const_defined?(:Redcarpet) |
|
394 |
if Object.const_defined?(:CommonMarker) |
|
395 |
format.register :common_mark, label: 'CommonMark Markdown (GitHub Flavored) - experimental' |
|
396 |
end |
|
397 |
end |
|
398 | ||
399 |
ActionView::Template.register_template_handler :rsb, Views::ApiTemplateHandler |
|
400 |
end |
|
401 |
end |
|
402 |
end |
lib/redmine/wiki_formatting.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
require File.expand_path('../wiki_formatting/textile/redcloth3', __FILE__) |
|
20 | 21 |
require 'digest/md5' |
21 | 22 | |
22 | 23 |
module Redmine |
lib/redmine/wiki_formatting/textile/formatter.rb | ||
---|---|---|
17 | 17 |
# along with this program; if not, write to the Free Software |
18 | 18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | |
20 |
require File.expand_path('../redcloth3', __FILE__) |
|
21 | 20 |
require 'digest/md5' |
22 | 21 | |
23 | 22 |
module Redmine |