[Archivesspace_Users_Group] Overriding/Extending the new public interface in 2.2.0

Flanagan, Patrick PJFlanagan at ship.edu
Thu Dec 21 16:18:32 EST 2017


Hi Bobbi,


Thank you for this! I'll give it a try this way and see if I can make some progress.


~Patrick Flanagan

KLN Applications Administrator

Keystone Library Network Hub

________________________________
From: archivesspace_users_group-bounces at lyralists.lyrasis.org <archivesspace_users_group-bounces at lyralists.lyrasis.org> on behalf of Fox, Bobbi <bobbi_fox at harvard.edu>
Sent: Thursday, December 21, 2017 3:47:18 PM
To: Archivesspace Users Group
Subject: Re: [Archivesspace_Users_Group] Overriding/Extending the new public interface in 2.2.0

Hi, Patrick,

I’m having to do a lot of extending/overriding of controllers & methods in our new public interface.

You are correct; you can’t just override by placing your modified controller in the path location; instead, what *I’m* doing (and I know there’s a more elegant way of doing it); is put the changes in the plugin/plugin_init.rb ,using the [class|module]_eval method on something.

For instance, I’m changing what gets faceted in the Searchable concern this way in plugin_init.rb:
Searchable.module_eval do


def set_up_and_run_search(default_types = [],default_facets=[],default_search_opts={}, params={})
  ~ my stuff here ~~
end
            end


I’m adding methods to controllers in a somewhat similar way, for instance, in plugin_init.rb, I’ve got:

# add a digital only action to the resources controller



class ResourcesController



def digital_only



uri = "/repositories/#{params[:rid]}/resources/#{params[:id]}"


begin
~ etc. ~
end
           end

Hope this helps,
Bobbi

From: archivesspace_users_group-bounces at lyralists.lyrasis.org [mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org] On Behalf Of Flanagan, Patrick
Sent: Thursday, December 21, 2017 3:27 PM
To: Archivesspace Users Group <archivesspace_users_group at lyralists.lyrasis.org>
Subject: [Archivesspace_Users_Group] Overriding/Extending the new public interface in 2.2.0


Hello,



I'm attempting to write a plugin that will modify the way the breadcrumb trail (shown in the new public UI) is generated to include more detail. I decided to try and override one of the files in the controller part of the architecture: resources_controller.rb, since I can see the :crumb being defined there. However, either my path is wrong, or the new UI isn't utilizing it. Following the instructions here: http://archivesspace.github.io/archivesspace/user/archivesspace-plug-ins-readme/<https://urldefense.proofpoint.com/v2/url?u=http-3A__archivesspace.github.io_archivesspace_user_archivesspace-2Dplug-2Dins-2Dreadme_&d=DwMFAw&c=WO-RGvefibhHBZq3fL85hQ&r=5xWUzLrZrVLeTqs3CDoeRpPtLv1fRM04CCu4TDULrSY&m=3DmZ4KyjSuOHTC-7rfq8Dv2MTeEFEBci91sKzca-4YQ&s=is5OAKKChee55MtdTuQYDj2OwuvI8f0Y6lBLS8-ast8&e=> I've placed the file in the following directory:



as220/plugins/local/public/controllers/resources_controller.rb

( source location: /public/app/controllers/resources_controller.rb )
Plugin Config: AppConfig[:plugins] = ['local',  'lcnaf', 'aspace-public-formats']


If I'm not mistaken that document indicates that this is something that can be overridden, but I'm suspecting I can't actually override something in the controller from a plugin.



The version is 2.2.0, running on Linux x64, openjdk version "1.8.0_151". Any advice would be appreciated!



Thank you,



~Patrick Flanagan

KLN Applications Administrator

Keystone Library Network Hub
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20171221/03751fb2/attachment.html>


More information about the Archivesspace_Users_Group mailing list