Skip to content

Commit

Permalink
Allow actions to toggle which controllers they should be displayed under
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Nov 13, 2014
1 parent fa5d9b5 commit 1c12d99
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 0 additions & 2 deletions lib/blacklight/bookmarks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ module Blacklight::Bookmarks

before_filter :verify_user
helper_method :encrypt_user_id

self.document_actions = document_actions.reject { |k,v| k == :sms }
end

def action_documents
Expand Down
12 changes: 8 additions & 4 deletions lib/blacklight/catalog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@ module Blacklight::Catalog

record_search_parameters

class_attribute :document_actions
class_attribute :document_action_list
helper_method :document_actions

add_document_action(:email, callback: :email_action, validator: :validate_email_params)
add_document_action(:sms, callback: :sms_action, validator: :validate_sms_params)
add_document_action(:sms, callback: :sms_action, validator: :validate_sms_params, bookmarks: false)
add_document_action(:citation)
end

def document_actions
document_action_list.reject { |k,v| v[controller_name.to_sym] == false }
end

module ClassMethods
##
# @param name [Symbol] the name of the document action and is used to calculate
Expand All @@ -38,8 +42,8 @@ module ClassMethods
# @option opts [String] :path (for the default tool partial) a path helper to give a route for this action
#
def add_document_action name, opts = {}
self.document_actions ||= {}
self.document_actions[name] = opts
self.document_action_list ||= {}
self.document_action_list[name] = opts
define_method name do
@response, @documents = action_documents
if request.post? and
Expand Down

0 comments on commit 1c12d99

Please sign in to comment.