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 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
- concat(link_to(image_tag(picture.image.url(options[:preview_style]), :alt => picture.description), "#{picture.image.url}#{File.extname(picture.image_file_name)}", {:rel => "lightbox[#{gallery_identifier}]"}))
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
@@ -1,5 +1,5 @@
1
1
  module Ecm
2
2
  module Pictures
3
- VERSION = "0.0.11"
3
+ VERSION = "0.0.12"
4
4
  end
5
5
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ecm_pictures
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.11
5
+ version: 0.0.12
6
6
  platform: ruby
7
7
  authors:
8
8
  - Roberto Vasquez Angel