The links in the navigation bar are defined an array called /$MAIN_MENU/
which is populated during start-up, using /AppConfig[:pui_hide]/ options
to determine which of the standard links to include.
You can make adjustments to it in your plug-in's /public/plugin_init.rb/
file (if that doesn't exist yet create it as a blank file.)
To add a new link on the end, use this:
/Plugins::add_menu_item("path_on_server_or_full_url", "Label")/
To add one at the start use:
/Plugins::add_menu_item("//path_on_server_or_full_url//", "Label", 0)/
There is no ready-made method for re-ordering existing links, but you
could do it with something like the following, for example to swap the
2nd and 4th links:
/ArchivesSpacePublic::Application.config.after_initialize do//
// $MAIN_MENU[1],$MAIN_MENU[3]=$MAIN_MENU[3],$MAIN_MENU[1]/
/end/
Directly modifying a global variable like that would be a bad thing for
a third-party plug-in to do. But for your local plug-in, customizing
your implementation, it should be OK. Just remember that if you change
your config.rb in the future, you might have to modify your plug-in too,
otherwise it could break the public user interface. But this method runs
on the server, during start-up, so is the most efficient option.
Andrew.
On 12/03/2021 19:27, Corey Schmidt wrote:
Good afternoon all,
I'm forwarding this message that a colleague of mine sent to the
Google Group, hoping to catch more bites here. Any advice/info would
be appreciated. Thanks!
We're using ArchivesSpace 2.7.1 and have been using the local
plugin overrides to customize. I've been successful in suppressing
items through the config file and relabeling using the
localizations, but I can't figure out how to change the order that
the links in the nav bar appear in. Anybody know how to do this? I
can't seem to find the relevant file. Currently we've got a local
copy of plugins\local\public\views\shared\_navigation.html.erb
that we are working with, and I see where it looks like it's
constructing the nav bar and links, but I'm not sure what the
underlying file is that I need to target to change it.
My colleague suspects that control of the order of the links in the
nav bar exists outside of the local plugins architecture because it's
under the config folder filepath
(/public/config/initializers/public_new_defaults.rb?), which the
documentation on the local plugin says isn't one that LP includes.
Thanks,
Corey
Corey Schmidt
ArchivesSpace Project Manager
University of Georgia Special Collections Libraries
/Email:/corey.schm...@uga.edu
_______________________________________________
Archivesspace_Users_Group mailing list
Archivesspace_Users_Group@lyralists.lyrasis.org
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
_______________________________________________
Archivesspace_Users_Group mailing list
Archivesspace_Users_Group@lyralists.lyrasis.org
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group