Metadata Editor Updates

Fixed some editing issues casued by jQuery sorting.  Sorting was
causeing problems with copy/cut/pasting.

Seperated editing from sorting.

Made some changes to document jQuery code.  Moved some of the code from
JS to rails.

Signed-off-by: shanesuofi <shanes@vandals.uidaho.edu>