Ris download

Added a button to Digital Case 2.0 objects which exports an RIS citation for that object.  Description of RIS spec can be found here: http://www.refman.com/support/risformat_intro.asp.

I created a model ris_creator.rb and put it in the app/models folder.  I believe that it has to be there as opposed to being somewhere in the lib folder because an instance of RISCreator is created by the catalog controller when the button on the page is pressed.

The button itself is created in absolute/app/views/curation_concern/base/_attributes.html.erb, in the bottom table row.  When the button is pressed, the method export_ris from the catalog controller is called, and it depends on the fact that the pid of the Digital Case object is passed along from the URL as params[:id].  The information about the digcase object in question is then pulled in using ActiveFedora::Base.find(params[:id]).  The importance of this is that I discovered that whole objects cannot be passed from the page to the controller- just symbols.

For the view to be able to call the method in the controller, the routes.rb page had to be edited.  I simply added one line to the bottom of the file.  The match method allowed there to be a route for both the GET and POST verbs, and then the first string specifies 'controller/method/:parameter'.  I learned that anything included on the end of that string with the colon prefix is included in the array params[].  The second part is 'controller#name that the view will use to signify a call to the desired method'  That name should not specify the parameters passed into the method, if any.

The spec file just creates a few generic test objects and checks line by line that the outputed ris is what is expected.

Any questions can be forwarded to jrf118@case.edu