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.
- data/app/helpers/ecm/pictures_helper.rb +26 -21
- data/lib/ecm/pictures/version.rb +1 -1
- metadata +1 -1
@@ -1,27 +1,32 @@
|
|
1
1
|
module Ecm::PicturesHelper
|
2
2
|
def render_picture_gallery(name, options = {})
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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 = {})
|
data/lib/ecm/pictures/version.rb
CHANGED