<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Maura,<div><br></div><div>Are you trying to add a controller to ArchivesSpace or are you trying to create a standalone web app? If the former, you should probably package it as a plugin. More info here:</div><div><br></div><div><a href="https://github.com/archivesspace/archivesspace/blob/master/plugins/PLUGINS_README.md">https://github.com/archivesspace/archivesspace/blob/master/plugins/PLUGINS_README.md</a></div><div><br></div><div>Either way, it would be easier to diagnose your issue if you put an actual repository on Github.</div><div><br></div><div>Also, although this doesn’t look right</div><div><br>def index</div><div><br>def pickImage(directory)<br>  dirSize=directory.length<br>  ranNum=0+rand(dirSize)<br>  fileName=directory[ranNum]<br>  return fileName<br>end<br>end<br><br></div><div><br></div><div>Instead:</div><div><br></div><div>def index</div><div><br></div><div> @filename = pickImage<br><br>end<br><br></div><div>def pickImage(directory)<br>  dirSize=directory.length<br>  ranNum=0+rand(dirSize)<br>  directory[ranNum]<br>end</div><div><br></div><div>Then in a typical RoR system @filename will be available to views/index.html.erb</div><div><br></div><div><br></div><div>Brian</div><div><br></div><div><br></div><div><br></div><div><br><div><div>On Jul 22, 2015, at 9:42 AM, Maura Carbone <<a href="mailto:mauraa@brandeis.edu">mauraa@brandeis.edu</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">I can! I just included it in the body of the e-mail because that way people didn't have to go to external links, but here it is on gist:<div><br></div><div><a href="https://gist.github.com/librarymaura/7a3a303e5c579aaed917">https://gist.github.com/librarymaura/7a3a303e5c579aaed917</a><br></div><div><br></div><div>Thanks,</div><div>Maura</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 22, 2015 at 9:20 AM, Chris Fitzpatrick <span dir="ltr"><<a href="mailto:Chris.Fitzpatrick@lyrasis.org" target="_blank">Chris.Fitzpatrick@lyrasis.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">
<div style="font-size: 12pt; background-color: rgb(255, 255, 255); font-family: Calibri, Arial, Helvetica, sans-serif;"><p>Hi Maura,</p><p><br>
</p><p>Can't you put your code up on <a title="Cmd+Click or tap to follow the link" href="http://gist.github.com/" target="_blank">
http://gist.github.com/ </a> <br>
</p><p>and send a link to it? What you're doing sounds about right, but it'll be easier for me to see what's up if I can look at the code...</p><p>b,chris. <br>
</p><p><br>
</p>
<div>
<div name="divtagdefaultwrapper">
<div><font size="2">
<div>Chris Fitzpatrick | <font size="2">Developer, ArchivesSpace</font><br>
Skype: chrisfitzpat  | Phone: <a href="tel:918.236.6048" value="+19182366048" target="_blank">918.236.6048</a><br>
<a href="http://archivesspace.org/" target="_blank">http://archivesspace.org/</a><br>
</div>
</font></div>
</div>
</div>
<br>
<br>
<div style="">
<hr style="display:inline-block;width:98%">
<div dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif"><b>From:</b> <a href="mailto:archivesspace_users_group-bounces@lyralists.lyrasis.org" target="_blank">archivesspace_users_group-bounces@lyralists.lyrasis.org</a> <<a href="mailto:archivesspace_users_group-bounces@lyralists.lyrasis.org" target="_blank">archivesspace_users_group-bounces@lyralists.lyrasis.org</a>> on behalf of Maura Carbone
 <<a href="mailto:mauraa@brandeis.edu" target="_blank">mauraa@brandeis.edu</a>><br>
<b>Sent:</b> Tuesday, July 21, 2015 10:02 PM<br>
<b>To:</b> Archivesspace Users Group<br>
<b>Subject:</b> [Archivesspace_Users_Group] RoR Guidance/Help with Index Page</font>
<div> </div>
</div><div><div class="h5">
<div>
<div dir="ltr">
<div style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px">Hi all,</span><br>
</div>
<div style="font-size:12.8000001907349px">I've been playing with RoR and html.erb and have a question on how to implement something I've written. Hoping someone with more experience may be able to offer a little guidance as the stuff I've read hasn't been super
 helpful (in part because I'm already working with pre-built stuff rather than starting entirely from scratch).</div>
<div style="font-size:12.8000001907349px"><br>
</div>
<div style="font-size:12.8000001907349px">Right now this is our index.html.erb page:</div>
<div style="font-size:12.8000001907349px"><br>
</div>
<div style="font-size:12.8000001907349px"><a href="http://findingaids.brandeis.edu/" target="_blank">http://findingaids.brandeis.edu/</a></div>
<div style="font-size:12.8000001907349px"><br>
</div>
<div style="font-size:12.8000001907349px">I wrote some ruby code that would allow the images to be randomized, and tested said ruby code in irb (so I know I get correctly returned values):</div>
<div style="font-size:12.8000001907349px"><br>
</div>
<div style="font-size:12.8000001907349px">
<div>x=Dir["../assets/images/aspace_home/col-1/*.jpg"]</div>
<div>y=Dir["../assets/images/aspace_home/col-2/*.jpg"]</div>
<div>z=Dir["../assets/images/aspace_home/col-3/*.jpg"]</div>
<div><br>
</div>
<div>
<div>def pickImage(directory)</div>
<div>   dirSize=directory.length</div>
<div>   ranNum=0+rand(dirSize)</div>
<div>   fileName=directory[ranNum]</div>
<div>   return fileName</div>
<div>end</div>
</div>
<div><br>
</div>
<div>
<div>@img1=pickImage(x)</div>
<div>@img2=pickImage(y)</div>
<div>@img3=pickImage(z)</div>
</div>
<div><br>
</div>
<div>However, I'm not entirely sure how to implement this in RoR/my html.erb file. I found the index controller (I believe), the site_controller.rb and put the code inside (and outside on a few tries) the def index end block, and then added an <img src="<%=
 @img1 %>" /> to my index.html.erb file but no variable is found (the page display but its like the img tag is empty).</div>
<div><br>
</div>
<div>I also tried something like <% image_tag , '"' + pickImage(Dir["../assets/images/aspace_home/col-1/*.jpg"]) + '"', :alt => "Finding Aids Display Image" %> which just broke the page.</div>
<div><br>
</div>
<div>Any guidance on how this works/if I'm even doing this right? I haven't found anything in archivesspace.out that indicates if what I'm doing is even being rendered; is there another log somewhere I can check?</div>
</div>
<div><br>
</div>
-- <br>
<div>
<div dir="ltr">Maura Carbone
<div>Digital Initiatives Librarian<br>
Brandeis University<br>
Library and Technology Services<br>
<a href="tel:%28781%29%20736-4659" value="+17817364659" target="_blank">(781) 736-4659</a><br>
415 South Street, (MS 017/P.O. Box 549110)<br>
Waltham, MA 02454-9110<br>
email: <a href="mailto:mauraa@brandeis.edu" target="_blank">mauraa@brandeis.edu</a><br>
</div>
</div>
</div>
</div>
</div>
</div></div></div>
</div>
</div>

<br>_______________________________________________<br>
Archivesspace_Users_Group mailing list<br>
<a href="mailto:Archivesspace_Users_Group@lyralists.lyrasis.org">Archivesspace_Users_Group@lyralists.lyrasis.org</a><br>
<a href="http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group" rel="noreferrer" target="_blank">http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Maura Carbone<div>Digital Initiatives Librarian<br>Brandeis University<br>Library and Technology Services<br>(781) 736-4659<br>415 South Street, (MS 017/P.O. Box 549110)<br>Waltham, MA 02454-9110<br>email: <a href="mailto:mauraa@brandeis.edu" target="_blank">mauraa@brandeis.edu</a><br></div></div></div>
</div>
_______________________________________________<br>Archivesspace_Users_Group mailing list<br><a href="mailto:Archivesspace_Users_Group@lyralists.lyrasis.org">Archivesspace_Users_Group@lyralists.lyrasis.org</a><br>http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group<br></blockquote></div><br></div></body></html>