[Archivesspace_Users_Group] AS browse/search customizations?

Chris Fitzpatrick Chris.Fitzpatrick at lyrasis.org
Thu Oct 2 03:25:04 EDT 2014


Glad it worked for you. Let me know if you have any other questions about it. Removing the links from that pull down won't remove access to the Classification page...people can probably find their way there from links on other pages or by just typing in the URL. If you want to really restrict access, you can override the ClassificationsController #index and #show actions to redirect somewhere else....


b,chris.


Chris Fitzpatrick | Developer, ArchivesSpace
Skype: chrisfitzpat  | Phone: 918.236.6048
http://archivesspace.org/
________________________________
From: archivesspace_users_group-bounces at lyralists.lyrasis.org <archivesspace_users_group-bounces at lyralists.lyrasis.org> on behalf of Galligan, Patrick <PGalligan at rockarch.org>
Sent: Wednesday, October 01, 2014 8:24 PM
To: Archivesspace Users Group
Subject: Re: [Archivesspace_Users_Group] AS browse/search customizations?

Chris,

Thanks a lot for these, they worked like a charm and are easy to tweak.

I had tried to change the _header_repository.html.erb file earlier in the week to remove classifications, but I just couldn’t get it to work. Looking at the code helped a lot.

Patrick Galligan
Rockefeller Archive Center
Assistant Digital Archivist
914-366-6386

From: archivesspace_users_group-bounces at lyralists.lyrasis.org [mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org] On Behalf Of Chris Fitzpatrick
Sent: Wednesday, October 01, 2014 12:23 PM
To: Archivesspace Users Group
Subject: Re: [Archivesspace_Users_Group] AS browse/search customizations?


Hi All,



Take a look at this gist =>

https://gist.github.com/cfitz/af3157ef7967368aadfc





Most of these can go into your plugins/local/frontend directory.



 The _header_repository.html.erb is just the default template with the links to Classifications index removed.



The search_data_result.rb simply changes the facet definition for the resources ( and the plugin_init.rb loads that override ).



The my_resources_controller.rb overrider the index action of the ResourcesController to throw in a user_mtime sort on the records.



The solr.rb file can go into plugins/local/backend/model directory. It simply adds the facet.sort=index param to index queries so that Solr sorts facets by alphnumeric rather than count.



Let me know if you have any questions...

b,chris.




Chris Fitzpatrick | Developer, ArchivesSpace
Skype: chrisfitzpat  | Phone: 918.236.6048
http://archivesspace.org/
________________________________
From: archivesspace_users_group-bounces at lyralists.lyrasis.org<mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org> <archivesspace_users_group-bounces at lyralists.lyrasis.org<mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org>> on behalf of Galligan, Patrick <PGalligan at rockarch.org<mailto:PGalligan at rockarch.org>>
Sent: Tuesday, September 30, 2014 8:08 PM
To: Archivesspace Users Group
Subject: Re: [Archivesspace_Users_Group] AS browse/search customizations?

Rachel,

Thanks for the info.

I’d love to find out where to make the changes in the actual template, obviously, but your method for the sorting would definitely work as an initial workaround.

As for the second point, we are, unfortunately hoping to re-order the actual sections (so Subject comes before Type, in your example). However, we may want to undertake your internal re-ordering as well.

Anyone else had experience making these changes in the templates?

Patrick Galligan
Rockefeller Archive Center
Assistant Digital Archivist
914-366-6386

From: archivesspace_users_group-bounces at lyralists.lyrasis.org<mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org> [mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org] On Behalf Of Maderik, Rachel A.
Sent: Tuesday, September 30, 2014 1:36 PM
To: Archivesspace Users Group
Subject: Re: [Archivesspace_Users_Group] AS browse/search customizations?

For your first point, we used a plugin to automatically add the desired sort type (A-Z in our case) if the browse URL doesn’t already contain one, so http://archivesspace.vmi.edu/search?type=resource essentially redirects to http://archivesspace.vmi.edu/search?type=resource&sort=title_sort+asc.  It’s a bit clunky, so I’d love to know if there’s a cleaner way to change this in the templates themselves. The JS is below, if you want to try it out.

For your second point, are you talking about re-ordering the sections that appear (so “Subject” shows up before “Type”), or re-ordering the contents of each facet? If it’s the latter, we used a plugin to sort them alphabetically instead of by number of items (https://github.com/maderikra/archivesspace-plugins/tree/master/sort_facets). If it’s the former, that could also be accomplished with a jQuery plugin, but since ArchivesSpace has a habit of not using IDs in the HTML tags (which is something I would love to see and should be simple to implement), it could be tricky to identify individual sections.

-------------------------

function changesort1() {

        var curURL = document.location;
        var newURL = curURL + '&sort=title_sort+asc';
        window.location.replace (newURL);
        }

function changesort2() {

        var curURL = document.location;
        var newURL = curURL + '?sort=title_sort+asc';
        window.location.replace (newURL);
        }

//checks to make sure we're on a browse screen with no query terms and no existing sort
if ((( /search/.test(window.location.pathname)) && (/q=/.test(window.location.search) === false) && (/type=/.test(window.location.search)) && (/sort=/.test(window.location.search) === false)))
{
$(document).ready(changesort1);
}

//checks to see if we're on a repository screen
if ((( /repositories\/[0-9]/.test(window.location.pathname)) && (/q=/.test(window.location.search) === false) && (/sort=/.test(window.location.search) === false)))
{
$(document).ready(changesort2);
}



From: archivesspace_users_group-bounces at lyralists.lyrasis.org<mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org> [mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org] On Behalf Of Galligan, Patrick
Sent: Tuesday, September 30, 2014 12:20 PM
To: Archivesspace Users Group
Subject: [Archivesspace_Users_Group] AS browse/search customizations?

In early September, Ben Goldman brought up that he’d like to be able to customize the browsing and searching options a little bit more, and a few of us agreed. However, it’s been pretty quiet since then.

I’m looking to:

•         Change the default sort order on the browse page (Resources or Accessions automatically display in date descending order or identifier order)

•         Change the order of facets on the left side of the page

•         Hide the option for browsing classifications entirely

These should be possible, but I’m having trouble finding the files that control these options. Has anyone else had luck doing anything like this?

Thanks,

Patrick Galligan
Rockefeller Archive Center
Assistant Digital Archivist
914-366-6386

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20141002/a661dd18/attachment.html>


More information about the Archivesspace_Users_Group mailing list