Mercurial > hg > soundsoftware-site
annotate vendor/plugins/redmine_bibliography/app/models/publication.rb @ 468:0bb9c7baed07 feature_36
dynamically adding/removing users.
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Thu, 23 Jun 2011 18:52:30 +0100 |
parents | fbdfec975bfa |
children | 76d064830472 |
rev | line source |
---|---|
luis@385 | 1 # vendor/plugins/redmine_bibliography/app/models/publication.rb |
luis@385 | 2 |
luis@328 | 3 class Publication < ActiveRecord::Base |
luis@428 | 4 unloadable |
luis@445 | 5 |
luis@468 | 6 has_many :authorships, :dependent => :destroy |
luis@447 | 7 has_many :authors, :through => :authorships, :uniq => true |
luis@446 | 8 |
luis@445 | 9 has_one :bibtex_entry, :dependent => :destroy |
luis@376 | 10 |
luis@376 | 11 validates_presence_of :title |
luis@445 | 12 |
luis@445 | 13 accepts_nested_attributes_for :authorships |
luis@446 | 14 accepts_nested_attributes_for :authors, :allow_destroy => true |
luis@454 | 15 accepts_nested_attributes_for :bibtex_entry, :allow_destroy => true |
luis@454 | 16 |
luis@464 | 17 has_and_belongs_to_many :projects, :uniq => true |
luis@428 | 18 |
luis@385 | 19 attr_writer :current_step |
luis@385 | 20 |
luis@385 | 21 def current_step |
luis@385 | 22 @current_step || steps.first |
luis@385 | 23 end |
luis@385 | 24 |
luis@385 | 25 def steps |
luis@385 | 26 %w[new review] |
luis@385 | 27 end |
luis@390 | 28 |
luis@390 | 29 def next_step |
luis@391 | 30 self.current_step = steps[steps.index(current_step)+1] |
luis@390 | 31 end |
luis@385 | 32 |
luis@390 | 33 def previous_step |
luis@391 | 34 self.current_step = steps[steps.index(current_step)-1] |
luis@390 | 35 end |
luis@390 | 36 |
luis@390 | 37 def first_step? |
luis@390 | 38 current_step == steps.first |
luis@390 | 39 end |
luis@376 | 40 |
luis@328 | 41 end |