additionals/init.rb

67 lines
2.3 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
2021-11-23 22:30:24 +03:00
require 'additionals/plugin_version'
2021-12-07 21:03:09 +03:00
loader = RedminePluginKit::Loader.new plugin_id: 'additionals'
2021-11-23 22:30:24 +03:00
Redmine::Plugin.register :additionals do
name 'Additionals'
2013-11-11 14:57:30 +04:00
author 'AlphaNodes GmbH'
description 'Customizing Redmine, providing dashboards, wiki macros and other functions for better usability.' \
' As well as acting as a library/function provider for other Redmine plugins'
2021-11-23 21:16:49 +03:00
version Additionals::PluginVersion::VERSION
author_url 'https://alphanodes.com/'
url 'https://github.com/alphanodes/additionals'
directory File.dirname(__FILE__)
2013-11-11 14:57:30 +04:00
settings default: loader.default_settings,
partial: 'additionals/settings/additionals'
2016-12-02 14:45:12 +03:00
permission :show_hidden_roles_in_memberbox, {}
2020-07-27 11:49:23 +03:00
permission :set_system_dashboards,
{},
require: :loggedin,
read: true
permission :share_dashboards,
2020-07-27 11:49:23 +03:00
{ dashboards: %i[index new create edit update destroy] },
require: :member,
read: true
permission :save_dashboards,
{ dashboards: %i[index new create edit update destroy] },
require: :loggedin,
read: true
2016-12-02 14:45:12 +03:00
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
requires_redmine version_or_higher: '5.0'
2013-11-11 14:57:30 +04:00
menu :admin_menu, :additionals, { controller: 'settings', action: 'plugin', id: 'additionals' }, caption: :label_additionals
2013-11-11 14:57:30 +04:00
end
2018-02-12 16:53:05 +03:00
RedminePluginKit::Loader.persisting do
Redmine::AccessControl.include Additionals::Patches::AccessControlPatch
Redmine::AccessControl.singleton_class.prepend Additionals::Patches::AccessControlClassPatch
# Hooks
loader.load_model_hooks!
end
RedminePluginKit::Loader.after_initialize do
unless defined? FONTAWESOME_ICONS
# @TODO: this should be moved to AdditionalsFontAwesome and use an instance of it
FONTAWESOME_ICONS = { fab: AdditionalsFontAwesome.load_icons(:fab),
far: AdditionalsFontAwesome.load_icons(:far),
fas: AdditionalsFontAwesome.load_icons(:fas) }.freeze
end
end