ecm_pictures 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,27 +1,32 @@
1
1
  module Ecm::PicturesHelper
2
2
  def render_picture_gallery(name, options = {})
3
- options = {:preview_style => :thumb}.merge(options)
4
-
5
- gallery = Ecm::Pictures::PictureGallery.where(:name => name.to_s).first
3
+ begin
4
+ options = {:preview_style => :thumb}.merge(options)
5
+
6
+ gallery = Ecm::Pictures::PictureGallery.where(:name => name.to_s).first
7
+ gallery_identifier = gallery.to_param rescue 'missing'
6
8
 
7
- content_tag(:div, :class => 'picture-gallery', :id => "picture-gallery-#{gallery.to_param}") do
8
- if gallery.nil?
9
- content_tag(:span, :class => 'warning') do
10
- I18n.t('ecm.pictures.warnings.missing_gallery', :name => name.to_s)
11
- end
12
- else
13
- content_tag(:h1, gallery.name) +
14
- content_tag(:ul, {:class => 'pictures'}) do
15
- gallery.pictures.collect do |picture|
16
- content_tag(:li, {:class => 'picture', :id => "picture-#{picture.to_param}"}) do
17
- concat(content_tag(:h2, picture.name, :class => 'picture-name')) unless picture.name.blank?
18
- concat(link_to(image_tag(picture.image.url(options[:preview_style]), :alt => picture.description), picture.image.url, {:rel => "lightbox[#{gallery.to_param}]"}))
19
- concat(content_tag(:div, picture.description, :class => 'picture-description'))
20
- end
21
- end.join.html_safe
22
- end.html_safe
23
- end
24
- end.html_safe
9
+ content_tag(:div, :class => 'picture-gallery', :id => "picture-gallery-#{gallery_identifier}") do
10
+ if gallery.nil?
11
+ content_tag(:span, :class => 'warning') do
12
+ I18n.t('ecm.pictures.warnings.missing_gallery', :name => name.to_s)
13
+ end
14
+ else
15
+ content_tag(:h1, gallery.name) +
16
+ content_tag(:ul, {:class => 'pictures'}) do
17
+ gallery.pictures.collect do |picture|
18
+ content_tag(:li, {:class => 'picture', :id => "picture-#{picture.to_param}"}) do
19
+ concat(content_tag(:h2, picture.name, :class => 'picture-name')) unless picture.name.blank?
20
+ concat(link_to(image_tag(picture.image.url(options[:preview_style]), :alt => picture.description), picture.image.url, {:rel => "lightbox[#{gallery_identifier}]"}))
21
+ concat(content_tag(:div, picture.description, :class => 'picture-description'))
22
+ end
23
+ end.join.html_safe
24
+ end.html_safe
25
+ end
26
+ end.html_safe
27
+ rescue Exception => e
28
+ return e.message
29
+ end
25
30
  end
26
31
 
27
32
  def render_picture(name, options = {})
@@ -1,5 +1,5 @@
1
1
  module Ecm
2
2
  module Pictures
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
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.1
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Roberto Vasquez Angel