Skip to content

Commit

Permalink
Merge branch 'remove_unapi' of https://github.com/jcoyne/blacklight i…
Browse files Browse the repository at this point in the history
…nto jcoyne-remove_unapi
  • Loading branch information
Chris Beer committed Aug 8, 2011
2 parents 3fe3fe6 + cce04f3 commit a46defe
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 121 deletions.
5 changes: 0 additions & 5 deletions app/helpers/blacklight_helper.rb
Expand Up @@ -394,9 +394,4 @@ def render_endnote_texts(documents)
val
end


def render_document_unapi_microformat(document, options={})
render(:partial=>'catalog/unapi_microformat', :locals => {:document=> document}.merge(options))
end

end
2 changes: 0 additions & 2 deletions app/views/catalog/_document.html.erb
Expand Up @@ -16,6 +16,4 @@
<% # main container for doc partial view -%>
<%= render_document_partial document, :index %>

<%= render_document_unapi_microformat document %>

</div>
1 change: 0 additions & 1 deletion app/views/catalog/_unapi_microformat.html.erb

This file was deleted.

1 change: 0 additions & 1 deletion app/views/catalog/show.html.erb
Expand Up @@ -25,7 +25,6 @@
<div class="document">
<%= render_document_partial @document, :show %>
</div>
<%= render_document_unapi_microformat @document %>
</div>
</div>
Expand Down
6 changes: 0 additions & 6 deletions app/views/catalog/unapi.xml.builder

This file was deleted.

22 changes: 0 additions & 22 deletions lib/blacklight/catalog.rb
Expand Up @@ -30,7 +30,6 @@ def index

extra_head_content << view_context.auto_discovery_link_tag(:rss, url_for(params.merge(:format => 'rss')), :title => "RSS for results")
extra_head_content << view_context.auto_discovery_link_tag(:atom, url_for(params.merge(:format => 'atom')), :title => "Atom for results")
extra_head_content << view_context.auto_discovery_link_tag(:unapi, unapi_url, {:type => 'application/xml', :rel => 'unapi-server', :title => 'unAPI' })

(@response, @document_list) = get_search_results
@filters = params[:f] || []
Expand All @@ -45,7 +44,6 @@ def index

# get single document from the solr index
def show
extra_head_content << view_context.auto_discovery_link_tag(:unapi, unapi_url, {:type => 'application/xml', :rel => 'unapi-server', :title => 'unAPI' })
@response, @document = get_solr_response_for_doc_id

respond_to do |format|
Expand All @@ -62,26 +60,6 @@ def show
end
end

def unapi
@export_formats = Blacklight.config[:unapi] || {}
@format = params[:format]
if params[:id]
@response, @document = get_solr_response_for_doc_id
@export_formats = @document.export_formats
end

unless @format
render 'unapi.xml.builder', :layout => false and return
end

respond_to do |format|
format.all do
send_data @document.export_as(@format), :type => @document.export_formats[@format][:content_type], :disposition => 'inline' if @document.will_export_as @format
end
end
end


# updates the search counter (allows the show view to paginate)
def update
adjust_for_results_view
Expand Down
1 change: 0 additions & 1 deletion lib/blacklight/routes.rb
Expand Up @@ -71,7 +71,6 @@ def catalog
match 'catalog/endnote', :as => "endnote_catalog"
match 'catalog/send_email_record', :as => "send_email_record_catalog"
match "catalog/facet/:id", :to => 'catalog#facet', :as => 'catalog_facet'
match 'catalog/unapi', :to => "catalog#unapi", :as => 'unapi'
resources :catalog, :only => [:index, :show, :update]
match 'catalog/:id/librarian_view', :to => "catalog#librarian_view", :as => "librarian_view_catalog"
end
Expand Down
2 changes: 1 addition & 1 deletion lib/blacklight/solr/document.rb
Expand Up @@ -49,7 +49,7 @@
# If an extension advertises what export formats it can provide, than those
# formats will automatically be delivered by the Blacklight catalog/show
# controller, and potentially automatically advertised in various places
# that advertise available formats. (UnAPI; HTML link rel=alternate; Atom
# that advertise available formats. (HTML link rel=alternate; Atom
# link rel=alterate; etc).
#
# Export formats are 'registered' by calling the #will_export_as method
Expand Down
Expand Up @@ -235,12 +235,5 @@
# mean") suggestion is offered.
config[:spell_max] = 5

# Add documents to the list of object formats that are supported for all objects.
# This parameter is a hash, identical to the Blacklight::Solr::Document#export_formats
# output; keys are format short-names that can be exported. Hash includes:
# :content-type => mime-content-type
config[:unapi] = {
'oai_dc_xml' => { :content_type => 'text/xml' }
}
end

30 changes: 0 additions & 30 deletions test_support/features/unapi.feature

This file was deleted.

45 changes: 0 additions & 45 deletions test_support/spec/controllers/catalog_controller_spec.rb
Expand Up @@ -302,51 +302,6 @@ def export_as_mock

end # describe show action

describe "unapi" do
doc_id = '2007020969'
module FakeExtension
def self.extended(document)
document.will_export_as(:mock, "application/mock")
document.will_export_as(:mockxml, "text/xml")
end

def export_as_mock
"mock_export"
end

def export_as_mockxml
"<a><mock xml='document' /></a>"
end
end
before(:each) do
SolrDocument.registered_extensions = nil
SolrDocument.use_extension(FakeExtension)
end

it "should return an unapi formats list from config[:unapi]" do
Blacklight.config[:unapi] = { :mock => { :content_type => "application/mock" } }
get :unapi
response.should be_success
assigns[:export_formats][:mock][:content_type].should == "application/mock"
end


it "should return an unapi formats list for document" do
get :unapi, :id => doc_id
response.should be_success
assigns[:document].should be_kind_of(SolrDocument)
assigns[:export_formats].should_not be_nil
assigns[:export_formats].should be_kind_of(Hash)
assigns[:export_formats][:mock] == { :content_type => "application/mock" }
assigns[:export_formats][:mockxml] = { :content_type => 'text/xml' }
end

it "should return an unapi format export for document" do
get :unapi, :id => doc_id, :format => 'mock'
response.should be_success
response.should contain("mock_export")
end
end

describe "opensearch" do
it "should return an opensearch description" do
Expand Down

0 comments on commit a46defe

Please sign in to comment.