Project

General

Profile

Actions

Defect #32754

closed

Fix missing arrow icon of collapse macro

Added by Popoki Tom (@cat_in_136) almost 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Text formatting
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

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.):

Show

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

Files

Actions #1

Updated by Marius BĂLTEANU almost 5 years ago

  • Assignee set to Marius BĂLTEANU
  • Target version set to 4.1.1
Actions #2

Updated by Marius BĂLTEANU almost 5 years ago

  • Status changed from New to Confirmed
  • Assignee changed from Marius BĂLTEANU 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.

Actions #3

Updated by Popoki Tom (@cat_in_136) almost 5 years ago

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

Actions #4

Updated by Go MAEDA almost 5 years 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
Actions #5

Updated by Go MAEDA almost 5 years 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.

Actions #6

Updated by Marius BĂLTEANU almost 5 years 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

Actions #7

Updated by Go MAEDA almost 5 years 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.

Actions #8

Updated by Michael Gerz almost 5 years ago

Go MAEDA wrote:

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

I think it hasn’t been backported, yet.

Actions #9

Updated by Go MAEDA almost 5 years ago

  • Status changed from Closed to Reopened
Actions #10

Updated by Go MAEDA almost 5 years 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.

Actions

Also available in: Atom PDF