Mercurial > hg > soundsoftware-site
diff plugins/redmine_bibliography/app/controllers/authorships_controller.rb @ 1364:4d5d25039a5f luisf
Fixes Bug #668 - reordering of authors in the publication's detail view is working again.
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Mon, 19 Aug 2013 15:47:51 +0100 |
parents | b4b72f1eb644 |
children |
line wrap: on
line diff
--- a/plugins/redmine_bibliography/app/controllers/authorships_controller.rb Mon Aug 19 13:40:58 2013 +0100 +++ b/plugins/redmine_bibliography/app/controllers/authorships_controller.rb Mon Aug 19 15:47:51 2013 +0100 @@ -1,10 +1,15 @@ class AuthorshipsController < ApplicationController - - def index - - end - - def update - end + def sort + @authorships = Authorship.find(params['authorship']) + + @authorships.each do |authorship| + + # note: auth_order is usually called position (default column name in the acts_as_list plugin ) + authorship.auth_order = params['authorship'].index(authorship.id.to_s) + 1 + authorship.save + end + + render :nothing => true, :status => 200 + end end