Mercurial > hg > soundsoftware-site
diff vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb @ 471:49fb7a9ef79c feature_36
Using Authorships instead of Authors in the new/show actions of the publication controller.
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Fri, 24 Jun 2011 15:11:30 +0100 |
parents | 0bb9c7baed07 |
children | 0ce4139187fa |
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Fri Jun 24 11:41:01 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Fri Jun 24 15:11:30 2011 +0100 @@ -3,7 +3,7 @@ class PublicationsController < ApplicationController unloadable - before_filter :find_project_by_project_id, :except => [:autocomplete_for_project, :add_author] + before_filter :find_project_by_project_id, :except => [:autocomplete_for_project, :add_author, :sort_authors] def new @@ -13,7 +13,7 @@ @publication.build_bibtex_entry # and at least one author - 3.times {@publication.authors.build} + @publication.authorships.build.build_author @project_id = params[:project_id] @current_user = User.current @@ -52,16 +52,6 @@ if bibtex_entry parse_bibtex_list bibtex_entry end - - # form's flow control - if params[:back_button] - @publication.previous_step - else - @publication.next_step - end - - session[:publication_step] = @publication.current_step - end def add_author @@ -186,7 +176,6 @@ end - def add_project @projects = Project.find(params[:publication][:project_ids]) @@ -209,6 +198,15 @@ logger.debug "Query for \"#{params[:q]}\" returned \"#{@projects.size}\" results" render :layout => false end + + + def sort_authors + params[:authors].each_with_index do |id, index| + Author.update_all(['order=?', index+1], ['id=?', id]) + end + render :nothing => true + end + private