lib/rails-gallery/view_helper.rb in rails-gallery-0.2.1 vs lib/rails-gallery/view_helper.rb in rails-gallery-0.3.0
- old
+ new
@@ -1,21 +1,40 @@
module RailsGallery
+ class ConfigurationError < StandardError
+ end
+
module ViewHelper
+ include RailsGallery::PhotoValidation
+
def self.galleries
- %w{galleria responsive slideshow}
+ %w{galleria responsive slideshow touch_touch}
end
+ def self.version
+ '0.2.2'
+ end
+
# autoload all galleries when references
galleries.each do |gallery|
autoload gallery.camelize.to_sym, "rails-gallery/view_helper/#{gallery}"
end
def gallery_image type, photo
meth_name = "#{type}_gallery_image"
+ validate_gallery_photo! photo
unless respond_to? meth_name
raise ArgumentError, "Gallery #{type} is not yet supported. Please add a View helper module for this gallery using the convention followed by the other galleries..."
end
send(meth_name, photo)
+ end
+
+ def gallery_imageset type, imageset
+ meth_name = "#{type}_gallery_imageset"
+ # validate_gallery_imageset! imageset
+ unless respond_to? meth_name
+ raise ArgumentError, "Gallery #{type} is not yet supported for imageset. Please add a View helper module for this gallery using the convention followed by the other galleries..."
+ end
+ send(meth_name, imageset)
end
protected
# include view helper modules for all galleries :)