Fixed routing for #manage

- Moved javascript function to main.erb to prevent issue with handlebars