aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/extensions/gallery_links/app/controllers/refinery/gallery_links/gallery_links_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/extensions/gallery_links/app/controllers/refinery/gallery_links/gallery_links_controller.rb')
-rw-r--r--vendor/extensions/gallery_links/app/controllers/refinery/gallery_links/gallery_links_controller.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/vendor/extensions/gallery_links/app/controllers/refinery/gallery_links/gallery_links_controller.rb b/vendor/extensions/gallery_links/app/controllers/refinery/gallery_links/gallery_links_controller.rb
new file mode 100644
index 0000000..8fcbdbe
--- /dev/null
+++ b/vendor/extensions/gallery_links/app/controllers/refinery/gallery_links/gallery_links_controller.rb
@@ -0,0 +1,37 @@
+module Refinery
+ module GalleryLinks
+ class GalleryLinksController < ::ApplicationController
+
+ before_filter :find_all_gallery_links
+ before_filter :find_page
+
+ def index
+ # you can use meta fields from your model instead (e.g. browser_title)
+ # by swapping @page for @gallery_link in the line below:
+ present(@page)
+ end
+
+ def show
+ @gallery_link = GalleryLink.find(params[:id])
+
+ # you can use meta fields from your model instead (e.g. browser_title)
+ # by swapping @page for @gallery_link in the line below:
+ present(@page)
+ end
+
+ protected
+
+ def find_all_gallery_links
+ @gallery_links = GalleryLink.order('position ASC')
+ logger.debug "Found #{@gallery_links.length} galleries..."
+ end
+
+ def find_page
+ @page = ::Refinery::Page.where(
+ :link_url => "#{ENV['RAILS_RELATIVE_URL_ROOT']}/gallery_links")
+ .first
+ end
+
+ end
+ end
+end