プロジェクト

全般

プロフィール

Vote #80574

完了

Fix missing arrow icon of collapse macro

Admin Redmine さんが約2年前に追加. 約2年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Text formatting_26
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
26
version_id:
160
issue_org_id:
32754
author_id:
142320
assigned_to_id:
332
comments:
10
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
127
ステータス-->[Closed]

説明

When @表示

@ macro used in the wiki text, a small arrow icon should be displayed but actually is not displayed on redmine 4.1.0.

h3. Steps to reproduce the issue

Just use @表示

@ macro in the wiki text. For example,

{{collapse
foobar
}}

Arrow icon should be displayed. You can see right behavior here (because redmine.org does not use redmine 4.1.):

表示

h3. Causes

This is obviously a degrade due to #31433. r18204 removes arrow icons from @.collapsible@.

h3. Workaround

Add following CSS rules.


.wiki a.collapsible {padding-left: 12px; background: url(../images/arrow_down.png) no-repeat 0px 50%;}
.wiki a.collapsible.collapsed {background-image: url(../images/arrow_right.png);}

Note that: The icon path should be change to the absolute path if you add the snippet to your theme or the "view_customize":https://github.com/onozaty/redmine-view-customize rule.


.wiki a.collapsible {padding-left: 12px; background: url(/images/arrow_down.png) no-repeat 0px 50%;}
.wiki a.collapsible.collapsed {background-image: url(/images/arrow_right.png);}

journals

--------------------------------------------------------------------------------
The below changes fix the problem:

<pre><code class="diff">
mariusbalteanu@Mariuss-MacBook-Pro redmine % git diff
diff --git a/lib/redmine/wiki_formatting/macros.rb b/lib/redmine/wiki_formatting/macros.rb
index 53276834f..0e1e4234c 100644
--- a/lib/redmine/wiki_formatting/macros.rb
+++ b/lib/redmine/wiki_formatting/macros.rb
@@ -234,8 +234,8 @@ module Redmine
hide_label = args[1] || args[0] || l(:button_hide)
js = "$('##{html_id}-show, ##{html_id}-hide').toggle(); $('##{html_id}').fadeToggle(150);"
out = ''.html_safe
- out << link_to_function(show_label, js, :id => "#{html_id}-show", :class => 'collapsible collapsed')
- out << link_to_function(hide_label, js, :id => "#{html_id}-hide", :class => 'collapsible', :style => 'display:none;')
+ out << link_to_function(show_label, js, :id => "#{html_id}-show", :class => 'icon icon-collapsed collapsible')
+ out << link_to_function(hide_label, js, :id => "#{html_id}-hide", :class => 'icon icon-expended collapsible', :style => 'display:none;')
out << content_tag('div', textilizable(text, :object => obj, :headings => false, :inline_attachments => @@inline_attachments), :id => html_id, :class => 'collapsed-text', :style => 'display:none;')
out
end
</code></pre>

Thanks @Popoki Tom for reporting the issue.
--------------------------------------------------------------------------------
I've confirmed that the patch written in #32754#note-2 fixes this issue.
Thank you.
--------------------------------------------------------------------------------
Thank you for posting the patch #32754#note-2 but it breaks some tests.

<pre>
bin/rails test test/unit/lib/redmine/wiki_formatting/macros_test.rb
Run options: --seed 46106

# Running:

.........F

Failure:
Redmine::WikiFormatting::MacrosTest#test_macro_collapse_with_one_arg [/Users/maeda/redmines/redmine-trunk/test/unit/lib/redmine/wiki_formatting/macros_test.rb:229]:
Expected at least 1 element matching "a.collapsible.collapsed", found 0..
Expected 0 to be >= 1.

bin/rails test test/unit/lib/redmine/wiki_formatting/macros_test.rb:223

....F

Failure:
Redmine::WikiFormatting::MacrosTest#test_macro_collapse_with_two_args [/Users/maeda/redmines/redmine-trunk/test/unit/lib/redmine/wiki_formatting/macros_test.rb:239]:
Expected at least 1 element matching "a.collapsible.collapsed", found 0..
Expected 0 to be >= 1.

bin/rails test test/unit/lib/redmine/wiki_formatting/macros_test.rb:233

................F

Failure:
Redmine::WikiFormatting::MacrosTest#test_macro_collapse [/Users/maeda/redmines/redmine-trunk/test/unit/lib/redmine/wiki_formatting/macros_test.rb:218]:
Expected at least 1 element matching "a.collapsible.collapsed", found 0..
Expected 0 to be >= 1.

bin/rails test test/unit/lib/redmine/wiki_formatting/macros_test.rb:211

.............

Finished in 4.373005s, 10.2904 runs/s, 16.2360 assertions/s.
45 runs, 71 assertions, 3 failures, 0 errors, 0 skips
</pre>
--------------------------------------------------------------------------------
Go MAEDA wrote:
> Thank you for posting the patch #32754#note-2 but it breaks some tests.
>
> [...]

It can be fixed by applying attachment:32754-update-test.patch.
--------------------------------------------------------------------------------
Go MAEDA wrote:
> Go MAEDA wrote:
> > Thank you for posting the patch #32754#note-2 but it breaks some tests.
> >
> > [...]
>
> It can be fixed by applying attachment:32754-update-test.patch.

Please use this one, all tests pass: https://gitlab.com/redmine-org/redmine/pipelines/107443098
--------------------------------------------------------------------------------
Committed the patch. Thank you for detecting and fixing the issue.
--------------------------------------------------------------------------------
Go MAEDA wrote:
> Committed the patch. Thank you for detecting and fixing the issue.

I think it hasn’t been backported, yet.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Michael Gerz wrote:
> I think it hasn’t been backported, yet.

You are right, thank you for pointing it out. I have just merged the change to 4.1-stable in r19424.

--------------------------------------------------------------------------------

Admin Redmine さんが約2年前に更新

  • カテゴリText formatting_26 にセット
  • 対象バージョン4.1.1_160 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0