Sha256: 2f54f89fd9af6f5b20aa084bc22dada9588aaa339e85109f27c0777fd3afc6e6
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
module FcrepoAdmin::Controller module AssociationsControllerBehavior extend ActiveSupport::Concern included do layout 'fcrepo_admin/objects' include FcrepoAdmin::Controller::ControllerBehavior before_filter :load_and_authorize_object before_filter :load_association, :only => :show end def index end def show if @association.collection? self.solr_search_params_logic += [:association_filter] @response, @documents = get_search_results({:qt => 'standard'}) else target = @object.send("#{@association.name}_id") if target redirect_to :controller => 'objects', :action => 'show', :id => target, :use_route => 'fcrepo_admin' else render :text => "Target not found", :status => 404 end end end def association_filter(solr_params, user_params) solr_params[:q] = construct_query end protected # Copied from ActiveFedora::Associations::AssociationCollection def construct_query clauses = {@association.options[:property] => @object.internal_uri} clauses[:has_model] = @association.class_name.constantize.to_class_uri if @association.class_name && @association.class_name != 'ActiveFedora::Base' ActiveFedora::SolrService.construct_query_for_rel(clauses) end def load_association @association = @object.reflections[params[:id].to_sym] # XXX raise exception if nil end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fcrepo_admin-0.4.0 | lib/fcrepo_admin/controller/associations_controller_behavior.rb |