diff plugins/redmine_bibliography/app/controllers/authorships_controller.rb @ 1484:51364c0cd58f redmine-2.4-integration

Merge from live branch. Still need to merge manually in files overridden by plugins.
author Chris Cannam
date Wed, 15 Jan 2014 09:59:14 +0000
parents 4d5d25039a5f
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/redmine_bibliography/app/controllers/authorships_controller.rb	Wed Jan 15 09:59:14 2014 +0000
@@ -0,0 +1,15 @@
+class AuthorshipsController < ApplicationController
+
+    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