Encapsulate presentation logic and Redmine patch management in PORO
The Advanced Plugin Helper plugin is a Redmine plugin for developers. It is helping to keep Rails helper and views light in favour of encapsulating presentation login in plain old ruby classes (PORO). It also provides a Patch API to easily register Redmine patches for Redmine 4 or 5 as well as an exception notifier.
These examples are quite short to give you a first impression. You can find much more information and step by step instructions about how to use the plugin in the official documentation.
Move your business logic from your views to presenter classes and integrate the transfered methods into your views like so:
<%= show(@my_model).helper_method_for_my_model %>
The AdvancedPluginHelper::PresentersHelper
is added to ActionView::Base
. Therefore, it is available in all views by default.
Both patch methods below needs to be loaded when the plugin is registered.
i) Register your Redmine patches.
data = { klass: Issue, patch: MyRedminePlugin::Extensions::IssuePatch, strategy: :include }
AdvancedPluginHelper::Patch.register(data)
ii) Excecute code which will be loaded in Redmine 4 with Rails.configuration.to_prepare
and Redmine 5 via Redmine::Hook::ViewListener#after_plugins_loaded
.
AdvancedPluginHelper::Patch.apply do
{ klass: MyRedminePlugin::Prepare,
method: :do_something_very_early }
end
Enable the email notifier in your config/additional_environment.rb:
require File.expand_path('plugins/advanced_plugin_helper/lib/advanced_plugin_helper/notifier', __dir__)
require File.expand_path('plugins/advanced_plugin_helper/lib/exception_notifier/custom_mail_notifier', __dir__)
require 'exception_notification/rails'
ExceptionNotification.configure do |config|
if AdvancedPluginHelper::Notifier.email_delivery_enabled?
config.add_notifier :custom_mail, AdvancedPluginHelper::Notifier.custom_mail
config.error_grouping = AdvancedPluginHelper::Notifier.error_grouping
config.ignore_if do |_exception, _options|
AdvancedPluginHelper::Notifier.disabled?
end
end
end
⚠️ Don't clone the default branch: For production you need to clone the master branch explicitly!
git clone -b master https://github.com/xmera-circle/advanced_plugin_helper
You need a running Redmine instance in order to install the plugin. If you need help with the installation, please refer to Redmine.org.
Instructions for the installation of this plugin can be found in the official documentation on xmera Circle » Community Portal.
All notable changes to this plugin will be reported in the changelog.
This project is maintained by xmera Solutions GmbH.
For any question on the usage of this plugin please use the xmera Circle » Community Portal. If you found a problem with the software, please create an issue on xmera Circle or GitHub.
If you are a xmera Solutions customer you may alternatively forward your issue to the xmera Service Customer Portal.
xmera Solutions takes the security of our software products seriously.
If you believe you have found a security vulnerability in any xmera Solutions-owned repository, please report it to us as described in the SECURITY.md.
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
Please read our Code of Conduct to make sure that you agree to follow it.
Your contributions are highly appreciated. There are plenty ways how you can help.
In case you like to improve the code, please create a pull request on GitHub. Bigger changes need to be discussed on xmera Circle » Community Portal first.
Copyright (C) 2022-2023 Liane Hampe ([email protected]), xmera Solutions GmbH.
This plugin program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.