additionals/init.rb

58 lines
2.1 KiB
Ruby
Raw Normal View History

2018-02-12 16:53:05 +03:00
require_dependency 'additionals'
2013-11-11 14:57:30 +04:00
Redmine::Plugin.register :additionals do
name 'Additionals'
2013-11-11 14:57:30 +04:00
author 'AlphaNodes GmbH'
description 'Customizing Redmine, providing wiki macros and act as a library/function provider for other Redmine plugins'
version '2.0.20'
author_url 'https://alphanodes.com/'
url 'https://github.com/alphanodes/additionals'
2013-11-11 14:57:30 +04:00
default_settings = Additionals.load_settings
5.times do |i|
2015-10-10 15:11:02 +03:00
default_settings['custom_menu' + i.to_s + '_name'] = ''
default_settings['custom_menu' + i.to_s + '_url'] = ''
default_settings['custom_menu' + i.to_s + '_title'] = ''
end
2017-07-11 19:07:05 +03:00
settings(default: default_settings, partial: 'additionals/settings/additionals')
2016-12-02 14:45:12 +03:00
permission :show_hidden_roles_in_memberbox, {}
project_module :issue_tracking do
permission :edit_closed_issues, {}
permission :edit_issue_author, {}
permission :change_new_issue_author, {}
2018-10-17 12:59:11 +03:00
permission :issue_timelog_never_required, {}
2016-12-02 14:45:12 +03:00
end
2013-11-11 14:57:30 +04:00
project_module :time_tracking do
permission :log_time_on_closed_issues, {}
end
2013-11-11 14:57:30 +04:00
# required redmine version
2018-07-15 19:02:52 +03:00
requires_redmine version_or_higher: '3.4.0'
2013-11-11 14:57:30 +04:00
menu :admin_menu, :additionals, { controller: 'settings', action: 'plugin', id: 'additionals' }, caption: :label_additionals
2016-11-17 09:17:21 +03:00
RedCloth3::ALLOWED_TAGS << 'div'
2013-11-11 14:57:30 +04:00
end
2018-02-12 16:53:05 +03:00
if Rails.version < '5.2' && ActiveRecord::Base.connection.active? && ActiveRecord::Base.connection.table_exists?(:settings) ||
Rails.version >= '5.2' && !ActiveRecord::Base.connection.migration_context.needs_migration?
2019-03-13 09:57:50 +03:00
Rails.configuration.to_prepare do
Additionals.setup
end
2018-02-12 16:53:05 +03:00
2019-03-13 09:57:50 +03:00
Rails.application.config.after_initialize do
FONTAWESOME_ICONS = { fab: AdditionalsFontAwesome.load_icons(:fab),
far: AdditionalsFontAwesome.load_icons(:far),
fas: AdditionalsFontAwesome.load_icons(:fas) }.freeze
end
2018-02-12 16:53:05 +03:00
2019-03-13 09:57:50 +03:00
Rails.application.paths['app/overrides'] ||= []
Dir.glob(Rails.root.join('plugins', '*', 'app', 'overrides')).each do |dir|
Rails.application.paths['app/overrides'] << dir unless Rails.application.paths['app/overrides'].include?(dir)
end
2018-02-12 16:53:05 +03:00
end