ecm_pictures 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +17 -1
- data/app/helpers/ecm/pictures_helper.rb +17 -1
- data/lib/ecm/pictures/version.rb +1 -1
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -1,3 +1,19 @@
|
|
1
1
|
= EcmPictureGallery
|
2
2
|
|
3
|
-
This project rocks and uses MIT-LICENSE.
|
3
|
+
This project rocks and uses MIT-LICENSE.
|
4
|
+
|
5
|
+
= Usage
|
6
|
+
|
7
|
+
Add it to your gemfile:
|
8
|
+
|
9
|
+
gem 'ecm_pictures'
|
10
|
+
|
11
|
+
Install your bundle:
|
12
|
+
|
13
|
+
> bundle install
|
14
|
+
|
15
|
+
Update your layout to include the needed css and javascript:
|
16
|
+
|
17
|
+
<!-- ecm pictures -->
|
18
|
+
<%= javascript_include_tag "ecm_pictures" %>
|
19
|
+
<%= stylesheet_link_tag "ecm_pictures" %>
|
@@ -20,7 +20,8 @@ module Ecm::PicturesHelper
|
|
20
20
|
|
21
21
|
# Check if we should link images or not.
|
22
22
|
if gallery.link_images
|
23
|
-
|
23
|
+
link_options = build_link_options_for_picture_in_gallery(gallery_identifier, picture)
|
24
|
+
concat(link_to(image_tag(picture.image.url(options[:preview_style]), :alt => picture.description), "#{picture.image.url}#{File.extname(picture.image_file_name)}", link_options))
|
24
25
|
else
|
25
26
|
concat(image_tag(picture.image.url(options[:preview_style]), :alt => picture.description))
|
26
27
|
end
|
@@ -35,6 +36,21 @@ module Ecm::PicturesHelper
|
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
39
|
+
def build_link_options_for_picture_in_gallery(gallery_identifier, picture)
|
40
|
+
link_options = {}
|
41
|
+
|
42
|
+
# Add gallery identifier for orange box
|
43
|
+
link_options = { :rel => "lightbox[#{gallery_identifier}]" }
|
44
|
+
|
45
|
+
# build the caption
|
46
|
+
caption = ""
|
47
|
+
caption << "<span class=\"caption-name\">#{picture.name}</span>" unless picture.name.blank?
|
48
|
+
caption << "<span class=\"caption-description\">#{picture.description}</span>" unless picture.description.blank?
|
49
|
+
link_options[:"data-ob_caption"] = caption if caption.size > 0
|
50
|
+
|
51
|
+
return link_options
|
52
|
+
end
|
53
|
+
|
38
54
|
def render_picture(name, options = {})
|
39
55
|
end
|
40
56
|
end
|
data/lib/ecm/pictures/version.rb
CHANGED