Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #2502
- Loading branch information
Showing
13 changed files
with
184 additions
and
6 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
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,4 @@ | ||
module Sufia | ||
class AdminSetPresenter < CollectionPresenter | ||
end | ||
end |
12 changes: 12 additions & 0 deletions
12
app/search_builders/sufia/admin_set_member_search_builder.rb
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 @@ | ||
module Sufia | ||
# Builds a query to find the members of an admin set. | ||
class AdminSetMemberSearchBuilder < ::SearchBuilder | ||
self.default_processor_chain += [:in_admin_set] | ||
|
||
# include filters into the query to only include the collection memebers | ||
def in_admin_set(solr_parameters) | ||
solr_parameters[:fq] ||= [] | ||
solr_parameters[:fq] << "{!term f=isPartOf_ssim}#{blacklight_params.fetch('id')}" | ||
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Sufia | ||
class SingleAdminSetSearchBuilder < CurationConcerns::AdminSetSearchBuilder | ||
include CurationConcerns::SingleResult | ||
|
||
def initialize(context) | ||
super(context, :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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<% if show_pagination? %> | ||
<div id="sortAndPerPage" class="clearfix"> | ||
<%= render partial: "paginate_compact", object: @response %> | ||
</div> | ||
<% 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
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,38 @@ | ||
<% content_for :page_header do %> | ||
<h1><span class="fa fa-sitemap"></span> <%= t('.header') %></h1> | ||
<% end %> | ||
|
||
|
||
<div class="row"> | ||
<div class="col-md-12"> | ||
<div class="panel panel-default"> | ||
<div class="panel-heading"> | ||
<h2 class="panel-title display-page"><%= @presenter.to_s %></h2> | ||
<div class="pull-right"> | ||
<%= link_to sufia.edit_admin_admin_set_path(@presenter), class: 'btn btn-primary' do %> | ||
<span class="fa fa-edit"></span> Edit | ||
<% end %> | ||
</div> | ||
</div> | ||
|
||
<div class="panel-body admin-set row"> | ||
<div class="col-md-2"> | ||
<span class="fa fa-sitemap collection-icon-search"></span> | ||
</div> | ||
<div class="col-md-10"> | ||
<%= render 'collection_description', presenter: @presenter %> | ||
<%= render 'show_descriptions' %> | ||
</div> | ||
</div> | ||
|
||
<div class="panel-body"> | ||
<h3><%= t '.item_list_header' %></h3> | ||
<%= render 'sort_and_per_page', collection: @presenter %> | ||
<%= render_document_index @member_docs %> | ||
<%= render 'paginate' %> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
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
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,24 @@ | ||
require 'spec_helper' | ||
|
||
RSpec.describe "The admin sets, through the admin dashboard" do | ||
let(:user) { create :user } | ||
|
||
before do | ||
create(:admin_set, title: ["A completely unique name"], | ||
description: ["A substantial description"]) | ||
allow(RoleMapper).to receive(:byname).and_return(user.user_key => ['admin']) | ||
end | ||
|
||
scenario do | ||
login_as(user, scope: :user) | ||
visit '/admin' | ||
click_link "Administrative Sets" | ||
|
||
expect(page).to have_link "Create new administrative set" | ||
|
||
click_link "A completely unique name" | ||
|
||
expect(page).to have_content "A substantial description" | ||
expect(page).to have_content "Works in This Set" | ||
end | ||
end |
12 changes: 12 additions & 0 deletions
12
spec/search_builder/sufia/single_admin_set_search_builder_spec.rb
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 @@ | ||
require 'spec_helper' | ||
|
||
RSpec.describe Sufia::SingleAdminSetSearchBuilder do | ||
let(:ability) { instance_double(Ability, admin?: true) } | ||
let(:context) { double(blacklight_config: CatalogController.blacklight_config, | ||
current_ability: ability) } | ||
let(:builder) { described_class.new(context) } | ||
describe "#query" do | ||
subject { builder.with(id: '123').query.fetch('fq') } | ||
it { is_expected.to match_array ["", "_query_:\"{!field f=has_model_ssim}AdminSet\"", "_query_:\"{!field f=id}123\""] } | ||
end | ||
end |