Skip to content

Commit

Permalink
Prepares next release (#42)
Browse files Browse the repository at this point in the history
* Added translation using Weblate (German) (#18)

* None (#23)

* Translated using OSGeo Weblate (English)

Currently translated at 100.0% (10 of 10 strings)

Translation: GTT Project/Redmine Text Blocks Plugin
Translate-URL: https://weblate.osgeo.org/projects/gtt-project/redmine_text_blocks/en/

* Translated using OSGeo Weblate (Japanese)

Currently translated at 100.0% (10 of 10 strings)

Translation: GTT Project/Redmine Text Blocks Plugin
Translate-URL: https://weblate.osgeo.org/projects/gtt-project/redmine_text_blocks/ja/

* Translated using OSGeo Weblate (German)

Currently translated at 100.0% (10 of 10 strings)

Translation: GTT Project/Redmine Text Blocks Plugin
Translate-URL: https://weblate.osgeo.org/projects/gtt-project/redmine_text_blocks/de/

Co-authored-by: Daniel Kastl <[email protected]>

* Fixes i18n format

Signed-off-by: Daniel Kastl <[email protected]>

* Lints Markdown

Signed-off-by: Daniel Kastl <[email protected]>

* Prepares minor release

Signed-off-by: Daniel Kastl <[email protected]>

* Fixes Markdown issue

Signed-off-by: Daniel Kastl <[email protected]>

* Fixes missing closing tag

Signed-off-by: Daniel Kastl <[email protected]>

* Support redmine trunk (>=r22488) build and drop ruby 2.6 from CI

* Exclude redmine:master + ruby:2.7 in CI

* Update actions/checkout@v4 to use Node.js 20

* Adds wiki-edit class to form element, fixes #35

* Replace removed jQuery api '.size()' to '.length'

* Redmine 6 compliance (#41)

* Refactor text block views and styles, add SVG icons, and update plugin version

* Remove jQuery dotdotdot plugin, update text block styles for truncation

* Update README to reflect Redmine 5.0 compatibility and improve formatting

* Update CI test for Redmine 6

* Exclude CI matrix 5.1-stable x 3.3 combination

* Update comment part in CI

---------

Co-authored-by: Ko Nagase <[email protected]>

---------

Signed-off-by: Daniel Kastl <[email protected]>
Co-authored-by: OSGeo Weblate <[email protected]>
Co-authored-by: Ko Nagase <[email protected]>
  • Loading branch information
3 people authored Dec 10, 2024
1 parent 07c904f commit 4c8c666
Show file tree
Hide file tree
Showing 14 changed files with 85 additions and 101 deletions.
38 changes: 17 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,57 +7,53 @@ on:
push:
branches:
- main
- master
- next
pull_request:
branches:
- main
- master
- next

jobs:
test:
name: redmine:${{ matrix.redmine_version }} ruby:${{ matrix.ruby_version }} db:${{ matrix.db }}
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

container:
image: ruby:${{ matrix.ruby_version }}-bullseye

strategy:
fail-fast: false
matrix:
redmine_version: [4.2-stable, 5.0-stable, master]
ruby_version: ['2.6', '2.7', '3.0', '3.1', '3.2']
redmine_version: [5.0-stable, 5.1-stable, 6.0-stable, master]
ruby_version: ['3.1', '3.2', '3.3']
db: [mysql, postgres, sqlite]
# # System test takes 2~3 times longer, so limit to specific matrix combinations
# # See: https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#expanding-or-adding-matrix-configurations
# include:
# - system_test: true
# redmine_version: master
# ruby_version: '3.1'
# ruby_version: '3.3'
# db: mysql
exclude:
- redmine_version: 4.2-stable
ruby_version: '3.0'
- redmine_version: 4.2-stable
ruby_version: '3.1'
- redmine_version: 4.2-stable
ruby_version: '3.2'
- redmine_version: 5.0-stable
ruby_version: '3.2'
- redmine_version: master
ruby_version: '2.6'
- redmine_version: 5.0-stable
ruby_version: '3.3'
- redmine_version: 5.1-stable
ruby_version: '3.3'

services:
mysql:
image: mysql:5.7 # min
# image: mysql:8.0 # latest
# image: mysql:9.1 # latest
env:
MYSQL_ROOT_PASSWORD: password
ports:
- 3306:3306
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 5
postgres:
image: postgres:10 # min
# image: postgres:15 # latest
# image: postgres:17 # latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
Expand All @@ -67,14 +63,14 @@ jobs:

steps:
- name: Checkout Redmine
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: redmine/redmine
ref: ${{ matrix.redmine_version }}
path: redmine

- name: Checkout Plugin
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: redmine/plugins/${{ env.PLUGIN_NAME }}

Expand Down Expand Up @@ -165,22 +161,22 @@ jobs:
# For system test in plugin
GOOGLE_CHROME_OPTS_ARGS: "headless,disable-gpu,no-sandbox,disable-dev-shm-usage"
working-directory: redmine
run: bundle exec rake redmine:plugins:test NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0"
run: bundle exec rails test plugins/redmine_text_blocks/test

# - name: Run core tests
# env:
# RAILS_ENV: test
# PARALLEL_WORKERS: 1
# working-directory: redmine
# run: bundle exec rake test
# run: bundle exec rails test

# - name: Run core system tests
# if: matrix.system_test == true
# env:
# RAILS_ENV: test
# GOOGLE_CHROME_OPTS_ARGS: "headless,disable-gpu,no-sandbox,disable-dev-shm-usage"
# working-directory: redmine
# run: bundle exec rake test:system
# run: bundle exec rails test:system

- name: Run uninstall test
env:
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ This plugin adds configurable text blocks for replying to issues.

## Requirements

- Redmine >= 4.0.0
- Redmine >= 5.0.0

## Installation

To install Redmine text blocks plugin, download or clone this repository in your Redmine installation plugins directory!
To install Redmine text blocks plugin, download or clone this repository in your
Redmine installation plugins directory!

```sh
cd path/to/plugin/directory
Expand All @@ -26,26 +27,25 @@ bundle install
bundle exec rake redmine:plugins:migrate
```

After restarting Redmine, you should be able to see the Redmine Text Blocks plugin in the Plugins page.
After restarting Redmine, you should be able to see the Redmine Text Blocks
plugin in the Plugins page.

More information on installing (and uninstalling) Redmine plugins can be found in [Redmine Plugins](http://www.redmine.org/wiki/redmine/Plugins) documentation.
More information on installing (and uninstalling) Redmine plugins can be found in
[Redmine Plugins](http://www.redmine.org/wiki/redmine/Plugins) documentation.

## How to use

[Settings, screenshots, etc.]

## Contributing and Support

The Text Blocks Project appreciates any [contributions](https://github.com/gtt-project/.github/blob/main/CONTRIBUTING.md)! Feel free to contact us for [reporting problems and support](https://github.com/gtt-project/.github/blob/main/CONTRIBUTING.md).
The Text Blocks Project appreciates any [contributions](https://github.com/gtt-project/.github/blob/main/CONTRIBUTING.md)!
Feel free to contact us for [reporting problems and support](https://github.com/gtt-project/.github/blob/main/CONTRIBUTING.md).

## Version History

- 2.0.0 Support Redmine 5.0
- 1.2.0 Publish on GitHub
- 1.0.2 Fixes localization
- 1.0.1 Bugfix

See [all releases](https://github.com/gtt-project/redmine_text_blocks/releases) with release notes.
See [all releases](https://github.com/gtt-project/redmine_text_blocks/releases)
with release notes.

## Authors

Expand Down
2 changes: 1 addition & 1 deletion app/models/text_block.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class TextBlock < ActiveRecord::Base
class TextBlock < (defined?(ApplicationRecord) == 'constant' ? ApplicationRecord : ActiveRecord::Base)
belongs_to :project
has_and_belongs_to_many :issue_statuses
acts_as_positioned :scope => [:project_id]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% if User.current.allowed_to?(:view_text_blocks, @project) %>
<%= select_tag :text_block, text_block_options(@issue), id: 'textblock-select', style: 'display:none; border: 1px solid #e0e2e3; background: #f6f6f6; height: 24px; color: #3d454c; vertical-align: bottom; margin-left: 6px; margin-botton: 0;' %>
<%= select_tag :text_block, text_block_options(@issue), id: 'textblock-select' %>
<%= javascript_include_tag 'text_blocks', plugin: 'redmine_text_blocks' %>
<%= hidden_field_tag :text_block_project_id, @project.id %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/text_blocks/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<div class="box tabular">
<p><%= f.text_field :name, required: true, size: 25 %></p>
<p><%= f.text_area :text, label: l(:field_text_block_text), rows: 10 %></p>
<p><%= f.text_area :text, label: l(:field_text_block_text), rows: 10, class: 'wiki-edit' %></p>
<p>
<%= content_tag :label, l(:label_issue_status_plural) %>
<%= f.collection_select :issue_status_ids,
Expand Down
14 changes: 0 additions & 14 deletions app/views/text_blocks/_list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,7 @@
<% end %>

<%= content_for :header_tags do %>
<%= javascript_include_tag 'jquery.dotdotdot', plugin: 'redmine_text_blocks' %>
<%= javascript_tag do %>
$(document).ready(function() {
$("table.list.textblocks tbody td.text div").dotdotdot({
watch: 'window',
});

// make sure text is shortened when it was initially hidden and just
// becomes visible due to Redmine's tabbing in project settings:
var origShowTab = window.showTab;
window.showTab = function(name, url){
origShowTab(name, url);
$("table.list.textblocks tbody td.text div").trigger('update.dot');
}
});
$(function() {
$("table.textblocks tbody").positionedItems();
});
Expand Down
4 changes: 2 additions & 2 deletions app/views/text_blocks/_text_block.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<tr>
<td><%= link_to text_block.name, (text_block.project ? edit_project_text_block_path(text_block.project, text_block) : edit_text_block_path(text_block)) %></td>
<td class="text"><div><%= textilizable text_block.text %></div></td>
<td class="text"><div>
<td class="text"><div class="truncated"><%= textilizable text_block.text %></div></td>
<td class="text"><div class="truncated">
<% text_block.issue_statuses.pluck(:name).map do |s| %>
<%= textilizable s %>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/text_blocks/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="contextual">
<%= link_to l(:label_text_block_new), new_text_block_path, class: 'icon icon-add' %>
<%= link_to (Redmine::VERSION.to_s >= '6.0.0') ? sprite_icon('add', l(:label_text_block_new)) : l(:label_text_block_new), new_text_block_path, :class => 'icon icon-add' %>
</div>

<h2><%= l :label_text_block_plural %></h2>
Expand Down
12 changes: 12 additions & 0 deletions assets/images/icons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 0 additions & 24 deletions assets/javascripts/jquery.dotdotdot.js

This file was deleted.

3 changes: 1 addition & 2 deletions assets/javascripts/text_blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ var TextBlocks = {
var value = $(this).val();
if(value == '') return;

console.log(value);
var fieldId = $('#textblock-select').parents().next('div.jstEditor').find('textarea').attr('id');

var field = document.getElementById(fieldId);
Expand All @@ -36,7 +35,7 @@ var TextBlocks = {

reload: function(e){
var projectId = null
if ($("#issue_project_id").size() > 0) {
if ($("#issue_project_id").length > 0) {
projectId = $("#issue_project_id").val()
} else {
projectId = $("#text_block_project_id").val()
Expand Down
35 changes: 27 additions & 8 deletions assets/stylesheets/text_blocks.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,53 @@
/* ICONS
/**************************************************************/

#admin-menu a.text-blocks { background-image: url(../images/text_signature.png);}

.icon-text-blocks:not(:has(svg)) { background-image: url(../images/text_signature.png); }

/**************************************************************/
/* TextBlocks table
/**************************************************************/

table.list.textblocks tbody td { vertical-align: top; }
table.list.textblocks tbody td.text { text-align: left; }
table.list.textblocks tbody td.text div { height: 3.8em; }


/**************************************************************/
/* TextBlocks template selector
/**************************************************************/

select#textblock-select {
display: none;
border: 1px solid #e0e2e3;
background-color: #f7f7f7;
}

div.jstElements {
display: inline-flex;
}

@media all and (max-width: 899px) {
table.textblocks th {
min-width: 100px; /* to ensure columns don't get too narrow */
}

table.textblocks .truncated {
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;

/* Number of lines to show */
-webkit-line-clamp: 3;
line-clamp: 3;
}

@media all and (max-width: 1099px) {
#textblock-select {
order: -1
order: -1;
margin-right: 6px;
}
}

@media all and (min-width: 900px) {
@media all and (min-width: 1100px) {
#textblock-select {
order: 1
order: 1;
margin-left: 6px;
}
}
2 changes: 2 additions & 0 deletions config/icon_source.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- name: text-blocks
svg: template
24 changes: 9 additions & 15 deletions init.rb
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
require File.expand_path('../lib/redmine_text_blocks/view_hooks', __FILE__)

if Rails.version > '6.0' && Rails.autoloaders.zeitwerk_enabled?
Rails.application.config.after_initialize do
RedmineTextBlocks.setup
end
else
require 'redmine_text_blocks'
Rails.configuration.to_prepare do
RedmineTextBlocks.setup
end
end
require_relative 'lib/redmine_text_blocks/view_hooks'

Redmine::Plugin.register :redmine_text_blocks do
name 'Redmine Text Blocks Plugin'
author 'Jens Krämer, Georepublic'
author_url 'https://github.com/georepublic'
url 'https://github.com/gtt-project/redmine_text_blocks'
description 'Adds configurable text blocks for replying to issues'
version '2.0.1'
version '3.0.0'

requires_redmine version_or_higher: '4.0.0'
requires_redmine version_or_higher: '5.0.0'

#settings default: {
#}, partial: 'redmine_text_blocks/settings'
Expand All @@ -35,5 +24,10 @@

menu :admin_menu, :text_blocks,
{ controller: 'text_blocks', action: 'index' },
caption: :label_text_block_plural, :html => {:class => 'icon icon-text-blocks'}
caption: :label_text_block_plural, :html => {:class => 'icon icon-text-blocks'},
:icon => 'text-blocks', :plugin => :redmine_text_blocks
end

Rails.application.config.after_initialize do
RedmineTextBlocks.setup
end

0 comments on commit 4c8c666

Please sign in to comment.