@@ -933,6 +933,7 en: | |||
|
933 | 933 | button_quote: Quote |
|
934 | 934 | button_duplicate: Duplicate |
|
935 | 935 | button_show: Show |
|
936 | button_hide: Hide | |
|
936 | 937 | button_edit_section: Edit this section |
|
937 | 938 | button_export: Export |
|
938 | 939 | button_delete_my_account: Delete my account |
@@ -907,6 +907,7 fr: | |||
|
907 | 907 | button_quote: Citer |
|
908 | 908 | button_duplicate: Dupliquer |
|
909 | 909 | button_show: Afficher |
|
910 | button_hide: Cacher | |
|
910 | 911 | button_edit_section: Modifier cette section |
|
911 | 912 | button_export: Exporter |
|
912 | 913 | button_delete_my_account: Supprimer mon compte |
@@ -212,6 +212,19 module Redmine | |||
|
212 | 212 | out |
|
213 | 213 | end |
|
214 | 214 | |
|
215 | desc "Inserts of collapsed block of text. Example:\n\n {{collapse(View details...)\nThis is a block of text that is collapsed by default.\nIt can be expanded by clicking a link.\n}}" | |
|
216 | macro :collapse do |obj, args, text| | |
|
217 | html_id = "collapse-#{Redmine::Utils.random_hex(4)}" | |
|
218 | show_label = args[0] || l(:button_show) | |
|
219 | hide_label = args[1] || args[0] || l(:button_hide) | |
|
220 | js = "$('##{html_id}-show, ##{html_id}-hide').toggle(); $('##{html_id}').fadeToggle(150);" | |
|
221 | out = ''.html_safe | |
|
222 | out << link_to_function(show_label, js, :id => "#{html_id}-show", :class => 'collapsible collapsed') | |
|
223 | out << link_to_function(hide_label, js, :id => "#{html_id}-hide", :class => 'collapsible', :style => 'display:none;') | |
|
224 | out << content_tag('div', textilizable(text, :object => obj), :id => html_id, :class => 'collapsed-text', :style => 'display:none;') | |
|
225 | out | |
|
226 | end | |
|
227 | ||
|
215 | 228 | desc "Displays a clickable thumbnail of an attached image. Examples:\n\n<pre>{{thumbnail(image.png)}}\n{{thumbnail(image.png, size=300, title=Thumbnail)}}</pre>" |
|
216 | 229 | macro :thumbnail do |obj, args| |
|
217 | 230 | args, options = extract_macro_options(args, :size, :title) |
@@ -185,6 +185,11 class ActiveSupport::TestCase | |||
|
185 | 185 | assert !s.include?(expected), "\"#{expected}\" found in \"#{s}\"" |
|
186 | 186 | end |
|
187 | 187 | |
|
188 | def assert_select_in(text, *args, &block) | |
|
189 | d = HTML::Document.new(CGI::unescapeHTML(String.new(text))).root | |
|
190 | assert_select(d, *args, &block) | |
|
191 | end | |
|
192 | ||
|
188 | 193 | def assert_mail_body_match(expected, mail) |
|
189 | 194 | if expected.is_a?(String) |
|
190 | 195 | assert_include expected, mail_body(mail) |
@@ -180,6 +180,36 class Redmine::WikiFormatting::MacrosTest < ActionView::TestCase | |||
|
180 | 180 | assert_include 'Page not found', textilizable(text) |
|
181 | 181 | end |
|
182 | 182 | |
|
183 | def test_macro_collapse | |
|
184 | text = "{{collapse\n*Collapsed* block of text\n}}" | |
|
185 | result = textilizable(text) | |
|
186 | ||
|
187 | assert_select_in result, 'div.collapsed-text' | |
|
188 | assert_select_in result, 'strong', :text => 'Collapsed' | |
|
189 | assert_select_in result, 'a.collapsible.collapsed', :text => 'Show' | |
|
190 | assert_select_in result, 'a.collapsible', :text => 'Hide' | |
|
191 | end | |
|
192 | ||
|
193 | def test_macro_collapse_with_one_arg | |
|
194 | text = "{{collapse(Example)\n*Collapsed* block of text\n}}" | |
|
195 | result = textilizable(text) | |
|
196 | ||
|
197 | assert_select_in result, 'div.collapsed-text' | |
|
198 | assert_select_in result, 'strong', :text => 'Collapsed' | |
|
199 | assert_select_in result, 'a.collapsible.collapsed', :text => 'Example' | |
|
200 | assert_select_in result, 'a.collapsible', :text => 'Example' | |
|
201 | end | |
|
202 | ||
|
203 | def test_macro_collapse_with_two_args | |
|
204 | text = "{{collapse(Show example, Hide example)\n*Collapsed* block of text\n}}" | |
|
205 | result = textilizable(text) | |
|
206 | ||
|
207 | assert_select_in result, 'div.collapsed-text' | |
|
208 | assert_select_in result, 'strong', :text => 'Collapsed' | |
|
209 | assert_select_in result, 'a.collapsible.collapsed', :text => 'Show example' | |
|
210 | assert_select_in result, 'a.collapsible', :text => 'Hide example' | |
|
211 | end | |
|
212 | ||
|
183 | 213 | def test_macro_child_pages |
|
184 | 214 | expected = "<p><ul class=\"pages-hierarchy\">\n" + |
|
185 | 215 | "<li><a href=\"/projects/ecookbook/wiki/Child_1\">Child 1</a>\n" + |
General Comments 0
You need to be logged in to leave comments.
Login now