Defect #32754

Fix missing arrow icon of collapse macro

Added by Popoki Tom (@cat_in_136) 18 days ago. Updated 10 days ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Text formatting
Target version:4.1.1
Resolution:Fixed Affected version:4.1.0

Description

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

Steps to reproduce the issue

Just use {{collapse}} 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.):

Causes

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

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 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);}

32754-update-test.patch Magnifier (1.55 KB) Go MAEDA, 2020-01-07 15:00

0001-Fix-missing-arrow-icon-of-collapse.patch Magnifier (3.24 KB) Marius BALTEANU, 2020-01-07 15:07

Associated revisions

Revision 19409
Added by Go MAEDA 16 days ago

Fix that arrow icon for

macro is not shown (#32754).

Patch by Marius BALTEANU.

Revision 19410
Added by Go MAEDA 16 days ago

Reverts r19409 that breaks some tests (#32754).

Revision 19413
Added by Go MAEDA 16 days ago

Fix missing arrow icon of collapse macro (#32754).

Patch by Marius BALTEANU.

Revision 19424
Added by Go MAEDA 10 days ago

Merged r19413 from trunk to 4.1-stable (#32754).

History

#1 Updated by Marius BALTEANU 18 days ago

  • Assignee set to Marius BALTEANU
  • Target version set to 4.1.1

#2 Updated by Marius BALTEANU 18 days ago

  • Status changed from New to Confirmed
  • Assignee changed from Marius BALTEANU to Go MAEDA

The below changes fix the problem:

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

Thanks @Popoki Tom for reporting the issue.

#3 Updated by Popoki Tom (@cat_in_136) 18 days ago

I've confirmed that the patch written in #32754#note-2 fixes this issue.
Thank you.

#4 Updated by Go MAEDA 16 days ago

Thank you for posting the patch #32754#note-2 but it breaks some tests.

 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

#5 Updated by Go MAEDA 16 days ago

Go MAEDA wrote:

Thank you for posting the patch #32754#note-2 but it breaks some tests.

[...]

It can be fixed by applying 32754-update-test.patch.

#6 Updated by Marius BALTEANU 16 days ago

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 32754-update-test.patch.

Please use this one, all tests pass: https://gitlab.com/redmine-org/redmine/pipelines/107443098

#7 Updated by Go MAEDA 16 days ago

  • Subject changed from the arrow icon of {{collapse}} not shown on redmine 4.1.0. to Fix missing arrow icon of collapse macro
  • Category changed from Wiki to Text formatting
  • Status changed from Confirmed to Closed
  • Resolution set to Fixed

Committed the patch. Thank you for detecting and fixing the issue.

#8 Updated by Michael Gerz 11 days ago

Go MAEDA wrote:

Committed the patch. Thank you for detecting and fixing the issue.

I think it hasn’t been backported, yet.

#9 Updated by Go MAEDA 11 days ago

  • Status changed from Closed to Reopened

#10 Updated by Go MAEDA 10 days ago

  • Status changed from Reopened to Closed

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.

Also available in: Atom PDF