-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinit.rb
66 lines (50 loc) · 3.36 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
require 'redmine'
#Mime::SET << Mime::PDF unless Mime::SET.include?(Mime::PDF)
#Mime::SET << Mime::ATOM unless Mime::SET.include?(Mime::ATOM)
Rails.configuration.middleware.use PDFKit::Middleware, {print_media_type: true}, only: [/\/time_invoice_reports\/report/, /\/time_invoice_reports\/.+\/project_report/]
Rails.configuration.serve_static_files = true
#The above three lines are setting Redmine level settings for the plug in
Rails.configuration.to_prepare do
require_dependency 'user'
User.send(:include, RedmineTimeInvoices::Patches::UserPatch)
require_dependency 'project'
Project.send(:include, RedmineTimeInvoices::Patches::ProjectPatch)
end
Redmine::Plugin.register :redmine_time_invoices do
name 'Redmine Time Invoices'
author 'Arkhitech'
url 'http://github.com/arkhitech/redmine_time_invoices'
author_url 'https://github.com/arkhitech'
description 'Generates time invoice for each project where the Redmine Time Invoices plugin module is installed'
version '0.0.1'
project_module :time_invoices do
permission :submit_invoiceable_time,:time_invoices => :index
permission :generate_time_invoices,[:time_invoices => [:index, :new],:time_invoice_reports=> [:project_index,:project_report]]
permission :edit_invoiceable_time, :time_invoices => :edit
menu :project_menu, :time_invoices,
{ controller: :time_invoices, :action => 'index' },
after: :activity, param: :project_id
# menu :project_menu, :time_invoice_reports,
# { controller: :time_invoice_reports, :action => 'project_index' },
# after: :activity, param: :project_id
Redmine::MenuManager.map :time_invoices_menu_project do |menu|
menu.push :time_invoices_index, { :controller => 'time_invoices', :action => 'index' },after: :activity, param: :project_id,:caption => 'Overview Invoices'
menu.push :time_invoices_new, { :controller => 'time_invoices', :action=>'new' },after: :activity, param: :project_id, :caption => 'Generate Invoice'
menu.push :time_invoice_reports, { :controller => 'time_invoice_reports', :action => 'project_index' },after: :activity, param: :project_id, :caption => 'Reports'
menu.push :time_invoice_charts, {:controller => 'time_invoice_charts', :action => 'index_for_project'},after: :activity,param: :project_id, :caption => 'Analytics'
end
menu :top_menu, :time_invoices,
{ controller: :time_invoices, action: 'indexall' },
if: Proc.new {User.current.allowed_to_globally?(:submit_invoiceable_time,{}) ||
User.current.allowed_to_globally?(:generate_time_invoices,{}) ||
User.current.allowed_to_globally?(:edit_invoiceable_time,{})
}
Redmine::MenuManager.map :time_invoices_menu do |menu|
menu.push :time_invoices_all, { :controller => 'time_invoices', :action => 'indexall' }, :caption => 'Overview'
menu.push :time_invoices_top, { :controller => 'time_invoices', :action=>'topnew'}, :caption => 'Generate Invoice'
menu.push :time_invoice_reports, { :controller => 'time_invoice_reports', :action => 'index' }, :caption => 'Reports'
menu.push :time_invoice_charts, {:controller => 'time_invoice_charts', :action => 'index'}, :caption => 'Analytics'
end
end
settings default: {'group_mail' => [1],'daily_working_hours'=>[8]}, partial: 'settings/invoice_settings'
end