Mercurial > hg > soundsoftware-site
comparison lib/redmine/wiki_formatting/macros.rb @ 1517:dffacf8a6908 redmine-2.5
Update to Redmine SVN revision 13367 on 2.5-stable branch
author | Chris Cannam |
---|---|
date | Tue, 09 Sep 2014 09:29:00 +0100 |
parents | e248c7af89ec |
children |
comparison
equal
deleted
inserted
replaced
1516:b450a9d58aed | 1517:dffacf8a6908 |
---|---|
219 hide_label = args[1] || args[0] || l(:button_hide) | 219 hide_label = args[1] || args[0] || l(:button_hide) |
220 js = "$('##{html_id}-show, ##{html_id}-hide').toggle(); $('##{html_id}').fadeToggle(150);" | 220 js = "$('##{html_id}-show, ##{html_id}-hide').toggle(); $('##{html_id}').fadeToggle(150);" |
221 out = ''.html_safe | 221 out = ''.html_safe |
222 out << link_to_function(show_label, js, :id => "#{html_id}-show", :class => 'collapsible collapsed') | 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;') | 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;') | 224 out << content_tag('div', textilizable(text, :object => obj, :headings => false), :id => html_id, :class => 'collapsed-text', :style => 'display:none;') |
225 out | 225 out |
226 end | 226 end |
227 | 227 |
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>" | 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>" |
229 macro :thumbnail do |obj, args| | 229 macro :thumbnail do |obj, args| |
234 raise 'Invalid size parameter' unless size.nil? || size.match(/^\d+$/) | 234 raise 'Invalid size parameter' unless size.nil? || size.match(/^\d+$/) |
235 size = size.to_i | 235 size = size.to_i |
236 size = nil unless size > 0 | 236 size = nil unless size > 0 |
237 if obj && obj.respond_to?(:attachments) && attachment = Attachment.latest_attach(obj.attachments, filename) | 237 if obj && obj.respond_to?(:attachments) && attachment = Attachment.latest_attach(obj.attachments, filename) |
238 title = options[:title] || attachment.title | 238 title = options[:title] || attachment.title |
239 img = image_tag(url_for(:controller => 'attachments', :action => 'thumbnail', :id => attachment, :size => size), :alt => attachment.filename) | 239 thumbnail_url = url_for(:controller => 'attachments', :action => 'thumbnail', :id => attachment, :size => size, :only_path => false) |
240 link_to(img, url_for(:controller => 'attachments', :action => 'show', :id => attachment), :class => 'thumbnail', :title => title) | 240 image_url = url_for(:controller => 'attachments', :action => 'show', :id => attachment, :only_path => false) |
241 | |
242 img = image_tag(thumbnail_url, :alt => attachment.filename) | |
243 link_to(img, image_url, :class => 'thumbnail', :title => title) | |
241 else | 244 else |
242 raise "Attachment #{filename} not found" | 245 raise "Attachment #{filename} not found" |
243 end | 246 end |
244 end | 247 end |
245 end | 248 end |