diff --git a/app/assets/javascripts/discourse/lib/lightbox.js b/app/assets/javascripts/discourse/lib/lightbox.js index 65947d05f..8f6cb58aa 100644 --- a/app/assets/javascripts/discourse/lib/lightbox.js +++ b/app/assets/javascripts/discourse/lib/lightbox.js @@ -9,7 +9,17 @@ Discourse.Lightbox = { apply: function($elem) { $LAB.script("/javascripts/jquery.magnific-popup-min.js").wait(function() { $('a.lightbox', $elem).each(function(i, e) { - $(e).magnificPopup({ type: 'image', closeOnContentClick: true }); + $(e).magnificPopup({ + type: 'image', + closeOnContentClick: true, + + image: { + titleSrc: function(item) { + return item.el.attr('title') + ' · ' + I18n.t("lightbox.download") + ''; + } + } + + }); }); }); } diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index c2e693b70..23130ac75 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -1438,3 +1438,6 @@ en: rate_limits: 'Rate Limits' developer: 'Developer' uncategorized: 'Uncategorized' + + lightbox: + download: "download" diff --git a/lib/cooked_post_processor.rb b/lib/cooked_post_processor.rb index 62f268bca..ae940e6fb 100644 --- a/lib/cooked_post_processor.rb +++ b/lib/cooked_post_processor.rb @@ -170,6 +170,8 @@ class CookedPostProcessor informations = "#{original_width}x#{original_height}" informations << " #{number_to_human_size(upload.filesize)}" if upload + a["title"] = filename + meta.add_child create_span_node("filename", filename) meta.add_child create_span_node("informations", informations) meta.add_child create_span_node("expand") diff --git a/spec/components/cooked_post_processor_spec.rb b/spec/components/cooked_post_processor_spec.rb index 02cc21f28..683c6adfb 100644 --- a/spec/components/cooked_post_processor_spec.rb +++ b/spec/components/cooked_post_processor_spec.rb @@ -94,7 +94,7 @@ describe CookedPostProcessor do it "generates overlay information" do cpp.post_process_images - cpp.html.should match_html '
+ cpp.html.should match_html '
uploaded.jpg1000x2000 1.21 KB
' cpp.should be_dirty