Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display an admin set from the user perspective
Fixes #2650
- Loading branch information
Showing
8 changed files
with
134 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
module Sufia | ||
class AdminSetsController < ApplicationController | ||
include CurationConcerns::CollectionsControllerBehavior | ||
include Sufia::CollectionsControllerBehavior | ||
layout "sufia-one-column" | ||
|
||
self.presenter_class = Sufia::AdminSetPresenter | ||
|
||
self.list_search_builder_class = CurationConcerns::AdminSetSearchBuilder | ||
# Used for the show action | ||
self.single_item_search_builder_class = Sufia::SingleAdminSetSearchBuilder | ||
# Used to get the members for the show action | ||
self.member_search_builder_class = Sufia::AdminSetMemberSearchBuilder | ||
|
||
# Override the default prefixes so that we use the collection partals. | ||
def _prefixes | ||
@_prefixes ||= ["sufia/admin_sets", "collections", 'catalog'] | ||
def self.local_prefixes | ||
["sufia/admin_sets", "collections", 'catalog'] | ||
end | ||
|
||
# Overriding the way that the search builder is initialized | ||
def list_search_builder | ||
list_search_builder_class.new(self, :read) | ||
end | ||
private | ||
|
||
# Overriding the way that the search builder is initialized | ||
def list_search_builder | ||
list_search_builder_class.new(self, :read) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,30 @@ | ||
<% # container for all documents in index list view -%> | ||
<table class="documents-<%= document_index_view_type %> table table-striped"> | ||
<thead> | ||
<tr> | ||
<th colspan="2">Title</th> | ||
<th>Date created</th> | ||
<th>Language</th> | ||
<th>Works</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<%= render documents, as: :document %> | ||
</tbody> | ||
</table> | ||
<% # container for all documents in index list view and the members in the show view -%> | ||
<% if action_name == 'index' %> | ||
<table class="documents-<%= document_index_view_type %> table table-striped"> | ||
<thead> | ||
<tr> | ||
<th colspan="2">Title</th> | ||
<th>Date created</th> | ||
<th>Language</th> | ||
<th>Works</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<%= render documents, as: :document %> | ||
</tbody> | ||
</table> | ||
<% else %> | ||
<% # This is for the member list # %> | ||
<table class="documents-<%= document_index_view_type %> table table-striped"> | ||
<thead> | ||
<tr> | ||
<th>Title</th> | ||
<th>Date created</th> | ||
<th>Creator</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<%= render partial: 'member_document', collection: documents %> | ||
</tbody> | ||
</table> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<tr> | ||
<td class="row"> | ||
<div class="col-sm-2"> | ||
<%= render_thumbnail_tag member_document %> | ||
</div> | ||
<div class="col-sm-10"> | ||
<%= link_to member_document.to_s, member_document %> | ||
</div> | ||
</td> | ||
<td> | ||
<%= member_document.create_date %> | ||
</td> | ||
<td> | ||
<%= member_document.creator.join(', ') %> | ||
</td> | ||
</tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<%= form_for [sufia, presenter], method: :get, class: "well form-search" do |f| %> | ||
<label class="sr-only"><%= t('curation_concerns.collections.search_form.label', title: presenter.to_s) %></label> | ||
<div class="input-group"> | ||
<%= text_field_tag :cq, params[:cq], class: "collection-query form-control", placeholder: t('curation_concerns.collections.search_form.placeholder'), size: '30', type: "search", id: "collection_search" %> | ||
<div class="input-group-btn"> | ||
<button type="submit" class="btn btn-primary" id="collection_submit"><i class="glyphicon glyphicon-search"></i> Go</button> | ||
</div> | ||
</div> | ||
<%= hidden_field_tag :sort, params[:sort], id: 'collection_sort' %> | ||
<%= render_hash_as_hidden_fields(search_state.params_for_search.except(:cq, :sort, :qt, :page)) %> | ||
<% end %> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<% provide :page_title, construct_page_title(@presenter.title) %> | ||
|
||
<div itemscope itemtype="http://schema.org/CollectionPage" class="row"> | ||
<div class="col-sm-10 pull-right"> | ||
<header> | ||
<h1><%= @presenter %> | ||
<%= link_to sufia.admin_sets_path do %> | ||
<span class="label label-info">Administrative Collection</span> | ||
<% end %> | ||
</h1> | ||
</header> | ||
<%= render 'collection_description', presenter: @presenter %> | ||
<%= render 'collections/show_descriptions' %> | ||
</div> | ||
<div class="col-sm-2"> | ||
<span class="fa fa-sitemap collection-icon-search"></span> | ||
</div> | ||
</div> | ||
|
||
<h2>Works in this Collection</h2> | ||
|
||
<%= render 'sort_and_per_page', collection: @presenter %> | ||
<%= render_document_index @member_docs %> | ||
<%= render 'paginate' %> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require 'spec_helper' | ||
|
||
RSpec.describe "The public view of admin sets" do | ||
let(:admin_set) do | ||
create(:admin_set, :public, title: ["A completely unique name"], | ||
description: ["A substantial description"]) | ||
end | ||
|
||
before do | ||
create(:work, :public, admin_set: admin_set, title: ["My member work"]) | ||
end | ||
|
||
scenario do | ||
visit root_path | ||
click_link "View all administrative collections" | ||
click_link "A completely unique name" | ||
expect(page).to have_content "A substantial description" | ||
expect(page).to have_content "Works in this Collection" | ||
expect(page).to have_link "My member work" | ||
end | ||
end |