Skip to content

Commit

Permalink
Allow setting presenter/form without overriding
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Mar 10, 2016
1 parent 3e6f1a7 commit e257cfd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ module CollectionsControllerBehavior
before_action :filter_docs_with_read_access!, except: :show
layout 'curation_concerns/1_column'
skip_load_and_authorize_resource only: :show

class_attribute :presenter_class, :form_class
self.presenter_class = CurationConcerns::CollectionPresenter
self.form_class = CurationConcerns::Forms::CollectionEditForm
end

def new
Expand Down Expand Up @@ -65,10 +69,6 @@ def collection_search_builder
end
end

def presenter_class
CurationConcerns::CollectionPresenter
end

def collection_search_builder_class
CurationConcerns::WorkSearchBuilder
end
Expand Down Expand Up @@ -97,10 +97,6 @@ def form
@form ||= form_class.new(@collection)
end

def form_class
CurationConcerns::Forms::CollectionEditForm
end

# Include 'catalog' and 'curation_concerns/base' in the search path for views
def _prefixes
@_prefixes ||= super + ['catalog', 'curation_concerns/base']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ module CurationConcerns::CurationConcernController
with_themed_layout '1_column'
helper CurationConcerns::AbilityHelper

class_attribute :curation_concern_type
class_attribute :curation_concern_type, :show_presenter
self.show_presenter = CurationConcerns::WorkShowPresenter
attr_accessor :curation_concern
helper_method :curation_concern
end
Expand Down Expand Up @@ -94,12 +95,6 @@ def file_manager

protected

# Gives the class of the show presenter. Override this if you want
# to use a different presenter.
def show_presenter
CurationConcerns::WorkShowPresenter
end

# Gives the class of the form. Override this if you want
# to use a different form.
def form_class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ module FileSetsControllerBehavior
helper_method :curation_concern
include CurationConcerns::ParentContainer
copy_blacklight_config_from(::CatalogController)

class_attribute :show_presenter, :form_class
self.show_presenter = CurationConcerns::FileSetPresenter
self.form_class = CurationConcerns::Forms::FileSetEditForm
end

def curation_concern
Expand Down Expand Up @@ -65,18 +69,6 @@ def show
end
end

# Gives the class of the show presenter. Override this if you want
# to use a different presenter.
def show_presenter
CurationConcerns::FileSetPresenter
end

# Gives the class of the form. Override this if you want
# to use a different form.
def form_class
CurationConcerns::Forms::FileSetEditForm
end

def destroy
parent = @file_set.in_works.first
actor.destroy
Expand Down

0 comments on commit e257cfd

Please sign in to comment.