add wrapper class for lightboxes

This commit is contained in:
Régis Hanol 2013-12-02 10:06:48 +01:00
parent ea835b78dc
commit 5150376e12
2 changed files with 2 additions and 1 deletions

View file

@ -147,6 +147,7 @@ class CookedPostProcessor
def add_lightbox!(img, original_width, original_height, upload=nil)
# first, create a div to hold our lightbox
lightbox = Nokogiri::XML::Node.new("div", @doc)
lightbox["class"] = "lightbox-wrapper"
img.add_next_sibling(lightbox)
lightbox.add_child(img)

View file

@ -94,7 +94,7 @@ describe CookedPostProcessor do
it "generates overlay information" do
cpp.post_process_images
cpp.html.should match_html '<div><a href="/uploads/default/1/1234567890123456.jpg" class="lightbox" title="uploaded.jpg"><img src="/uploads/default/_optimized/da3/9a3/ee5e6b4b0d_690x1380.jpg" width="690" height="1380"><div class="meta">
cpp.html.should match_html '<div class="lightbox-wrapper"><a href="/uploads/default/1/1234567890123456.jpg" class="lightbox" title="uploaded.jpg"><img src="/uploads/default/_optimized/da3/9a3/ee5e6b4b0d_690x1380.jpg" width="690" height="1380"><div class="meta">
<span class="filename">uploaded.jpg</span><span class="informations">1000x2000 1.21 KB</span><span class="expand"></span>
</div></a></div>'
cpp.should be_dirty