Generate links for the record search

With this commit I have duplicated the functionality for generating
document links. I had already implemented this functionality in Rails.
The documents for the metadata record selection via dropdown menu can
served directly. For the record search it is a whole other matter.

Therefore I duplicated the functionality in JavaScript. I had to perform
some changes, especially assigning indices to HTML elements which had
the same ID before. The had the same ID due to the loop construction of
the view. This commit also closes #37.

Signed-off-by: Konrad Reiche <konrad.reiche@gmail.com>