Working on zeitwerk support
This commit is contained in:
parent
fbece21051
commit
1c23f13ec7
@ -4,7 +4,7 @@ Changelog
|
||||
3.0.4
|
||||
+++++
|
||||
|
||||
- Mermaid 8.13.3 support
|
||||
- Mermaid 8.13.4 support
|
||||
- D3 7.1.1 support
|
||||
- Ruby 2.6 is required
|
||||
|
||||
|
@ -2,11 +2,11 @@
|
||||
|
||||
lib = File.expand_path '../lib', __FILE__
|
||||
$LOAD_PATH.unshift lib unless $LOAD_PATH.include? lib
|
||||
require 'additionals/version'
|
||||
require 'additionals/plugin_version'
|
||||
|
||||
Gem::Specification.new do |spec|
|
||||
spec.name = 'additionals'
|
||||
spec.version = Additionals::VERSION
|
||||
spec.version = Additionals::PluginVersion::VERSION
|
||||
spec.authors = ['AlphaNodes']
|
||||
spec.email = ['alex@alphanodes.com']
|
||||
spec.metadata = { 'rubygems_mfa_required' => 'true' }
|
||||
|
2
assets/javascripts/mermaid.min.js
vendored
2
assets/javascripts/mermaid.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -181,7 +181,7 @@ It provides :
|
||||
* `d3 7.1.1 <https://d3js.org/>`_
|
||||
* `d3plus v2.0.0-alpha.30 <https://d3plus.org/>`_
|
||||
* `FontAwesome 5.15.4 <https://fontawesome.com/>`_
|
||||
* `mermaid 8.13.3 <https://github.com/mermaid-js/mermaid>`_
|
||||
* `mermaid 8.13.4 <https://github.com/mermaid-js/mermaid>`_
|
||||
* `Select2 4.0.13 <https://select2.org/>`_
|
||||
|
||||
And a set of various Rails helper methods (see below).
|
||||
|
8
init.rb
8
init.rb
@ -4,7 +4,7 @@ Redmine::Plugin.register :additionals do
|
||||
name 'Additionals'
|
||||
author 'AlphaNodes GmbH'
|
||||
description 'Customizing Redmine, providing wiki macros and act as a library/function provider for other Redmine plugins'
|
||||
version Additionals::VERSION
|
||||
version Additionals::PluginVersion::VERSION
|
||||
author_url 'https://alphanodes.com/'
|
||||
url 'https://github.com/alphanodes/additionals'
|
||||
directory __dir__
|
||||
@ -61,6 +61,8 @@ 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
|
||||
|
||||
Rails.configuration.to_prepare do
|
||||
Additionals.setup
|
||||
if Rails.version > '6.0'
|
||||
ActiveSupport.on_load(:active_record) { Additionals.setup }
|
||||
else
|
||||
Rails.configuration.to_prepare { Additionals.setup }
|
||||
end
|
||||
|
@ -1,7 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'additionals/version'
|
||||
|
||||
module Additionals
|
||||
MAX_CUSTOM_MENU_ITEMS = 5
|
||||
SELECT2_INIT_ENTRIES = 20
|
||||
@ -17,22 +15,27 @@ module Additionals
|
||||
redmine_changeauthor
|
||||
redmine_auto_watch]
|
||||
|
||||
patch %w[ApplicationController
|
||||
AutoCompletesController
|
||||
Issue
|
||||
IssuePriority
|
||||
TimeEntry
|
||||
Project
|
||||
Wiki
|
||||
ProjectsController
|
||||
WelcomeController
|
||||
ReportsController
|
||||
Principal
|
||||
Query
|
||||
QueryFilter
|
||||
Role
|
||||
User
|
||||
UserPreference]
|
||||
ApplicationController.include Additionals::Patches::ApplicationControllerPatch
|
||||
AutoCompletesController.include Additionals::Patches::AutoCompletesControllerPatch
|
||||
Issue.include Additionals::Patches::IssuePatch
|
||||
IssuePriority.include Additionals::Patches::IssuePriorityPatch
|
||||
TimeEntry.include Additionals::Patches::TimeEntryPatch
|
||||
Project.include Additionals::Patches::ProjectPatch
|
||||
Wiki.include Additionals::Patches::WikiPatch
|
||||
ProjectsController.include Additionals::Patches::ProjectsControllerPatch
|
||||
WelcomeController.include Additionals::Patches::WelcomeControllerPatch
|
||||
ReportsController.include Additionals::Patches::ReportsControllerPatch
|
||||
Principal.include Additionals::Patches::PrincipalPatch
|
||||
Query.include Additionals::Patches::QueryPatch
|
||||
QueryFilter.include Additionals::Patches::QueryFilterPatch
|
||||
Role.include Additionals::Patches::RolePatch
|
||||
User.include Additionals::Patches::UserPatch
|
||||
UserPreference.include Additionals::Patches::UserPreferencePatch
|
||||
|
||||
IssuesController.send :helper, AdditionalsIssuesHelper
|
||||
SettingsController.send :helper, AdditionalsSettingsHelper
|
||||
WikiController.send :helper, AdditionalsWikiPdfHelper
|
||||
CustomFieldsController.send :helper, AdditionalsCustomFieldsHelper
|
||||
|
||||
Redmine::WikiFormatting.format_names.each do |format|
|
||||
case format
|
||||
@ -45,11 +48,6 @@ module Additionals
|
||||
end
|
||||
end
|
||||
|
||||
IssuesController.send :helper, AdditionalsIssuesHelper
|
||||
SettingsController.send :helper, AdditionalsSettingsHelper
|
||||
WikiController.send :helper, AdditionalsWikiPdfHelper
|
||||
CustomFieldsController.send :helper, AdditionalsCustomFieldsHelper
|
||||
|
||||
# Static class patches
|
||||
Redmine::AccessControl.include Additionals::Patches::AccessControlPatch
|
||||
Redmine::AccessControl.singleton_class.prepend Additionals::Patches::AccessControlClassPatch
|
||||
@ -58,13 +56,13 @@ module Additionals
|
||||
ActionView::Base.include Additionals::Helpers
|
||||
ActionView::Base.include AdditionalsFontawesomeHelper
|
||||
ActionView::Base.include AdditionalsMenuHelper
|
||||
ActionView::Base.include Additionals::AdditionalsSelect2Helper
|
||||
|
||||
# Hooks
|
||||
require_dependency 'additionals/hooks'
|
||||
ActionView::Base.include AdditionalsSelect2Helper
|
||||
|
||||
# Macros
|
||||
load_macros
|
||||
|
||||
# Hooks
|
||||
Additionals::Hooks
|
||||
end
|
||||
|
||||
# support with default setting as fall back
|
||||
@ -132,6 +130,7 @@ module Additionals
|
||||
end
|
||||
end
|
||||
|
||||
# obsolete, do not use this method (it will be removed in next major release)
|
||||
def patch(patches = [], plugin_id = 'additionals')
|
||||
patches.each do |name|
|
||||
patch_dir = Rails.root.join "plugins/#{plugin_id}/lib/#{plugin_id}/patches"
|
||||
@ -152,6 +151,16 @@ module Additionals
|
||||
'**/*_macro.rb')].sort.each { |f| require f }
|
||||
end
|
||||
|
||||
def load_custom_field_format(plugin_id, reverse: false)
|
||||
files = Dir[File.join(plugin_dir(plugin_id),
|
||||
'lib',
|
||||
plugin_id,
|
||||
'custom_field_formats',
|
||||
'**/*_format.rb')].sort
|
||||
files.reverse! if reverse
|
||||
files.each { |f| require f }
|
||||
end
|
||||
|
||||
def plugin_dir(plugin_id = 'additionals')
|
||||
if Gem.loaded_specs[plugin_id].nil?
|
||||
File.join Redmine::Plugin.directory, plugin_id
|
||||
|
@ -1,7 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Additionals
|
||||
module Hooks
|
||||
class AdditionalsHookListener < Redmine::Hook::ViewListener
|
||||
Additionals.debug 'additonals hooks load'
|
||||
include IssuesHelper
|
||||
include AdditionalsIssuesHelper
|
||||
|
||||
@ -46,4 +48,5 @@ module Additionals
|
||||
link_to l(:label_go_to_top), '#gototop', class: 'gototop'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
7
lib/additionals/plugin_version.rb
Normal file
7
lib/additionals/plugin_version.rb
Normal file
@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Additionals
|
||||
module PluginVersion
|
||||
VERSION = '3.0.4-master'
|
||||
end
|
||||
end
|
@ -1,5 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Additionals
|
||||
VERSION = '3.0.4-master' unless defined? VERSION
|
||||
end
|
@ -2,6 +2,7 @@
|
||||
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module AsciinemaMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc 'asciinema embed'
|
||||
|
||||
@ -12,4 +13,5 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -4,6 +4,7 @@
|
||||
# see https://www.cryptocompare.com/dev/widget/wizard/
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module CryptocompareMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc <<-DESCRIPTION
|
||||
Create CryptoCompare information.
|
||||
@ -87,6 +88,7 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.crypto_default(options, name, defaults)
|
||||
if options[name].blank?
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module DateMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc <<-DESCRIPTION
|
||||
Show date.
|
||||
@ -68,4 +69,5 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module FaMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc <<-DESCRIPTION
|
||||
Show Font Awesome icon.
|
||||
@ -68,4 +69,5 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module GistMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc 'gist embed'
|
||||
|
||||
@ -12,4 +13,5 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module GmapMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc <<-DESCRIPTION
|
||||
Display a google map. Examples:
|
||||
@ -87,6 +88,7 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.gmap_flags(options, key)
|
||||
if options[key].present?
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module GoogleDocsMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc <<-DESCRIPTION
|
||||
Google docs macro to include Google documents.
|
||||
@ -52,4 +53,5 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module GroupUsersMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc <<-DESCRIPTION
|
||||
Display users of group.
|
||||
@ -32,4 +33,5 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module IframeMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc <<-DESCRIPTION
|
||||
Include iframe
|
||||
@ -45,6 +46,7 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.valid_iframe_url?(url)
|
||||
uri = URI.parse url
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module LastUpdatedAtMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc <<-DESCRIPTION
|
||||
Displays a date that updated the page.
|
||||
@ -38,4 +39,5 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module LastUpdatedByMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc <<-DESCRIPTION
|
||||
Displays a user who updated the page.
|
||||
@ -16,4 +17,5 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module MemberMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc <<-DESCRIPTION
|
||||
Display members.
|
||||
@ -76,6 +77,7 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.check_role_matches(roles, filters)
|
||||
filters.tr('|', ',').split(',').each do |filter|
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module MeteoblueMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc <<-DESCRIPTION
|
||||
Display current weather from meteoblue service. Examples:
|
||||
@ -74,6 +75,7 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.meteoblue_flag(options, name, default = tue)
|
||||
flag = +"#{name}="
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module NewIssueMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc <<-DESCRIPTION
|
||||
Create a link for "New issue" for the current user.
|
||||
@ -59,4 +60,5 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module ProjectMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc <<-DESCRIPTION
|
||||
Display projects.
|
||||
@ -36,4 +37,5 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module RecentlyUpdatedMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc <<-DESCRIPTION
|
||||
Displays a list of pages that were updated recently.
|
||||
@ -54,4 +55,5 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module RedditMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc <<-DESCRIPTION
|
||||
Creates link to reddit.
|
||||
@ -34,4 +35,5 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module RedmineIssueMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc <<-DESCRIPTION
|
||||
Creates link to redmine.org issue.
|
||||
@ -40,4 +41,5 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module RedmineWikiMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc <<-DESCRIPTION
|
||||
Creates link to redmine.org wiki page.
|
||||
@ -35,4 +36,5 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module SlideshareMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc <<-DESCRIPTION
|
||||
Slideshare macro to include Slideshare slide.
|
||||
@ -34,4 +35,5 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -3,6 +3,7 @@
|
||||
# see https://www.tradingview.com/widget/
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module TradingviewMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc <<-DESCRIPTION
|
||||
Creates Tradingview chart
|
||||
@ -36,4 +37,5 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module TwitterMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc <<-DESCRIPTION
|
||||
Creates link to twitter account page or topic.
|
||||
@ -32,4 +33,5 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module UserMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc "Display link to user profile\n\n" \
|
||||
"Syntax:\n\n" \
|
||||
@ -60,4 +61,5 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module VimeoMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc <<-DESCRIPTION
|
||||
Vimeo macro to include vimeo video.
|
||||
@ -35,4 +36,5 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
module Additionals
|
||||
module WikiMacros
|
||||
module YoutubeMacro
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
desc <<-DESCRIPTION
|
||||
Youtube macro to include youtube video.
|
||||
@ -35,4 +36,5 @@ module Additionals
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user