<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Title" content="">
<meta name="Keywords" content="">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Courier New";
        panose-1:2 7 3 9 2 2 5 2 4 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Menlo;
        panose-1:2 11 6 9 3 8 4 2 2 4;}
@font-face
        {font-family:Menlo-Regular;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Courier;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:Calibri;
        color:windowtext;}
span.msoIns
        {mso-style-type:export-only;
        mso-style-name:"";
        text-decoration:underline;
        color:teal;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body bgcolor="white" lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">This worked perfectly, thanks!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">In case there’s interest, my code is here:
<a href="https://github.com/duspeccoll/tree_component_id">https://github.com/duspeccoll/tree_component_id</a>. It turned out I needed to edit backend/model/large_tree.rb as well, to make it aware of the component_id field.  -k<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-family:Calibri;color:black">From: </span>
</b><span style="font-family:Calibri;color:black"><archivesspace_users_group-bounces@lyralists.lyrasis.org> on behalf of "Majewski, Steven Dennis (sdm7g)" <sdm7g@eservices.virginia.edu><br>
<b>Reply-To: </b>Archivesspace Group <archivesspace_users_group@lyralists.lyrasis.org><br>
<b>Date: </b>Tuesday, April 25, 2017 at 12:01 PM<br>
<b>To: </b>Archivesspace Group <archivesspace_users_group@lyralists.lyrasis.org><br>
<b>Subject: </b>Re: [Archivesspace_Users_Group] overriding javascript via plugin<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Your screenshot was dropped from your email, so I don’t know exactly what you want, but you can monkey patch ResourceRenderer methods and change or decorate output with something like this in your plugins/local/frontend/views/layout_head_html.erb:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<pre style="background:white"><span style="font-size:9.0pt;font-family:Menlo;background:#EFEFEF"><<b><span style="color:navy">meta </span><span style="color:blue">name=</span><span style="color:green">"controller" </span><span style="color:blue">content=</span><span style="color:green">"</span><span style="color:navy"><%=</span></b></span><b><span style="font-size:9.0pt;font-family:Menlo;color:navy;background:#F2E8E4"> </span></b><b><span style="font-size:9.0pt;font-family:Menlo;background:#F2E8E4">controller<span style="color:blue">.</span>controller_name </span></b><b><span style="font-size:9.0pt;font-family:Menlo;color:navy;background:#EFEFEF">%></span></b><b><span style="font-size:9.0pt;font-family:Menlo;color:green;background:#EFEFEF">" </span></b><span style="font-size:9.0pt;font-family:Menlo;background:#EFEFEF">/></span><span style="font-size:9.0pt;font-family:Menlo"><br><span style="background:#EFEFEF"><<b><span style="color:navy">script </span><span style="color:blue">type=</span><span style="color:green">"text/javascript"</span></b>></span><br>    <b><span style="color:navy">var </span><i><span style="color:#660E7A">controller </span></i></b>= <i>$</i>(<b><span style="color:green">'</span><span style="color:navy">html head meta</span><span style="color:green">[name="controller"]' </span></b>).<span style="color:#7A7A43">attr</span>(<b><span style="color:green">'content'</span></b>);<br>    <b><span style="color:#660E7A">console</span></b>.<b><span style="color:#660E7A">log</span></b>( <b><i><span style="color:#660E7A">controller </span></i></b>+ <b><span style="color:green">" Controller"</span></b>);<br><span style="background:#EFEFEF"></<b><span style="color:navy">script</span></b>></span><br><b><span style="color:blue;background:#F2E8E4"><% </span><span style="color:navy;background:#F2E8E4">if </span><span style="background:#F2E8E4">controller<span style="color:blue">.</span>controller_name <span style="color:blue">== </span><span style="color:green">'resources' </span><span style="color:blue">%></span></span><span style="color:blue"><br></span></b><span style="background:#EFEFEF"><<b><span style="color:navy">script </span><span style="color:blue">type=</span><span style="color:green">"text/javascript" </span></b>></span><br>    <i>$</i>( <b><span style="color:navy">function</span></b>() {<br>        <b><span style="color:navy">if </span></b>(typeof(<i>ResourceRenderer</i>) != <b><span style="color:green">'undefined'</span></b>) {<br>            <b><span style="color:navy">var </span></b><span style="color:#458383">_build_container_summary </span>= <i>ResourceRenderer</i>.<b><span style="color:#660E7A">prototype</span></b>.<span style="color:#7A7A43">build_container_summary</span>; <i><span style="color:gray">// stash old method<br>            </span>ResourceRenderer</i>.<b><span style="color:#660E7A">prototype</span></b>.<span style="color:#7A7A43">build_container_summary </span>= <b><span style="color:navy">function </span></b>(node) {<br>                <b><span style="color:navy">var </span></b><span style="color:#458383">summary </span>= <span style="color:#458383">_build_container_summary</span>.<span style="color:#7A7A43">apply</span>(<b><span style="color:navy">this</span></b>, [node]);  <i><span style="color:gray">// call old method<br>                </span></i><b><span style="color:#660E7A">console</span></b>.<b><span style="color:#660E7A">log</span></b>(node);<br>                <b><span style="color:#660E7A">console</span></b>.<b><span style="color:#660E7A">log</span></b>(<span style="color:#458383">summary</span>);<br>                <b><span style="color:navy">return </span><span style="color:green">`[ </span></b>${summary}<b><span style="color:green"> ]`</span></b>;<br>            };<br>        }<br>    });<br><span style="background:#EFEFEF"></<b><span style="color:navy">script</span></b>></span><br><b><span style="color:blue;background:#F2E8E4"><% </span><span style="color:navy;background:#F2E8E4">end </span><span style="color:blue;background:#F2E8E4">%></span></b><o:p></o:p></span></pre>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<div>
<p class="MsoNormal">( Strip out all of the console.log debugging after you get it to do what you want. ) <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">In a different use case, for adding IIIF image viewers for digital objects, what I want to modify is not available until the digital object file versions accordion is expanded, so I had to bind the bootstrap event to the body and delegate
 the event to the accordion element: <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt">$('body').on( 'show.bs.collapse', '#digital_object_file_versions__accordion', 'data',  function ($x) {...} );</span><o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">— Steve M. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On Apr 20, 2017, at 10:50 AM, Kevin Clair <<a href="mailto:Kevin.Clair@du.edu">Kevin.Clair@du.edu</a>> wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">Hello,</span><span style="font-family:Calibri"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"> </span><span style="font-family:Calibri"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">I’m wondering if anyone on the list has managed to write a plugin to override Javascript functions in the ArchivesSpace frontend. Here at Denver our preference is to display component IDs
 in the resource tree view instead of Top Container information (see attached screenshot). Currently we do this through our local plugins [1], but since it looks like v2.0.0 moves all of that functionality into the script at<span class="apple-converted-space"> </span><a href="https://github.com/archivesspace/archivesspace/blob/master/frontend/app/assets/javascripts/tree_renderers.js.erb"><span style="color:purple">https://github.com/archivesspace/archivesspace/blob/master/frontend/app/assets/javascripts/tree_renderers.js.erb</span></a>,
 I can’t figure out a way to customize the tree rendering to override the default behavior.</span><span style="font-family:Calibri"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"> </span><span style="font-family:Calibri"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">There will likely be local resistance to upgrading if we lose this display customization, so any help with this would be appreciated. thanks!  -k</span><span style="font-family:Calibri"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"> </span><span style="font-family:Calibri"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:Calibri">[1]<span class="apple-converted-space"> </span><a href="https://github.com/duspeccoll/plugins_local/blob/master/frontend/views/shared/_tree.html.erb"><span style="color:purple">https://github.com/duspeccoll/plugins_local/blob/master/frontend/views/shared/_tree.html.erb</span></a></span><span style="font-family:Calibri"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"> </span><span style="font-family:Calibri"><o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Menlo-Regular">_______________________________________________<br>
Archivesspace_Users_Group mailing list<br>
</span><a href="mailto:Archivesspace_Users_Group@lyralists.lyrasis.org"><span style="font-size:10.5pt;font-family:Menlo-Regular;color:purple">Archivesspace_Users_Group@lyralists.lyrasis.org</span></a><span style="font-size:10.5pt;font-family:Menlo-Regular"><br>
</span><a href="http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group"><span style="font-size:10.5pt;font-family:Menlo-Regular;color:purple">http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group</span></a><o:p></o:p></p>
</div>
</blockquote>
</div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
</div>
</body>
</html>