diff --git a/app/controllers/concerns/curation_concerns/curation_concern_controller.rb b/app/controllers/concerns/curation_concerns/curation_concern_controller.rb index 6608c89ce..8e61488a3 100644 --- a/app/controllers/concerns/curation_concerns/curation_concern_controller.rb +++ b/app/controllers/concerns/curation_concerns/curation_concern_controller.rb @@ -72,7 +72,7 @@ def show_presenter # Gives the class of the form. Override this if you want # to use a different form. def form_class - CurationConcerns.const_get("#{self.class.curation_concern_type}Form") + CurationConcerns.const_get("#{self.class.curation_concern_type.to_s.demodulize}Form") end def edit @@ -120,8 +120,8 @@ def _prefixes def after_create_response respond_to do |wants| - wants.html { redirect_to [main_app, :curation_concerns, curation_concern] } - wants.json { render :show, status: :created, location: polymorphic_path([main_app, :curation_concerns, curation_concern]) } + wants.html { redirect_to [main_app, curation_concern] } + wants.json { render :show, status: :created, location: polymorphic_path([main_app, curation_concern]) } end end @@ -131,8 +131,8 @@ def after_update_response redirect_to main_app.confirm_curation_concerns_permission_path(curation_concern) else respond_to do |wants| - wants.html { redirect_to [main_app, :curation_concerns, curation_concern] } - wants.json { render :show, status: :ok, location: polymorphic_path([main_app, :curation_concerns, curation_concern]) } + wants.html { redirect_to [main_app, curation_concern] } + wants.json { render :show, status: :ok, location: polymorphic_path([main_app, curation_concern]) } end end end @@ -150,6 +150,6 @@ def attributes_for_actor end def hash_key_for_curation_concern - self.class.curation_concern_type.name.underscore.to_sym + self.class.curation_concern_type.model_name.param_key end end diff --git a/app/controllers/concerns/curation_concerns/file_sets_controller_behavior.rb b/app/controllers/concerns/curation_concerns/file_sets_controller_behavior.rb index 869fd1dff..b75375b2c 100644 --- a/app/controllers/concerns/curation_concerns/file_sets_controller_behavior.rb +++ b/app/controllers/concerns/curation_concerns/file_sets_controller_behavior.rb @@ -78,7 +78,7 @@ def show_presenter def destroy actor.destroy - redirect_to [main_app, :curation_concerns, @file_set.in_works.first], notice: 'The file has been deleted.' + redirect_to [main_app, @file_set.in_works.first], notice: 'The file has been deleted.' end # routed to /files/:id (PUT) @@ -183,7 +183,7 @@ def process_file(file) if request.xhr? render 'jq_upload', formats: 'json', content_type: 'text/html' else - redirect_to [main_app, :curation_concerns, @file_set.in_works.first] + redirect_to [main_app, @file_set.in_works.first] end end format.json do diff --git a/app/controllers/curation_concerns/permissions_controller.rb b/app/controllers/curation_concerns/permissions_controller.rb index ebe8319df..889eadaeb 100644 --- a/app/controllers/curation_concerns/permissions_controller.rb +++ b/app/controllers/curation_concerns/permissions_controller.rb @@ -9,7 +9,7 @@ def confirm def copy VisibilityCopyJob.perform_later(curation_concern.id) flash_message = 'Updating file permissions. This may take a few minutes. You may want to refresh your browser or return to this record later to see the updated file permissions.' - redirect_to polymorphic_path([main_app, :curation_concerns, curation_concern]), notice: flash_message + redirect_to [main_app, curation_concern], notice: flash_message end def curation_concern diff --git a/app/helpers/curation_concerns/file_set_helper.rb b/app/helpers/curation_concerns/file_set_helper.rb index f7bd50de1..c4c6cea9b 100644 --- a/app/helpers/curation_concerns/file_set_helper.rb +++ b/app/helpers/curation_concerns/file_set_helper.rb @@ -3,7 +3,7 @@ def parent_path(parent) if parent.is_a?(Collection) main_app.collection_path(parent) else - polymorphic_path([main_app, :curation_concerns, parent]) + polymorphic_path([main_app, parent]) end end diff --git a/app/helpers/curation_concerns/url_helper.rb b/app/helpers/curation_concerns/url_helper.rb index d2bfd9853..e907139bf 100644 --- a/app/helpers/curation_concerns/url_helper.rb +++ b/app/helpers/curation_concerns/url_helper.rb @@ -5,8 +5,11 @@ module UrlHelper def url_for_document(doc, _options = {}) if doc.collection? doc - else + elsif doc.file_set? + # TODO: Namespace FileSet? polymorphic_path([main_app, :curation_concerns, doc]) + else + polymorphic_path([main_app, doc]) end end @@ -21,7 +24,7 @@ def track_file_set_path(*args) # generated new GenericWork models get registered as curation concerns and need a # track_model_path to render Blacklight-related views CurationConcerns.config.registered_curation_concern_types.each do |concern| - define_method("track_#{concern.underscore}_path") { |*args| main_app.track_solr_document_path(*args) } + define_method("track_#{concern.constantize.model_name.singular_route_key}_path") { |*args| main_app.track_solr_document_path(*args) } end end end diff --git a/app/presenters/curation_concerns/file_set_presenter.rb b/app/presenters/curation_concerns/file_set_presenter.rb index c25ed880d..aae33c058 100644 --- a/app/presenters/curation_concerns/file_set_presenter.rb +++ b/app/presenters/curation_concerns/file_set_presenter.rb @@ -12,7 +12,7 @@ def initialize(solr_document, current_ability) end # CurationConcern methods - delegate :stringify_keys, :human_readable_type, :collection?, :image?, :video?, + delegate :stringify_keys, :human_readable_type, :collection?, :file_set?, :image?, :video?, :audio?, :pdf?, :office_document?, :representative_id, :to_s, to: :solr_document # Methods used by blacklight helpers diff --git a/app/views/catalog/_action_menu_partials/_default.html.erb b/app/views/catalog/_action_menu_partials/_default.html.erb index dbfaed676..fb67aa10f 100644 --- a/app/views/catalog/_action_menu_partials/_default.html.erb +++ b/app/views/catalog/_action_menu_partials/_default.html.erb @@ -4,14 +4,14 @@