From 9be44b3fa9985b8a93160434ce9f6dc922ec4387 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 17 Dec 2017 11:36:55 +0100 Subject: New extension GalleryLinks --- .../gallery_links/gallery_links_controller.rb | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 vendor/extensions/gallery_links/app/controllers/refinery/gallery_links/gallery_links_controller.rb (limited to 'vendor/extensions/gallery_links/app/controllers/refinery/gallery_links/gallery_links_controller.rb') 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..c6a4e7e --- /dev/null +++ b/vendor/extensions/gallery_links/app/controllers/refinery/gallery_links/gallery_links_controller.rb @@ -0,0 +1,34 @@ +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') + end + + def find_page + @page = ::Refinery::Page.where(:link_url => "/gallery_links").first + end + + end + end +end -- cgit v1.2.3 From e1b7c417707c656c5bd2a41c6fa426e7dc94e97d Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sat, 6 Jan 2018 18:13:29 +0100 Subject: Consider relative root when matching gallery_links url to page. --- .../controllers/refinery/gallery_links/gallery_links_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'vendor/extensions/gallery_links/app/controllers/refinery/gallery_links/gallery_links_controller.rb') 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 index c6a4e7e..8fcbdbe 100644 --- 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 @@ -23,10 +23,13 @@ module Refinery 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 => "/gallery_links").first + @page = ::Refinery::Page.where( + :link_url => "#{ENV['RAILS_RELATIVE_URL_ROOT']}/gallery_links") + .first end end -- cgit v1.2.3