app/helpers/spotlight/application_helper.rb in blacklight-spotlight-0.0.1 vs app/helpers/spotlight/application_helper.rb in blacklight-spotlight-0.0.2
- old
+ new
@@ -1,19 +1,8 @@
module Spotlight
module ApplicationHelper
- # search_action_url is a special Blacklight helper (not a route),
- # so it doesn't get caught by the method_missing logic below.
- # TODO: we should consider making this configurable
- def search_action_url *args
- if controller_path == 'spotlight/catalog'
- catalog_index_url *args
- else
- main_app.catalog_index_url *args
- end
- end
-
# Can search for named routes directly in the main app, omitting
# the "main_app." prefix
def method_missing method, *args, &block
if main_app_url_helper?(method)
main_app.send(method, *args)
@@ -22,9 +11,31 @@
end
end
def respond_to?(method)
main_app_url_helper?(method) or super
+ end
+
+ def url_for_document document
+ return nil if document.nil?
+
+ if current_exhibit
+ spotlight.exhibit_catalog_path(current_exhibit, document)
+ else
+ document
+ end
+ end
+
+ def curation_mode_label_class
+ if curation_mode?
+ "warning"
+ else
+ "primary"
+ end
+ end
+
+ def curation_mode?
+ params[:action] == "edit"
end
private
def main_app_url_helper?(method)