diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 61b29e740..b6874757c 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1012,7 +1012,7 @@ module ApplicationHelper
div_class = 'toc'
div_class << ' right' if right_align
div_class << ' left' if left_align
- out = "
- "
+ out = "
- #{l :label_table_of_contents}
- "
root = headings.map(&:first).min
current = root
started = false
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 60db8a608..b5e3be046 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -1210,6 +1210,7 @@ de:
label_new_project_issue_tab_enabled: Tab "Neues Ticket" anzeigen
setting_new_item_menu_tab: Menü zum Anlegen neuer Objekte
label_new_object_tab_enabled: Dropdown-Menü "+" anzeigen
+ label_table_of_contents: Inhaltsverzeichnis
error_no_projects_with_tracker_allowed_for_new_issue: There are no projects with trackers
for which you can create an issue
field_textarea_font: Font used for text areas
diff --git a/config/locales/en.yml b/config/locales/en.yml
index eae146951..e0ebe3bf1 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1000,6 +1000,7 @@ en:
label_relations: Relations
label_new_project_issue_tab_enabled: Display the "New issue" tab
label_new_object_tab_enabled: Display the "+" drop-down
+ label_table_of_contents: Table of contents
label_font_default: Default font
label_font_monospace: Monospaced font
label_font_proportional: Proportional font
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 95c5bf9dc..69cc6b896 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -1009,6 +1009,7 @@ fr:
label_relations: Relations
label_new_project_issue_tab_enabled: Afficher l'onglet "Nouvelle demande"
label_new_object_tab_enabled: Afficher le menu déroulant "+"
+ label_table_of_contents: Contenu
label_font_default: Police par défaut
label_font_monospace: Police non proportionnelle
label_font_proportional: Police proportionnelle
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index 278fbc522..e3cde7c8b 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -1013,6 +1013,7 @@ div.wiki ul.toc.right { float: right; margin-left: 12px; margin-right: 0; width:
div.wiki ul.toc.left { float: left; margin-right: 12px; margin-left: 0; width: auto; }
div.wiki ul.toc ul { margin: 0; padding: 0; }
div.wiki ul.toc li {list-style-type:none; margin: 0; font-size:12px;}
+div.wiki ul.toc>li:first-child {margin-bottom: .5em; color: #777;}
div.wiki ul.toc li li {margin-left: 1.5em; font-size:10px;}
div.wiki ul.toc a {
font-size: 0.9em;
diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb
index 064d4141c..f1d98cbd8 100644
--- a/test/unit/helpers/application_helper_test.rb
+++ b/test/unit/helpers/application_helper_test.rb
@@ -1092,6 +1092,8 @@ EXPECTED
end
def test_table_of_content
+ set_language_if_valid 'en'
+
raw = <<-RAW
{{toc}}
@@ -1124,6 +1126,7 @@ h2. "Project Name !/attachments/1234/logo_small.gif! !/attachments/5678/logo_2.p
RAW
expected = '
' +
+ '- Table of contents
' +
'- Title' +
'
' +
'- Subtitle with a Wiki link
' +
@@ -1153,6 +1156,8 @@ RAW
end
def test_table_of_content_should_generate_unique_anchors
+ set_language_if_valid 'en'
+
raw = <<-RAW
{{toc}}
@@ -1164,6 +1169,7 @@ h2. Subtitle
RAW
expected = '' +
+ '- Table of contents
' +
'- Title' +
'
' +
'- Subtitle
' +
@@ -1180,6 +1186,8 @@ RAW
end
def test_table_of_content_should_contain_included_page_headings
+ set_language_if_valid 'en'
+
raw = <<-RAW
{{toc}}
@@ -1189,6 +1197,7 @@ h1. Included
RAW
expected = ''
diff --git a/test/unit/lib/redmine/wiki_formatting/macros_test.rb b/test/unit/lib/redmine/wiki_formatting/macros_test.rb
index 1a7b93021..d2d04dc47 100644
--- a/test/unit/lib/redmine/wiki_formatting/macros_test.rb
+++ b/test/unit/lib/redmine/wiki_formatting/macros_test.rb
@@ -239,6 +239,8 @@ class Redmine::WikiFormatting::MacrosTest < Redmine::HelperTest
end
def test_macro_collapse_should_not_break_toc
+ set_language_if_valid 'en'
+
text = <<-RAW
{{toc}}
@@ -249,7 +251,7 @@ h2. Heading
}}"
RAW
- expected_toc = ''
+ expected_toc = ''
assert_include expected_toc, textilizable(text).gsub(/[\r\n]/, '')
end