Skip to content

Commit

Permalink
working on redmine 6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandermeindl committed Nov 10, 2024
1 parent 3c459f9 commit b5d483c
Show file tree
Hide file tree
Showing 28 changed files with 64 additions and 338 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@ jobs:

strategy:
matrix:
ruby: ['3.1', '3.2']
redmine: ['5.0-stable', '5.1-stable', 'master']
ruby: ['3.1', '3.2', '3.3']
redmine: ['6.0-stable', 'master']
db: ['postgres', 'mysql']
exclude:
- ruby: '3.2'
redmine: 5.0-stable
fail-fast: false

services:
Expand Down
3 changes: 1 addition & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require:

AllCops:
TargetRubyVersion: 3.1
TargetRailsVersion: 6.1
TargetRailsVersion: 7.2
NewCops: enable
ActiveSupportExtensionsEnabled: true

Expand Down Expand Up @@ -82,7 +82,6 @@ Style/AutoResourceCleanup:
Style/ExpandPathArguments:
Enabled: true
Exclude:
- additionals.gemspec
- test/**/*

Style/FrozenStringLiteralComment:
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## 4.0.0

- Support for Redmine 6
- Redmine 5 support dropped
- Gemify support dropped

## 3.4.0

Expand Down
7 changes: 5 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# frozen_string_literal: true

# Specify your gem's dependencies in additionals.gemspec
gemspec
gem 'redmine_plugin_kit'
gem 'render_async'
gem 'rss'
gem 'slim-rails'
gem 'tanuki_emoji', '~> 0.13.0'

# this is only used for local development.
# if you want to use it, do:
Expand Down
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ Additionals is a `Redmine` plugin for customizing Redmine, providing wiki macros

| Name | requirement |
| -------------------|----------------------------------|
| `Redmine` version | >= 5.0 |
| `Redmine` version | >= 6.0 |
| `Ruby` version | >= 3.1 |
| Database version | MySQL >= 8.0 or PostgreSQL >= 10 |
| Database version | MySQL >= 8.0 or PostgreSQL >= 14 |

> **_NOTE:_** If you use MySQL, make sure all database tables using the same storage engine (InnoDB is recommended) and character set (utf8mb4 is recommended).
> **_NOTE:_** For more information use the official [Redmine install documentation](https://www.redmine.org/projects/redmine/wiki/RedmineInstall)
Expand All @@ -30,7 +30,7 @@ Install `additionals` plugin for `Redmine`.
bundle exec rake redmine:plugins:migrate RAILS_ENV=production
```

Restart your application server (apache with passenger, nginx with passenger, unicorn, puma, etc.) and *Additionals* is ready to use.
Restart your application server (apache with passenger, nginx with passenger, unicorn, puma, etc.) and `additionals` is ready to use.

More information about installation of Redmine plugins, you can find in the official [Redmine plugin documentation](https://www.redmine.org/projects/redmine/wiki/Plugins>).

Expand All @@ -55,7 +55,6 @@ Uninstall `additionals` plugin.
```shell
cd $REDMINE_ROOT
bundle exec rake redmine:plugins:migrate NAME=additionals VERSION=0 RAILS_ENV=production
rm -rf plugins/additionals public/plugin_assets/additionals
```

## Features
Expand Down Expand Up @@ -101,7 +100,7 @@ Uninstall `additionals` plugin.
* anonymize referrer for external urls
* hide role in project memberbox
* limitation of the number of attachments that are displayed as a preview in the issue
* Auto watch option *Issues assigned to me*
* Auto watch option _Issues assigned to me_
* change issue author
* create issue on user profile
* "assign to me" link on issue
Expand Down Expand Up @@ -161,7 +160,7 @@ The following modules are available :
* mermaid
* select2

### Redmine Plugins, which are using *additionals*
### Redmine Plugins, which are using _additionals_

* [additional_tags](https://github.com/alphanodes/additional_tags)
* [redmine_automation](https://alphanodes.com/redmine-automation)
Expand All @@ -179,11 +178,11 @@ The following modules are available :
* [redmine_sudo](https://github.com/alphanodes/redmine_sudo)
* [redmine_wiki_guide](https://alphanodes.com/redmine-wiki-guide)

If you know other plugins, which are using *additionals*, please let us know or create a [PR](https://github.com/alphanodes/additionals/pulls).
If you know other plugins, which are using `additionals`, please let us know or create a [PR](https://github.com/alphanodes/additionals/pulls).

## You need a feature

*additionals* is [Open-source](https://opensource.org/osd) and it is available at <https://github.com/alphanodes/additionals>
`additionals` is [Open-source](https://opensource.org/osd) and it is available at <https://github.com/alphanodes/additionals>

If you want to implement new features in it or if you want to change something, you can provide a pull request.

Expand All @@ -193,7 +192,7 @@ We are an `Open-source`_ service company from Munich. Among other things, we off

## Additionals plugin manual

The plugin configuration takes place in the administration area by a user with administration permission. Go to *Plugins / Additionals* to open it.
The plugin configuration takes place in the administration area by a user with administration permission. Go to _Plugins / Additionals_ to open it.

The additionals plugin configuration is divided into several sections, described below.

Expand Down Expand Up @@ -265,7 +264,7 @@ Global wiki sidebar

Redmine macros can be used in the Wiki of a project or in the text area of an issue. For more information on how to add macros use the Redmine help documentation.

The *Macros section* of the additionals plugin lists all available macros that the logged in user can use with the *macro button* of the wiki toolbar. If you leave them deactivated they are all available to your users for selection.
The _Macros section_ of the additionals plugin lists all available macros that the logged in user can use with the _macro button_ of the wiki toolbar. If you leave them deactivated they are all available to your users for selection.

Macros marked here are not offered for selection. This allows you to limit the scope of the list for a better usability.

Expand Down
32 changes: 0 additions & 32 deletions additionals.gemspec

This file was deleted.

16 changes: 1 addition & 15 deletions app/helpers/additionals_icons_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,7 @@ def svg_icon_tag(icon_name,
end

def additionals_asset_path(file)
plugin_id = 'additionals'

if Additionals.redmine6?
asset_path "plugin_assets/#{plugin_id}/#{file}"
else
"#{additionals_image_path plugin_id}/#{file}"
end
end

def additionals_image_path(plugin_id)
return asset_path if Additionals.redmine6?
return @additionals_image_path if defined? @additionals_image_path

relative_url = Redmine::Utils.relative_url_root
@additionals_image_path = "#{relative_url}/plugin_assets/#{plugin_id}/images"
asset_path "plugin_assets/additionals/#{file}"
end

private
Expand Down
17 changes: 0 additions & 17 deletions app/jobs/additionals_job.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/models/additionals_application_record.rb

This file was deleted.

2 changes: 1 addition & 1 deletion app/models/dashboard.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class Dashboard < AdditionalsApplicationRecord
class Dashboard < ApplicationRecord
include Redmine::I18n
include Redmine::SafeAttributes
include Additionals::EntityMethods
Expand Down
2 changes: 1 addition & 1 deletion app/models/dashboard_role.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class DashboardRole < AdditionalsApplicationRecord
class DashboardRole < ApplicationRecord
include Redmine::SafeAttributes

belongs_to :dashboard
Expand Down
18 changes: 5 additions & 13 deletions app/overrides/wiki_edit.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
# frozen_string_literal: true

module WikiEdit
if Additionals.redmine6?
Deface::Override.new virtual_path: 'wiki/edit',
name: 'wiki-edit',
insert_before: 'fieldset',
original: '8c202edfea8a0a74e4c3c0c4ae53e129b1d2b1ee',
partial: 'hooks/view_wiki_form_bottom'
else
Deface::Override.new virtual_path: 'wiki/edit',
name: 'wiki-edit',
insert_before: 'fieldset',
original: 'ededb6cfd5adfe8a9723d00ce0ee23575c7cc44c',
partial: 'hooks/view_wiki_form_bottom'
end
Deface::Override.new virtual_path: 'wiki/edit',
name: 'wiki-edit',
insert_before: 'fieldset',
original: '8c202edfea8a0a74e4c3c0c4ae53e129b1d2b1ee',
partial: 'hooks/view_wiki_form_bottom'
end
21 changes: 6 additions & 15 deletions app/overrides/wiki_show.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
# frozen_string_literal: true

module WikiShow
if Redmine::VERSION.to_s < '5.1'
Deface::Override.new virtual_path: 'wiki/show',
name: 'wiki-show',
sequence: 1,
insert_before: 'p.wiki-update-info',
original: 'd9f52aa98f1cb335314570d3f5403690f1b29145',
partial: 'hooks/view_wiki_show_bottom'
else
Deface::Override.new virtual_path: 'wiki/show',
name: 'wiki-show',
sequence: 1,
insert_before: 'p.wiki-update-info',
original: '39c0ff8f0b6a468264526af5046c3c6db7e94997',
partial: 'hooks/view_wiki_show_bottom'
end
Deface::Override.new virtual_path: 'wiki/show',
name: 'wiki-show',
sequence: 1,
insert_before: 'p.wiki-update-info',
original: '39c0ff8f0b6a468264526af5046c3c6db7e94997',
partial: 'hooks/view_wiki_show_bottom'
end
2 changes: 1 addition & 1 deletion app/views/additionals/_export_options.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
= column.caption

= export_csv_encoding_select_tag
= export_csv_separator_select_tag if Redmine::VERSION.to_s >= '5.1'
= export_csv_separator_select_tag

- if @issue_count && @issue_count > Setting.issues_export_limit.to_i || \
@query_count && query.export_limit && @query_count > query.export_limit
Expand Down
3 changes: 1 addition & 2 deletions app/views/additionals_journals/update.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
$("#journal-<%= @journal.id %>-notes").replaceWith('<%= escape_javascript(render_notes(nil, @journal)) %>');
$("#journal-<%= @journal.id %>-notes").show();
$("#journal-<%= @journal.id %>-form").remove();
<% if Redmine::VERSION.to_s >= '5.1' %>

var journal_header = $("#change-<%= @journal.id %> h4");
var journal_updated_info = journal_header.find("span.update-info");
if (journal_updated_info.length > 0) {
journal_updated_info.replaceWith('<%= escape_javascript(render_journal_update_info(@journal)) %>');
} else {
journal_header.append('<%= escape_javascript(render_journal_update_info(@journal)) %>');
}
<% end %>
<% end %>
6 changes: 3 additions & 3 deletions app/views/projects/show.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
= link_to l(:label_subproject_new), new_project_path(parent_id: @project), class: 'icon icon-add'
- if User.current.allowed_to? :close_project, @project
- if @project.active?
- confirm_msg = Redmine::VERSION.to_s >= '5.1' ? l(:text_project_close_confirmation, @project.to_s) : l(:text_are_you_sure)
- confirm_msg = l :text_project_close_confirmation, @project.to_s
= link_to l(:button_close),
close_project_path(@project),
data: { confirm: - confirm_msg }, method: :post, class: 'icon icon-lock'
- else
- confirm_msg = Redmine::VERSION.to_s >= '5.1' ? l(:text_project_reopen_confirmation, @project.to_s) : l(:text_are_you_sure)
- confirm_msg = l :text_project_reopen_confirmation, @project.to_s
= link_to l(:button_reopen),
reopen_project_path(@project),
data: { confirm: confirm_msg }, method: :post, class: 'icon icon-unlock'
Expand All @@ -32,7 +32,7 @@
unarchive_project_path(@project, status: params[:status]),
method: :post, class: 'icon icon-unlock'
- else
- confirm_msg = Redmine::VERSION.to_s >= '5.1' ? l(:text_project_archive_confirmation, @project.to_s) : l(:text_are_you_sure)
- confirm_msg = l :text_project_archive_confirmation, @project.to_s
= link_to l(:button_archive),
archive_project_path(@project, status: params[:status]),
data: { confirm: confirm_msg }, method: :post, class: 'icon icon-lock'
Expand Down
8 changes: 2 additions & 6 deletions init.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
# frozen_string_literal: true

require 'additionals/plugin_version'

loader = RedminePluginKit::Loader.new plugin_id: 'additionals'

Redmine::Plugin.register :additionals do
name 'Additionals'
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'
version Additionals::PluginVersion::VERSION
version Additionals::VERSION
author_url 'https://alphanodes.com/'
url 'https://github.com/alphanodes/additionals'
directory File.dirname(__FILE__)

settings default: loader.default_settings,
partial: 'additionals/settings/additionals'
Expand Down Expand Up @@ -42,8 +39,7 @@
permission :log_time_on_closed_issues, {}
end

# required redmine version
requires_redmine version_or_higher: '5.0'
requires_redmine version_or_higher: '5.1' # redmine 6.0 is required, but version is not set in redmine source yet

menu :admin_menu, :additionals, { controller: 'settings', action: 'plugin', id: 'additionals' }, caption: :label_additionals
end
Expand Down
Loading

0 comments on commit b5d483c

Please sign in to comment.