Revision 1364:4d5d25039a5f plugins

View differences:

plugins/redmine_bibliography/app/controllers/authorships_controller.rb
1 1
class AuthorshipsController < ApplicationController
2
  
3
  def index
4
    
5
  end
6
  
7 2

  
8
  def update
9
  end
3
    def sort
4
        @authorships = Authorship.find(params['authorship'])
5

  
6
        @authorships.each do |authorship|
7

  
8
            # note: auth_order is usually called position (default column name in the acts_as_list plugin )
9
            authorship.auth_order = params['authorship'].index(authorship.id.to_s) + 1
10
            authorship.save
11
        end
12

  
13
        render :nothing => true, :status => 200
14
    end
10 15
end
plugins/redmine_bibliography/app/models/authorship.rb
10 10
  validates_presence_of :name_on_paper
11 11

  
12 12
  attr_accessor :search_author_class, :search_author_id, :search_name, :search_results, :identify_author
13
  before_save :associate_author_user
13

  
14
  before_create :associate_author_user
14 15

  
15 16
  # tod: review scope of ordering
16 17
  acts_as_list :column => 'auth_order'
plugins/redmine_bibliography/app/views/publications/show.html.erb
1
<%= javascript_include_tag 'order_authorships', :plugin => 'redmine_bibliography' %>
2

  
1 3
<h2><%=l(:label_publication_show)%></h2>
2 4

  
3 5
<div class="box">
plugins/redmine_bibliography/config/routes.rb
9 9

  
10 10
    match "publications/autocomplete_for_project", :to => 'publications#autocomplete_for_project'
11 11

  
12
    resources :authorships do
13
        collection do
14
            post 'sort', :action => 'sort'
15
        end
16
    end
12 17

  
13 18
    resources :publications
14 19
end

Also available in: Unified diff