Skip to content

Commit

Permalink
Use CurationConcerns collection code, fixes #1620
Browse files Browse the repository at this point in the history
  • Loading branch information
awead committed Mar 17, 2016
1 parent f1a3e10 commit 7425599
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 34 deletions.
14 changes: 0 additions & 14 deletions app/controllers/concerns/sufia/collections_controller_behavior.rb
@@ -1,7 +1,6 @@
module Sufia
module CollectionsControllerBehavior
extend ActiveSupport::Concern
include Hydra::CollectionsControllerBehavior

included do
include Sufia::Breadcrumbs
Expand All @@ -22,18 +21,5 @@ def presenter_class
def form_class
Sufia::Forms::CollectionForm
end

def query_collection_members
# TODO: Should this be moved to curation_concerns
flash[:notice] = nil if flash[:notice] == "Select something first"
super
end

def after_destroy(id)
respond_to do |format|
format.html { redirect_to sufia.dashboard_collections_path, notice: 'Collection was successfully deleted.' }
format.json { render json: { id: id }, status: :destroyed, location: @collection }
end
end
end
end
14 changes: 1 addition & 13 deletions app/presenters/sufia/collection_presenter.rb
@@ -1,7 +1,6 @@
module Sufia
class CollectionPresenter < CurationConcerns::CollectionPresenter
# TODO: Move date_created to CurationConcerns, see #1620
delegate :date_created, :resource_type, to: :solr_document
delegate :resource_type, to: :solr_document

# Terms is the list of fields displayed by app/views/collections/_show_descriptions.html.erb
def self.terms
Expand All @@ -24,16 +23,5 @@ def [](key)
solr_document.send key
end
end

# TODO: Remove? this is in CC, see #1620
def size
number_to_human_size(Sufia::CollectionSizeService.run(solr_document))
end

# TODO: Remove? this is in CC, see #1620
def total_items
ActiveFedora::SolrService.query("proxy_in_ssi:#{id}", fl: "ordered_targets_ssim")
.flat_map { |x| x.fetch("ordered_targets_ssim", []) }.size
end
end
end
6 changes: 0 additions & 6 deletions app/views/collections/_paginate.html.erb

This file was deleted.

2 changes: 1 addition & 1 deletion spec/views/collections/_show_descriptions.html.erb_spec.rb
Expand Up @@ -6,8 +6,8 @@
let(:collection) { build(:collection, date_created: ['2000-01-01']) }
before do
allow(presenter).to receive(:total_items).and_return(2)
allow(presenter).to receive(:size).and_return("118 MB")
assign(:presenter, presenter)
allow(Sufia::CollectionSizeService).to receive(:run).and_return(collection_size)
end

let(:ability) { double }
Expand Down

0 comments on commit 7425599

Please sign in to comment.