From 18557e5ee4ca602d7a320b6fb91f3596326487f7 Mon Sep 17 00:00:00 2001 From: "E. Lynette Rayle" Date: Mon, 14 Aug 2017 15:36:34 -0400 Subject: [PATCH] Refactor CRUD for collections from hyrax/collections to hyrax/dashboard/collections. --- .rubocop_fixme.yml | 4 +- .../hyrax/collections_controller_behavior.rb | 167 --------- .../hyrax/dashboard/collections_controller.rb | 291 ++++++++++++++- app/helpers/hyrax/ability_helper.rb | 2 +- app/helpers/hyrax/collections_helper.rb | 6 +- .../_button_create_collection.html.erb | 1 - .../collections/_list_collections.html.erb | 2 +- .../hyrax/collections/_list_works.html.erb | 4 - .../collections/_show_document_list.html.erb | 3 - .../_show_document_list_row.html.erb | 5 - .../collections/_sort_and_per_page.html.erb | 8 - app/views/hyrax/collections/show.html.erb | 3 - .../collections/_batch_edits_actions.html.erb | 0 .../collections/_bookmark_control.html.erb | 23 ++ .../_button_create_collection.html.erb | 1 + ...r_remove_selected_from_collection.html.erb | 2 +- .../_button_for_update_collection.html.erb | 2 +- .../_button_remove_from_collection.html.erb | 2 +- .../collections/_document_list.html.erb | 13 + .../collections/_edit_actions.html.erb | 0 .../collections/_form.html.erb | 2 +- .../collections/_form_default_group.html.erb | 25 ++ .../_form_for_select_collection.html.erb | 6 +- .../collections/_form_permission.html.erb | 0 .../collections/_form_share.html.erb | 0 .../collections/_list_collections.html.erb | 45 +++ .../collections/_list_works.html.erb | 40 ++ .../collections/_show_actions.html.erb | 2 +- .../collections/_show_descriptions.html.erb | 7 + .../collections/_show_document_list.html.erb | 17 + .../_show_document_list_menu.html.erb | 0 .../_show_document_list_row.html.erb | 49 +++ .../collections/_show_fields.html.erb | 0 .../_single_item_action_fields.html.erb | 0 .../collections/_sort_and_per_page.html.erb | 32 ++ .../collections/_work_action_menu.html.erb | 0 .../{ => dashboard}/collections/edit.html.erb | 10 +- .../edit_fields/_description.html.erb | 0 .../{ => dashboard}/collections/new.html.erb | 2 +- .../hyrax/dashboard/collections/show.html.erb | 36 ++ .../hyrax/my/_collection_action_menu.html.erb | 4 +- app/views/hyrax/my/_search_header.html.erb | 4 +- .../my/collections/_list_collections.html.erb | 2 +- app/views/hyrax/my/collections/index.html.erb | 4 +- config/locales/hyrax.en.yml | 21 +- config/routes.rb | 20 +- .../hyrax/collections_controller_spec.rb | 264 +------------ .../dashboard/collections_controller_spec.rb | 353 ++++++++++++++++++ spec/features/collection_spec.rb | 189 +--------- spec/features/dashboard/collection_spec.rb | 262 +++++++++++++ spec/helpers/hyrax/collections_helper_spec.rb | 8 +- .../resource_sync/change_list_writer_spec.rb | 4 +- .../_show_descriptions.html.erb_spec.rb | 1 - .../_show_document_list.html.erb_spec.rb | 5 +- .../_show_document_list_row.html.erb_spec.rb | 1 - .../hyrax/collections/show.html.erb_spec.rb | 5 - .../collections/_form.html.erb_spec.rb | 2 +- ...orm_for_select_collection.html.erb_spec.rb | 4 +- .../collections/_form_share.erb_spec.rb | 2 +- .../_show_descriptions.html.erb_spec.rb | 32 ++ .../_show_document_list.html.erb_spec.rb | 24 ++ .../_show_document_list_menu.html.erb_spec.rb | 7 +- .../_show_document_list_row.html.erb_spec.rb | 31 ++ .../collections/edit.html.erb_spec.rb | 6 +- .../collections/show.html.erb_spec.rb | 37 ++ .../_list_collections.html.erb_spec.rb | 6 +- 66 files changed, 1392 insertions(+), 718 deletions(-) delete mode 100644 app/views/hyrax/collections/_button_create_collection.html.erb rename app/views/hyrax/{ => dashboard}/collections/_batch_edits_actions.html.erb (100%) create mode 100644 app/views/hyrax/dashboard/collections/_bookmark_control.html.erb create mode 100644 app/views/hyrax/dashboard/collections/_button_create_collection.html.erb rename app/views/hyrax/{ => dashboard}/collections/_button_for_remove_selected_from_collection.html.erb (74%) rename app/views/hyrax/{ => dashboard}/collections/_button_for_update_collection.html.erb (83%) rename app/views/hyrax/{ => dashboard}/collections/_button_remove_from_collection.html.erb (54%) create mode 100644 app/views/hyrax/dashboard/collections/_document_list.html.erb rename app/views/hyrax/{ => dashboard}/collections/_edit_actions.html.erb (100%) rename app/views/hyrax/{ => dashboard}/collections/_form.html.erb (97%) create mode 100644 app/views/hyrax/dashboard/collections/_form_default_group.html.erb rename app/views/hyrax/{ => dashboard}/collections/_form_for_select_collection.html.erb (81%) rename app/views/hyrax/{ => dashboard}/collections/_form_permission.html.erb (100%) rename app/views/hyrax/{ => dashboard}/collections/_form_share.html.erb (100%) create mode 100644 app/views/hyrax/dashboard/collections/_list_collections.html.erb create mode 100644 app/views/hyrax/dashboard/collections/_list_works.html.erb rename app/views/hyrax/{ => dashboard}/collections/_show_actions.html.erb (94%) create mode 100644 app/views/hyrax/dashboard/collections/_show_descriptions.html.erb create mode 100644 app/views/hyrax/dashboard/collections/_show_document_list.html.erb rename app/views/hyrax/{ => dashboard}/collections/_show_document_list_menu.html.erb (100%) create mode 100644 app/views/hyrax/dashboard/collections/_show_document_list_row.html.erb create mode 100644 app/views/hyrax/dashboard/collections/_show_fields.html.erb rename app/views/hyrax/{ => dashboard}/collections/_single_item_action_fields.html.erb (100%) create mode 100644 app/views/hyrax/dashboard/collections/_sort_and_per_page.html.erb rename app/views/hyrax/{ => dashboard}/collections/_work_action_menu.html.erb (100%) rename app/views/hyrax/{ => dashboard}/collections/edit.html.erb (73%) rename app/views/hyrax/{ => dashboard}/collections/edit_fields/_description.html.erb (100%) rename app/views/hyrax/{ => dashboard}/collections/new.html.erb (84%) create mode 100644 app/views/hyrax/dashboard/collections/show.html.erb create mode 100644 spec/controllers/hyrax/dashboard/collections_controller_spec.rb create mode 100644 spec/features/dashboard/collection_spec.rb rename spec/views/hyrax/{ => dashboard}/collections/_form.html.erb_spec.rb (97%) rename spec/views/hyrax/{ => dashboard}/collections/_form_for_select_collection.html.erb_spec.rb (92%) rename spec/views/hyrax/{ => dashboard}/collections/_form_share.erb_spec.rb (95%) create mode 100644 spec/views/hyrax/dashboard/collections/_show_descriptions.html.erb_spec.rb create mode 100644 spec/views/hyrax/dashboard/collections/_show_document_list.html.erb_spec.rb rename spec/views/hyrax/{ => dashboard}/collections/_show_document_list_menu.html.erb_spec.rb (80%) create mode 100644 spec/views/hyrax/dashboard/collections/_show_document_list_row.html.erb_spec.rb rename spec/views/hyrax/{ => dashboard}/collections/edit.html.erb_spec.rb (82%) create mode 100644 spec/views/hyrax/dashboard/collections/show.html.erb_spec.rb diff --git a/.rubocop_fixme.yml b/.rubocop_fixme.yml index 1cf4f2c7a1..a35f7a1182 100644 --- a/.rubocop_fixme.yml +++ b/.rubocop_fixme.yml @@ -4,6 +4,7 @@ Security/MarshalLoad: Metrics/ClassLength: Exclude: + - 'app/controllers/hyrax/dashboard/collections_controller.rb' - 'app/controllers/hyrax/file_sets_controller.rb' - 'app/forms/hyrax/forms/permission_template_form.rb' - 'app/presenters/hyrax/work_show_presenter.rb' @@ -23,7 +24,6 @@ Metrics/AbcSize: Metrics/ModuleLength: Exclude: - - 'app/controllers/concerns/hyrax/collections_controller_behavior.rb' - 'app/controllers/concerns/hyrax/works_controller_behavior.rb' - 'app/helpers/hyrax/hyrax_helper_behavior.rb' - 'app/models/concerns/hyrax/ability.rb' @@ -65,7 +65,6 @@ RSpec/ExampleLength: - 'spec/actors/hyrax/actors/generic_work_actor_spec.rb' - 'spec/controllers/hyrax/api/items_controller_spec.rb' - 'spec/controllers/hyrax/batch_uploads_controller_spec.rb' - - 'spec/controllers/hyrax/collections_controller_spec.rb' - 'spec/controllers/hyrax/file_sets_controller_spec.rb' - 'spec/controllers/hyrax/generic_works_controller_spec.rb' - 'spec/controllers/hyrax/my/highlights_controller_spec.rb' @@ -129,7 +128,6 @@ RSpec/AnyInstance: - 'spec/controllers/hyrax/api/items_controller_spec.rb' - 'spec/controllers/hyrax/api/zotero_controller_spec.rb' - 'spec/controllers/hyrax/batch_edits_controller_spec.rb' - - 'spec/controllers/hyrax/collections_controller_spec.rb' - 'spec/controllers/hyrax/dashboard_controller_spec.rb' - 'spec/controllers/hyrax/stats_controller_spec.rb' - 'spec/jobs/file_set_attached_event_job_spec.rb' diff --git a/app/controllers/concerns/hyrax/collections_controller_behavior.rb b/app/controllers/concerns/hyrax/collections_controller_behavior.rb index 8b215676ee..295ba20554 100644 --- a/app/controllers/concerns/hyrax/collections_controller_behavior.rb +++ b/app/controllers/concerns/hyrax/collections_controller_behavior.rb @@ -6,7 +6,6 @@ module CollectionsControllerBehavior included do before_action :filter_docs_with_read_access!, except: :show - before_action :remove_select_something_first_flash, except: :show include Hyrax::Collections::AcceptsBatches @@ -18,12 +17,6 @@ module CollectionsControllerBehavior # This is needed as of BL 3.7 copy_blacklight_config_from(::CatalogController) - # Catch permission errors - rescue_from Hydra::AccessDenied, CanCan::AccessDenied, with: :deny_collection_access - - # actions: index, create, new, edit, show, update, destroy, permissions, citation - before_action :authenticate_user!, except: [:show, :index] - class_attribute :presenter_class, :form_class, :single_item_search_builder_class, @@ -37,151 +30,23 @@ module CollectionsControllerBehavior self.presenter_class = Hyrax::CollectionPresenter - self.form_class = Hyrax::Forms::CollectionForm - # The search builder to find the collection self.single_item_search_builder_class = SingleCollectionSearchBuilder # The search builder to find the collections' members self.member_search_builder_class = Hyrax::CollectionMemberSearchBuilder end - def deny_collection_access(exception) - if exception.action == :edit - redirect_to(url_for(action: 'show'), alert: 'You do not have sufficient privileges to edit this document') - elsif current_user && current_user.persisted? - redirect_to root_url, alert: exception.message - else - session['user_return_to'] = request.url - redirect_to main_app.new_user_session_url, alert: exception.message - end - end - - def new - add_breadcrumb t(:'hyrax.controls.home'), root_path - add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path - add_breadcrumb t(:'hyrax.collections.new.header'), hyrax.new_collection_path - @collection.apply_depositor_metadata(current_user.user_key) - form - end - def show presenter query_collection_members end - def edit - query_collection_members - # this is used to populate the "add to a collection" action for the members - @user_collections = find_collections_for_form - form - end - - def after_create - form - respond_to do |format| - ActiveFedora::SolrService.instance.conn.commit - format.html { redirect_to collection_path(@collection), notice: 'Collection was successfully created.' } - format.json { render json: @collection, status: :created, location: @collection } - end - end - - def after_create_error - form - respond_to do |format| - format.html { render action: 'new' } - format.json { render json: @collection.errors, status: :unprocessable_entity } - end - end - - def create - # Manual load and authorize necessary because Cancan will pass in all - # form attributes. When `permissions_attributes` are present the - # collection is saved without a value for `has_model.` - @collection = ::Collection.new - authorize! :create, @collection - - @collection.attributes = collection_params.except(:members) - @collection.apply_depositor_metadata(current_user.user_key) - add_members_to_collection unless batch.empty? - if @collection.save - after_create - else - after_create_error - end - end - - def after_update - if flash[:notice].nil? - flash[:notice] = 'Collection was successfully updated.' - end - respond_to do |format| - format.html { redirect_to collection_path(@collection) } - format.json { render json: @collection, status: :updated, location: @collection } - end - end - - def after_update_error - form - query_collection_members - respond_to do |format| - format.html { render action: 'edit' } - format.json { render json: @collection.errors, status: :unprocessable_entity } - end - end - - def update - process_member_changes - if @collection.update(collection_params.except(:members)) - after_update - else - after_update_error - end - end - - def after_destroy(id) - respond_to do |format| - format.html do - redirect_to my_collections_path, - notice: "Collection #{id} was successfully deleted" - end - format.json { head :no_content, location: @collection } - end - end - - def after_destroy_error(id) - respond_to do |format| - format.html do - flash[:notice] = "Collection #{id} could not be deleted" - render :edit, status: :unprocessable_entity - end - format.json { render json: { id: id }, status: :unprocessable_entity, location: @collection } - end - end - - def destroy - if @collection.destroy - after_destroy(params[:id]) - else - after_destroy_error(params[:id]) - end - end - def collection action_name == 'show' ? @presenter : @collection end private - # run a solr query to get the collections the user has access to edit - # @return [Array] a list of the user's collections - def find_collections_for_form - Hyrax::CollectionsService.new(self).search_results(:edit) - end - - def remove_select_something_first_flash - flash.delete(:notice) if flash.notice == 'Select something first' - end - def presenter @presenter ||= begin # Query Solr for the collection. @@ -236,38 +101,6 @@ def params_for_members_query params.merge(q: params[:cq]) end - def process_member_changes - case params[:collection][:members] - when 'add' then add_members_to_collection - when 'remove' then remove_members_from_collection - when 'move' then move_members_between_collections - end - end - - def add_members_to_collection(collection = nil) - collection ||= @collection - collection.add_member_objects batch - end - - def remove_members_from_collection - batch.each do |pid| - work = ActiveFedora::Base.find(pid) - work.member_of_collections.delete @collection - work.save! - end - end - - def move_members_between_collections - destination_collection = ::Collection.find(params[:destination_collection_id]) - remove_members_from_collection - add_members_to_collection(destination_collection) - if destination_collection.save - flash[:notice] = "Successfully moved #{batch.count} files to #{destination_collection.title} Collection." - else - flash[:error] = "An error occured. Files were not moved to #{destination_collection.title} Collection." - end - end - # Include 'catalog' and 'hyrax/base' in the search path for views, while prefering # our local paths. Thus we are unable to just override `self.local_prefixes` def _prefixes diff --git a/app/controllers/hyrax/dashboard/collections_controller.rb b/app/controllers/hyrax/dashboard/collections_controller.rb index 315ff667b5..de457c0917 100644 --- a/app/controllers/hyrax/dashboard/collections_controller.rb +++ b/app/controllers/hyrax/dashboard/collections_controller.rb @@ -2,7 +2,188 @@ module Hyrax module Dashboard ## Shows a list of all collections to the admins class CollectionsController < Hyrax::My::CollectionsController - before_action :ensure_admin! + include Blacklight::AccessControls::Catalog + include Blacklight::Base + include BreadcrumbsForCollections + layout 'dashboard' + + before_action :filter_docs_with_read_access!, except: :show + before_action :remove_select_something_first_flash, except: :show + + include Hyrax::Collections::AcceptsBatches + + # include the render_check_all view helper method + helper Hyrax::BatchEditsHelper + # include the display_trophy_link view helper method + helper Hyrax::TrophyHelper + + # This is needed as of BL 3.7 + copy_blacklight_config_from(::CatalogController) + + # Catch permission errors + rescue_from Hydra::AccessDenied, CanCan::AccessDenied, with: :deny_collection_access + + # actions: index, create, new, edit, show, update, destroy, permissions, citation + before_action :authenticate_user!, except: [:index] + + class_attribute :presenter_class, + :form_class, + :single_item_search_builder_class, + :member_search_builder_class + + alias collection_search_builder_class single_item_search_builder_class + deprecation_deprecate collection_search_builder_class: "use single_item_search_builder_class instead" + + alias collection_member_search_builder_class member_search_builder_class + deprecation_deprecate collection_member_search_builder_class: "use member_search_builder_class instead" + + self.presenter_class = Hyrax::CollectionPresenter + + self.form_class = Hyrax::Forms::CollectionForm + + # The search builder to find the collection + self.single_item_search_builder_class = SingleCollectionSearchBuilder + # The search builder to find the collections' members + self.member_search_builder_class = Hyrax::CollectionMemberSearchBuilder + + # load_and_authorize_resource except: [:index, :show, :create], instance_name: :collection + load_and_authorize_resource except: [:index, :create], instance_name: :collection + + before_action :ensure_admin!, only: :index # index for All Collections; see also Hyrax::My::CollectionsController #index for My Collections + + def deny_collection_access(exception) + if exception.action == :edit + redirect_to(url_for(action: 'show'), alert: 'You do not have sufficient privileges to edit this document') + elsif current_user && current_user.persisted? + redirect_to root_url, alert: exception.message + else + session['user_return_to'] = request.url + redirect_to main_app.new_user_session_url, alert: exception.message + end + end + + def new + add_breadcrumb t(:'hyrax.controls.home'), root_path + add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path + add_breadcrumb t(:'hyrax.collections.new.header'), hyrax.new_dashboard_collection_path + @collection.apply_depositor_metadata(current_user.user_key) + form + end + + def show + presenter + query_collection_members + end + + def edit + query_collection_members + # this is used to populate the "add to a collection" action for the members + @user_collections = find_collections_for_form + form + end + + def after_create + form + respond_to do |format| + ActiveFedora::SolrService.instance.conn.commit + format.html { redirect_to dashboard_collection_path(@collection), notice: 'Collection was successfully created.' } + format.json { render json: @collection, status: :created, location: dashboard_collection_path(@collection) } + end + end + + def after_create_error + form + respond_to do |format| + format.html { render action: 'new' } + format.json { render json: @collection.errors, status: :unprocessable_entity } + end + end + + def create + # Manual load and authorize necessary because Cancan will pass in all + # form attributes. When `permissions_attributes` are present the + # collection is saved without a value for `has_model.` + @collection = ::Collection.new + authorize! :create, @collection + + @collection.attributes = collection_params.except(:members) + @collection.apply_depositor_metadata(current_user.user_key) + add_members_to_collection unless batch.empty? + if @collection.save + after_create + else + after_create_error + end + end + + def after_update + if flash[:notice].nil? + flash[:notice] = 'Collection was successfully updated.' + end + respond_to do |format| + format.html { redirect_to dashboard_collection_path(@collection) } + format.json { render json: @collection, status: :updated, location: dashboard_collection_path(@collection) } + end + end + + def after_update_error + form + query_collection_members + respond_to do |format| + format.html { render action: 'edit' } + format.json { render json: @collection.errors, status: :unprocessable_entity } + end + end + + def update + process_member_changes + if @collection.update(collection_params.except(:members)) + after_update + else + after_update_error + end + end + + def after_destroy(id) + respond_to do |format| + format.html do + redirect_to my_collections_path, + notice: "Collection #{id} was successfully deleted" + end + format.json { head :no_content, location: my_collections_path } + end + end + + def after_destroy_error(id) + respond_to do |format| + format.html do + flash[:notice] = "Collection #{id} could not be deleted" + render :edit, status: :unprocessable_entity + end + format.json { render json: { id: id }, status: :unprocessable_entity, location: dashboard_collection_path(@collection) } + end + end + + def destroy + if @collection.destroy + after_destroy(params[:id]) + else + after_destroy_error(params[:id]) + end + end + + def collection + action_name == 'show' ? @presenter : @collection + end + + # Renders a JSON response with a list of files in this collection + # This is used by the edit form to populate the thumbnail_id dropdown + def files + result = form.select_files.map do |label, id| + { id: id, text: label } + end + render json: result + end def search_builder_class Hyrax::CollectionSearchBuilder @@ -10,8 +191,110 @@ def search_builder_class private + # run a solr query to get the collections the user has access to edit + # @return [Array] a list of the user's collections + def find_collections_for_form + Hyrax::CollectionsService.new(self).search_results(:edit) + end + + def remove_select_something_first_flash + flash.delete(:notice) if flash.notice == 'Select something first' + end + + def presenter + @presenter ||= begin + # Query Solr for the collection. + # run the solr query to find the collection members + response = repository.search(single_item_search_builder.query) + curation_concern = response.documents.first + raise CanCan::AccessDenied unless curation_concern + presenter_class.new(curation_concern, current_ability) + end + end + + # Instantiates the search builder that builds a query for a single item + # this is useful in the show view. + def single_item_search_builder + single_item_search_builder_class.new(self).with(params.except(:q, :page)) + end + + alias collection_search_builder single_item_search_builder + deprecation_deprecate collection_search_builder: "use single_item_search_builder instead" + + # Instantiates the search builder that builds a query for items that are + # members of the current collection. This is used in the show view. + def member_search_builder + @member_search_builder ||= member_search_builder_class.new(self) + end + + alias collection_member_search_builder member_search_builder + deprecation_deprecate collection_member_search_builder: "use member_search_builder instead" + + def collection_params + form_class.model_attributes(params[:collection]) + end + + # Queries Solr for members of the collection. + # Populates @response and @member_docs similar to Blacklight Catalog#index populating @response and @documents + def query_collection_members + params[:q] = params[:cq] + @response = repository.search(query_for_collection_members) + @member_docs = @response.documents + end + + # @return a representation of the solr query that find the collection members + def query_for_collection_members + member_search_builder.with(params_for_members_query).query + end + + # You can override this method if you need to provide additional inputs to the search + # builder. For example: + # search_field: 'all_fields' + # @return the inputs required for the collection member search builder + def params_for_members_query + params.merge(q: params[:cq]) + end + + def process_member_changes + case params[:collection][:members] + when 'add' then add_members_to_collection + when 'remove' then remove_members_from_collection + when 'move' then move_members_between_collections + end + end + + def add_members_to_collection(collection = nil) + collection ||= @collection + collection.add_member_objects batch + end + + def remove_members_from_collection + batch.each do |pid| + work = ActiveFedora::Base.find(pid) + work.member_of_collections.delete @collection + work.save! + end + end + + def move_members_between_collections + destination_collection = ::Collection.find(params[:destination_collection_id]) + remove_members_from_collection + add_members_to_collection(destination_collection) + if destination_collection.save + flash[:notice] = "Successfully moved #{batch.count} files to #{destination_collection.title} Collection." + else + flash[:error] = "An error occured. Files were not moved to #{destination_collection.title} Collection." + end + end + + # Include 'catalog' and 'hyrax/base' in the search path for views, while prefering + # our local paths. Thus we are unable to just override `self.local_prefixes` + def _prefixes + @_prefixes ||= super + ['catalog', 'hyrax/base'] + end + def ensure_admin! - # Even though the user can view this admin set, they may not be able to view + # Even though the user can view this collection, they may not be able to view # it on the admin page. authorize! :read, :admin_dashboard end @@ -19,6 +302,10 @@ def ensure_admin! def search_action_url(*args) hyrax.dashboard_collections_url(*args) end + + def form + @form ||= form_class.new(@collection, current_ability, repository) + end end end end diff --git a/app/helpers/hyrax/ability_helper.rb b/app/helpers/hyrax/ability_helper.rb index 270def2301..f492e6463e 100644 --- a/app/helpers/hyrax/ability_helper.rb +++ b/app/helpers/hyrax/ability_helper.rb @@ -24,7 +24,7 @@ def render_visibility_link(document) # Anchor must match with a tab in # https://github.com/samvera/hyrax/blob/master/app/views/hyrax/base/_guts4form.html.erb#L2 path = if document.collection? - hyrax.edit_collection_path(document, anchor: 'share') + hyrax.edit_dashboard_collection_path(document, anchor: 'share') else edit_polymorphic_path([main_app, document], anchor: 'share') end diff --git a/app/helpers/hyrax/collections_helper.rb b/app/helpers/hyrax/collections_helper.rb index 64b39e8aeb..9c2631ee53 100644 --- a/app/helpers/hyrax/collections_helper.rb +++ b/app/helpers/hyrax/collections_helper.rb @@ -23,11 +23,11 @@ def has_collection_search_parameters? end def button_for_remove_from_collection(collection, document, label = 'Remove From Collection') - render 'hyrax/collections/button_remove_from_collection', collection: collection, label: label, document: document + render 'hyrax/dashboard/collections/button_remove_from_collection', collection: collection, label: label, document: document end def button_for_remove_selected_from_collection(collection, label = 'Remove From Collection') - render 'hyrax/collections/button_for_remove_selected_from_collection', collection: collection, label: label + render 'hyrax/dashboard/collections/button_for_remove_selected_from_collection', collection: collection, label: label end # add hidden fields to a form for removing a single document from a collection @@ -39,7 +39,7 @@ def single_item_action_remove_form_fields(form, document) # add hidden fields to a form for performing an action on a single document on a collection def single_item_action_form_fields(form, document, action) - render 'hyrax/collections/single_item_action_fields', form: form, document: document, action: action + render 'hyrax/dashboard/collections/single_item_action_fields', form: form, document: document, action: action end end end diff --git a/app/views/hyrax/collections/_button_create_collection.html.erb b/app/views/hyrax/collections/_button_create_collection.html.erb deleted file mode 100644 index e099393304..0000000000 --- a/app/views/hyrax/collections/_button_create_collection.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= button_to label, new_collection_path, method: :get, class: "btn btn-primary collection-add submits-batches", 'data-behavior'=>'hydra-collections', id: 'hydra-collection-add' %> diff --git a/app/views/hyrax/collections/_list_collections.html.erb b/app/views/hyrax/collections/_list_collections.html.erb index 906e3bab1a..dfafa470ca 100644 --- a/app/views/hyrax/collections/_list_collections.html.erb +++ b/app/views/hyrax/collections/_list_collections.html.erb @@ -6,7 +6,7 @@
- <%= link_to url_for_document(document), id: "src_copy_link#{id}" do %> + <%= link_to hyrax.dashboard_collection_path(id) do %> <%= t("hyrax.dashboard.my.sr.show_label") %> <%= document.title_or_label %> <% end %> diff --git a/app/views/hyrax/collections/_list_works.html.erb b/app/views/hyrax/collections/_list_works.html.erb index d91fcab5d1..f74b609293 100644 --- a/app/views/hyrax/collections/_list_works.html.erb +++ b/app/views/hyrax/collections/_list_works.html.erb @@ -33,8 +33,4 @@ <%= render_visibility_link document %> - - - <%= render 'work_action_menu', document: document %> - diff --git a/app/views/hyrax/collections/_show_document_list.html.erb b/app/views/hyrax/collections/_show_document_list.html.erb index 64ddee5afc..06694411f8 100644 --- a/app/views/hyrax/collections/_show_document_list.html.erb +++ b/app/views/hyrax/collections/_show_document_list.html.erb @@ -6,9 +6,6 @@ Title Date Uploaded Visibility - <% if current_user %> - Action - <% end %> diff --git a/app/views/hyrax/collections/_show_document_list_row.html.erb b/app/views/hyrax/collections/_show_document_list_row.html.erb index 2525e24b8e..2694901ebb 100644 --- a/app/views/hyrax/collections/_show_document_list_row.html.erb +++ b/app/views/hyrax/collections/_show_document_list_row.html.erb @@ -23,11 +23,6 @@ <%= render_visibility_link(document) %> - <% if current_user %> - - <%= render 'show_document_list_menu', document: document %> - - <% end %> diff --git a/app/views/hyrax/collections/_sort_and_per_page.html.erb b/app/views/hyrax/collections/_sort_and_per_page.html.erb index 1ddfe15a3a..95bdd48aa2 100644 --- a/app/views/hyrax/collections/_sort_and_per_page.html.erb +++ b/app/views/hyrax/collections/_sort_and_per_page.html.erb @@ -1,12 +1,4 @@
- <%= render 'hyrax/collections/form_for_select_collection', user_collections: @user_collections %> - - <% if params[:action] == "edit" && @response.response['numFound'] > 1 %> -
- <% session[:batch_edit_state] = "on" %> - <%= button_for_remove_selected_from_collection collection %> -
- <% end %>
<%# kind of hacky way to get this to work on catalog and folder controllers. May be able to simple do {action: "index"} but I'm not sure -%> <% if @response.response['numFound'] > 1 && !sort_fields.empty? %> diff --git a/app/views/hyrax/collections/show.html.erb b/app/views/hyrax/collections/show.html.erb index 8aaf5afc6a..3fb8afdf8b 100644 --- a/app/views/hyrax/collections/show.html.erb +++ b/app/views/hyrax/collections/show.html.erb @@ -12,9 +12,6 @@
<%= render 'media_display', presenter: @presenter %> - <% unless has_collection_search_parameters? %> - <%= render 'show_actions', presenter: @presenter %> - <% end %>
diff --git a/app/views/hyrax/collections/_batch_edits_actions.html.erb b/app/views/hyrax/dashboard/collections/_batch_edits_actions.html.erb similarity index 100% rename from app/views/hyrax/collections/_batch_edits_actions.html.erb rename to app/views/hyrax/dashboard/collections/_batch_edits_actions.html.erb diff --git a/app/views/hyrax/dashboard/collections/_bookmark_control.html.erb b/app/views/hyrax/dashboard/collections/_bookmark_control.html.erb new file mode 100644 index 0000000000..3b044d7d91 --- /dev/null +++ b/app/views/hyrax/dashboard/collections/_bookmark_control.html.erb @@ -0,0 +1,23 @@ +<% # This template overrides Blacklight to provide the main_app scope to the links %> +<% if current_or_guest_user %> + <%- + # Note these two forms are pretty similar but for different :methods, classes, and labels. + # but it was simpler to leave them seperate instead of DRYing them, got confusing trying that. + # the data-doc-id attribute is used by our JS that converts to a checkbox/label. + -%> + <% unless bookmarked? document %> + + <%= form_tag(main_app.bookmark_path( document ), :method => :put, :class => "bookmark_toggle", "data-doc-id" => document.id, :'data-present' => t('blacklight.search.bookmarks.present'), :'data-absent' => t('blacklight.search.bookmarks.absent'), :'data-inprogress' => t('blacklight.search.bookmarks.inprogress')) do %> + <%= submit_tag(t('blacklight.bookmarks.add.button'), :id => "bookmark_toggle_#{document.id.to_s.parameterize}", :class => "bookmark_add btn btn-default") %> + <% end %> + + <% else %> + + <%= form_tag(main_app.bookmark_path( document ), :method => :delete, :class => "bookmark_toggle", "data-doc-id" => document.id, :'data-present' => t('blacklight.search.bookmarks.present'), :'data-absent' => t('blacklight.search.bookmarks.absent'), :'data-inprogress' => t('blacklight.search.bookmarks.inprogress')) do %> + <%= submit_tag(t('blacklight.bookmarks.remove.button'), :id => "bookmark_toggle_#{document.id.to_s.parameterize}", :class => "bookmark_remove btn btn-default") %> + <% end %> + + <% end %> +<% else %> +   +<% end %> diff --git a/app/views/hyrax/dashboard/collections/_button_create_collection.html.erb b/app/views/hyrax/dashboard/collections/_button_create_collection.html.erb new file mode 100644 index 0000000000..2da01139c4 --- /dev/null +++ b/app/views/hyrax/dashboard/collections/_button_create_collection.html.erb @@ -0,0 +1 @@ +<%= button_to label, hyrax.new_dashboard_collection_path, method: :get, class: "btn btn-primary collection-add submits-batches", 'data-behavior'=>'hydra-collections', id: 'hydra-collection-add' %> diff --git a/app/views/hyrax/collections/_button_for_remove_selected_from_collection.html.erb b/app/views/hyrax/dashboard/collections/_button_for_remove_selected_from_collection.html.erb similarity index 74% rename from app/views/hyrax/collections/_button_for_remove_selected_from_collection.html.erb rename to app/views/hyrax/dashboard/collections/_button_for_remove_selected_from_collection.html.erb index 650c39d91a..20ea2ba571 100644 --- a/app/views/hyrax/collections/_button_for_remove_selected_from_collection.html.erb +++ b/app/views/hyrax/dashboard/collections/_button_for_remove_selected_from_collection.html.erb @@ -1,7 +1,7 @@ <%# button for removing a batch from a collection %> <%# collection -- collection to be updated %> <%# label -- button label %> -<%= form_for collection, url:collection_path(collection.id), :method=>:put do |f| %> +<%= form_for collection, url: hyrax.dashboard_collection_path(collection.id), method: :put do |f| %> <%= f.hidden_field :members, :value => "remove" %> <%= f.submit label, :class => "btn btn-primary collection-remove-selected submits-batches" %> <% end %> diff --git a/app/views/hyrax/collections/_button_for_update_collection.html.erb b/app/views/hyrax/dashboard/collections/_button_for_update_collection.html.erb similarity index 83% rename from app/views/hyrax/collections/_button_for_update_collection.html.erb rename to app/views/hyrax/dashboard/collections/_button_for_update_collection.html.erb index c82af37de5..d9a09d156d 100644 --- a/app/views/hyrax/collections/_button_for_update_collection.html.erb +++ b/app/views/hyrax/dashboard/collections/_button_for_update_collection.html.erb @@ -1,7 +1,7 @@ <%# button for updating a collections %> <%# collection_id -- collection to be updated (use 'collection_replace_id' if you wish the form to be updated by a form value) %> <%# label -- button label %> -<%= button_to label, collection_path(collection_id), +<%= button_to label, hyrax.dashboard_collection_path(collection_id), method: :put, class: "btn btn-primary submits-batches", data: { behavior: 'updates-collection' } %> diff --git a/app/views/hyrax/collections/_button_remove_from_collection.html.erb b/app/views/hyrax/dashboard/collections/_button_remove_from_collection.html.erb similarity index 54% rename from app/views/hyrax/collections/_button_remove_from_collection.html.erb rename to app/views/hyrax/dashboard/collections/_button_remove_from_collection.html.erb index 68307c1a41..50aff67386 100644 --- a/app/views/hyrax/collections/_button_remove_from_collection.html.erb +++ b/app/views/hyrax/dashboard/collections/_button_remove_from_collection.html.erb @@ -1,4 +1,4 @@ -<%= form_for collection, url: collection_path(collection), method: :put, as: 'collection' do |f| %> +<%= form_for collection, url: hyrax.dashboard_collection_path(collection), method: :put, as: 'collection' do |f| %> <%= single_item_action_remove_form_fields(f, document) %> <%= f.submit label, class: "btn btn-primary collection-remove" %> <% end %> diff --git a/app/views/hyrax/dashboard/collections/_document_list.html.erb b/app/views/hyrax/dashboard/collections/_document_list.html.erb new file mode 100644 index 0000000000..1d1c7fded9 --- /dev/null +++ b/app/views/hyrax/dashboard/collections/_document_list.html.erb @@ -0,0 +1,13 @@ +<% @all_checked = false %> +<% @user = current_user %> +<% if documents.nil? || documents.empty? %> + +<% else %> + <% @document_list = documents %> + <% @disable_select_all = (@document_list.count <= 1) %> + <% if params[:action] == "edit" %> + <%= render 'form_default_group', documents: documents, docs: documents %> + <% else %> + <%= render 'show_document_list', documents: documents %> + <% end %> +<% end %> diff --git a/app/views/hyrax/collections/_edit_actions.html.erb b/app/views/hyrax/dashboard/collections/_edit_actions.html.erb similarity index 100% rename from app/views/hyrax/collections/_edit_actions.html.erb rename to app/views/hyrax/dashboard/collections/_edit_actions.html.erb diff --git a/app/views/hyrax/collections/_form.html.erb b/app/views/hyrax/dashboard/collections/_form.html.erb similarity index 97% rename from app/views/hyrax/collections/_form.html.erb rename to app/views/hyrax/dashboard/collections/_form.html.erb index 892495af82..4bf15c1f06 100644 --- a/app/views/hyrax/collections/_form.html.erb +++ b/app/views/hyrax/dashboard/collections/_form.html.erb @@ -12,7 +12,7 @@ <% end %> - <%= simple_form_for @form, html: { class: 'editor' } do |f| %> + <%= simple_form_for @form, url: [hyrax, :dashboard, @form], html: { class: 'editor' } do |f| %>
diff --git a/app/views/hyrax/dashboard/collections/_form_default_group.html.erb b/app/views/hyrax/dashboard/collections/_form_default_group.html.erb new file mode 100644 index 0000000000..e4c5213df4 --- /dev/null +++ b/app/views/hyrax/dashboard/collections/_form_default_group.html.erb @@ -0,0 +1,25 @@ +<% # This was renamed from _default_group to prevent if from being used for All Collection index which needs to use my/collections/_default_group %> + + + <% unless params[:display_type] == 'list' %> + + + + + + + + + + <% end %> + + <% docs.each_with_index do |document, counter| %> + <% # Collection members may be collections or works %> + <% if document.collection? %> + <%= render 'list_collections', document: document, counter: counter %> + <% else %> + <%= render 'list_works', document: document, counter: counter, presenter: Hyrax::WorkShowPresenter.new(document, current_ability) %> + <% end %> + <% end %> + +
<%= t("hyrax.dashboard.my.sr.listing") %> <%= application_name %>
<%= render_check_all %><%= t("hyrax.dashboard.my.heading.title") %>"><%= t("hyrax.dashboard.my.heading.date_uploaded") %><%= t("hyrax.dashboard.my.heading.visibility") %><%= t("hyrax.dashboard.my.heading.action") %>
diff --git a/app/views/hyrax/collections/_form_for_select_collection.html.erb b/app/views/hyrax/dashboard/collections/_form_for_select_collection.html.erb similarity index 81% rename from app/views/hyrax/collections/_form_for_select_collection.html.erb rename to app/views/hyrax/dashboard/collections/_form_for_select_collection.html.erb index 317840d001..5567395c0a 100644 --- a/app/views/hyrax/collections/_form_for_select_collection.html.erb +++ b/app/views/hyrax/dashboard/collections/_form_for_select_collection.html.erb @@ -28,11 +28,11 @@
diff --git a/app/views/hyrax/collections/_form_permission.html.erb b/app/views/hyrax/dashboard/collections/_form_permission.html.erb similarity index 100% rename from app/views/hyrax/collections/_form_permission.html.erb rename to app/views/hyrax/dashboard/collections/_form_permission.html.erb diff --git a/app/views/hyrax/collections/_form_share.html.erb b/app/views/hyrax/dashboard/collections/_form_share.html.erb similarity index 100% rename from app/views/hyrax/collections/_form_share.html.erb rename to app/views/hyrax/dashboard/collections/_form_share.html.erb diff --git a/app/views/hyrax/dashboard/collections/_list_collections.html.erb b/app/views/hyrax/dashboard/collections/_list_collections.html.erb new file mode 100644 index 0000000000..3653419d85 --- /dev/null +++ b/app/views/hyrax/dashboard/collections/_list_collections.html.erb @@ -0,0 +1,45 @@ +<% id = document.id %> + + + +
+ +
+
+ <%#= link_to url_for_document(document), id: "src_copy_link#{id}" do %> + <%= link_to hyrax.dashboard_collection_path(id) do %> + <%= t("hyrax.dashboard.my.sr.show_label") %> + <%= document.title_or_label %> + <% end %> + + + <%= "#{t("hyrax.dashboard.my.sr.detail_label")} #{document.title_or_label}" %> + +
+
+
+ + <%= document.create_date %> + + <%= render_visibility_link(document) %> + + + <%= render 'collection_action_menu', id: id %> + + + + +
+
<%= t("hyrax.dashboard.my.collection_list.description") %>
+
<%= document.description.first %>
+
<%= t("hyrax.dashboard.my.collection_list.edit_access") %>
+
+ <% if document.edit_groups.present? %> + <%= t("hyrax.dashboard.my.collection_list.groups") %> <%= document.edit_groups.join(', ') %> +
+ <% end %> + <%= t("hyrax.dashboard.my.collection_list.users") %> <%= document.edit_people.join(', ') %> +
+
+ + diff --git a/app/views/hyrax/dashboard/collections/_list_works.html.erb b/app/views/hyrax/dashboard/collections/_list_works.html.erb new file mode 100644 index 0000000000..d91fcab5d1 --- /dev/null +++ b/app/views/hyrax/dashboard/collections/_list_works.html.erb @@ -0,0 +1,40 @@ + + + + + <%= render 'hyrax/batch_select/add_button', document: document %>  + + + +
+ <%= link_to [main_app, document], class: 'media-left', 'aria-hidden' => true do %> + <%= render_thumbnail_tag document, { class: 'hidden-xs file_listing_thumbnail' }, { suppress_link: true } %> + <% end %> + +
+
+ + <%= link_to [main_app, document], id: "src_copy_link#{document.id}", class: 'document-title' do %> + + <%= t("hyrax.dashboard.my.sr.show_label") %> + + <%= document.title_or_label %> + <% end %> + +
+ <%= render_collection_links(document) %> + +
+
+
+ + + <%= document.date_uploaded %> + + + <%= render_visibility_link document %> + + + <%= render 'work_action_menu', document: document %> + + diff --git a/app/views/hyrax/collections/_show_actions.html.erb b/app/views/hyrax/dashboard/collections/_show_actions.html.erb similarity index 94% rename from app/views/hyrax/collections/_show_actions.html.erb rename to app/views/hyrax/dashboard/collections/_show_actions.html.erb index 5195a46af8..74a3b3535e 100644 --- a/app/views/hyrax/collections/_show_actions.html.erb +++ b/app/views/hyrax/dashboard/collections/_show_actions.html.erb @@ -2,7 +2,7 @@
<% if can? :edit, presenter.solr_document %> <%= link_to t('hyrax.collection.actions.edit.label'), - edit_collection_path(presenter), + edit_dashboard_collection_path(presenter), title: t('hyrax.collection.actions.edit.desc'), class: 'btn btn-default' %> <%= link_to t('hyrax.collection.actions.add_works.label'), diff --git a/app/views/hyrax/dashboard/collections/_show_descriptions.html.erb b/app/views/hyrax/dashboard/collections/_show_descriptions.html.erb new file mode 100644 index 0000000000..f0ff699ff1 --- /dev/null +++ b/app/views/hyrax/dashboard/collections/_show_descriptions.html.erb @@ -0,0 +1,7 @@ +

Descriptions

+ diff --git a/app/views/hyrax/dashboard/collections/_show_document_list.html.erb b/app/views/hyrax/dashboard/collections/_show_document_list.html.erb new file mode 100644 index 0000000000..64ddee5afc --- /dev/null +++ b/app/views/hyrax/dashboard/collections/_show_document_list.html.erb @@ -0,0 +1,17 @@ + + + + + + + + + <% if current_user %> + + <% end %> + + + + <%= render partial: 'show_document_list_row', collection: documents, as: :document %> + +
List of items in this collection
 TitleDate UploadedVisibilityAction
diff --git a/app/views/hyrax/collections/_show_document_list_menu.html.erb b/app/views/hyrax/dashboard/collections/_show_document_list_menu.html.erb similarity index 100% rename from app/views/hyrax/collections/_show_document_list_menu.html.erb rename to app/views/hyrax/dashboard/collections/_show_document_list_menu.html.erb diff --git a/app/views/hyrax/dashboard/collections/_show_document_list_row.html.erb b/app/views/hyrax/dashboard/collections/_show_document_list_row.html.erb new file mode 100644 index 0000000000..2525e24b8e --- /dev/null +++ b/app/views/hyrax/dashboard/collections/_show_document_list_row.html.erb @@ -0,0 +1,49 @@ +<% id = document.id %> + +   + <% if current_user and document.depositor != current_user.user_key %> + + <% end %> + + +
+ <%= link_to [main_app, document], class: "media-left" do %> + <%= render_thumbnail_tag document, { class: "hidden-xs file_listing_thumbnail" }, { suppress_link: true } %> + <% end %> +
+

+ <%= link_to document.title_or_label, [main_app, document], id: "src_copy_link#{id}", class: "#{'document-title' if document.title_or_label == document.label}" %> + +

+ <%= render_collection_links(document) %> +
+
+ + <%= document.date_uploaded %> + + <%= render_visibility_link(document) %> + + <% if current_user %> + + <%= render 'show_document_list_menu', document: document %> + + <% end %> + + + +
+
Creator:
+
<%= document.creator.to_a.to_sentence %>
+
Depositor:
+
<%= link_to_profile document.depositor %>
+
Edit Access:
+
+ <% if document.edit_groups.present? %> + Groups: <%= document.edit_groups.join(', ') %> +
+ <% end %> + Users: <%= document.edit_people.join(', ') %> +
+
+ + diff --git a/app/views/hyrax/dashboard/collections/_show_fields.html.erb b/app/views/hyrax/dashboard/collections/_show_fields.html.erb new file mode 100644 index 0000000000..e69de29bb2 diff --git a/app/views/hyrax/collections/_single_item_action_fields.html.erb b/app/views/hyrax/dashboard/collections/_single_item_action_fields.html.erb similarity index 100% rename from app/views/hyrax/collections/_single_item_action_fields.html.erb rename to app/views/hyrax/dashboard/collections/_single_item_action_fields.html.erb diff --git a/app/views/hyrax/dashboard/collections/_sort_and_per_page.html.erb b/app/views/hyrax/dashboard/collections/_sort_and_per_page.html.erb new file mode 100644 index 0000000000..99235f5032 --- /dev/null +++ b/app/views/hyrax/dashboard/collections/_sort_and_per_page.html.erb @@ -0,0 +1,32 @@ +
+ <%= render 'form_for_select_collection', user_collections: @user_collections %> + + <% if params[:action] == "edit" && @response.response['numFound'] > 1 %> +
+ <% session[:batch_edit_state] = "on" %> + <%= button_for_remove_selected_from_collection collection %> +
+ <% end %> +
+ <%# kind of hacky way to get this to work on catalog and folder controllers. May be able to simple do {action: "index"} but I'm not sure -%> + <% if @response.response['numFound'] > 1 && !sort_fields.empty? %> + <%= form_tag collection_path(collection), method: :get, class: 'per_page form-horizontal' do %> +
+
+ <%= t('hyrax.sort_label') %> + <%= label_tag(:sort, "Sort By:".html_safe) %> + <%= select_tag(:sort, options_for_select(sort_fields, h(params[:sort]))) %> + <%= label_tag(:per_page) do %> + Show <%= select_tag(:per_page, options_for_select(['10', '20', '50', '100'], h(params[:per_page])), title: "Number of results to display per page") %> + per page + <% end %> + <%= render_hash_as_hidden_fields(search_state.params_for_search.except(:per_page, :sort)) %> +     + +
+ <%= render 'view_type_group' %> +
+ <% end %> + <% end %> +
+
diff --git a/app/views/hyrax/collections/_work_action_menu.html.erb b/app/views/hyrax/dashboard/collections/_work_action_menu.html.erb similarity index 100% rename from app/views/hyrax/collections/_work_action_menu.html.erb rename to app/views/hyrax/dashboard/collections/_work_action_menu.html.erb diff --git a/app/views/hyrax/collections/edit.html.erb b/app/views/hyrax/dashboard/collections/edit.html.erb similarity index 73% rename from app/views/hyrax/collections/edit.html.erb rename to app/views/hyrax/dashboard/collections/edit.html.erb index f536be9fe9..6b3fa87033 100644 --- a/app/views/hyrax/collections/edit.html.erb +++ b/app/views/hyrax/dashboard/collections/edit.html.erb @@ -7,7 +7,7 @@ <% unless has_collection_search_parameters? %>
- <%= render 'hyrax/collections/form' %> + <%= render 'form' %>
@@ -15,19 +15,19 @@
- <%= render 'hyrax/collections/edit_actions' %> + <%= render 'edit_actions' %>

<%= t('hyrax.collection.edit.manage_items') %>

- <%= render 'search_form', presenter: @collection %> + <%= render 'hyrax/collections/search_form', presenter: @collection %>
<%= render 'hyrax/my/did_you_mean' %> <%= render 'hyrax/my/facet_selected' %> - <%= render 'hyrax/collections/sort_and_per_page', collection: @collection if @response.response['numFound'] > 0 %> + <%= render 'sort_and_per_page', collection: @collection if @response.response['numFound'] > 0 %> <%= render 'document_list', documents: @member_docs, document_list_format: "dashboard" %> - <%= render 'paginate' %> + <%= render 'hyrax/collections/paginate' %>
diff --git a/app/views/hyrax/collections/edit_fields/_description.html.erb b/app/views/hyrax/dashboard/collections/edit_fields/_description.html.erb similarity index 100% rename from app/views/hyrax/collections/edit_fields/_description.html.erb rename to app/views/hyrax/dashboard/collections/edit_fields/_description.html.erb diff --git a/app/views/hyrax/collections/new.html.erb b/app/views/hyrax/dashboard/collections/new.html.erb similarity index 84% rename from app/views/hyrax/collections/new.html.erb rename to app/views/hyrax/dashboard/collections/new.html.erb index d04bf760b4..15c7abf3cd 100644 --- a/app/views/hyrax/collections/new.html.erb +++ b/app/views/hyrax/dashboard/collections/new.html.erb @@ -6,6 +6,6 @@
- <%= render 'hyrax/collections/form' %> + <%= render 'form' %>
diff --git a/app/views/hyrax/dashboard/collections/show.html.erb b/app/views/hyrax/dashboard/collections/show.html.erb new file mode 100644 index 0000000000..873b86292e --- /dev/null +++ b/app/views/hyrax/dashboard/collections/show.html.erb @@ -0,0 +1,36 @@ +<% provide :page_title, construct_page_title(@presenter.title) %> +
+
+
+ <%= render 'hyrax/collections/collection_title', presenter: @presenter %> +
+ <%= render 'hyrax/collections/collection_description', presenter: @presenter %> + + <% unless has_collection_search_parameters? %> + <%= render 'show_descriptions' %> + <% end %> +
+
+ <%= render 'hyrax/collections/media_display', presenter: @presenter %> + <% unless has_collection_search_parameters? %> + <%= render 'show_actions', presenter: @presenter %> + <% end %> +
+
+ +
+

+ <% if has_collection_search_parameters? %> + Search Results within this Collection + <% else %> + <%= t('.works_in_collection') %> + <% end %> +

+
<%= render 'hyrax/collections/search_form', presenter: @presenter %>
+
+ +<%= render 'sort_and_per_page', collection: @presenter %> + +<%= render_document_index @member_docs %> + +<%= render 'hyrax/collections/paginate' %> diff --git a/app/views/hyrax/my/_collection_action_menu.html.erb b/app/views/hyrax/my/_collection_action_menu.html.erb index cb415437b6..6b1504f2f4 100644 --- a/app/views/hyrax/my/_collection_action_menu.html.erb +++ b/app/views/hyrax/my/_collection_action_menu.html.erb @@ -5,14 +5,14 @@