-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.rb
35 lines (31 loc) · 967 Bytes
/
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
Redmine::Plugin.register :xlsx_export do
name 'XLSX export dummy'
author 'Stephan Wiehr'
description 'demonstrates a problem with axlsx_rails'
version '1.0.0'
# Auxtables (Admin menu)
menu :admin_menu, :xlsx_export,
{ controller: 'xlsx_exports', action: 'index' },
html: { class: 'icon settings' }
end
Rails.application.config.after_initialize do
plugin = Redmine::Plugin.find(:xlsx_export)
# Determine available features based on Redmine version
plugin.instance_eval do
MY_FEATURE = {
# AXLSX Gem installed (for XLSX export)
gem_axlsx: false,
}
begin
require 'acts_as_xlsx'
require 'axlsx_rails'
MY_FEATURE[:gem_axlsx] = true
rescue LoadError => e
# Ignore
Rails.logger.info "[INFO] XLSX export feature disabled - #{e.message}"
end
end
end
ActionDispatch::Callbacks.to_prepare do
require 'xlsx_exports/xlsx_exports_hook_listener'
end