To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / vendor / plugins / redmine_bibliography / app / models / publication.rb @ 428:9cfd7a1d848e

History | View | Annotate | Download (668 Bytes)

1 385:a6f8c0584a92 luis
# vendor/plugins/redmine_bibliography/app/models/publication.rb
2
3 328:aed18b463206 luis
class Publication < ActiveRecord::Base
4 428:9cfd7a1d848e luis
  unloadable
5
6
7 328:aed18b463206 luis
  has_many :authorships
8
  has_many :authors, :through => :authorships
9 393:9595ab4cac6b luis
  has_one :bibtex_entry
10 376:ad71d0604ac2 luis
11
  validates_presence_of :title
12 385:a6f8c0584a92 luis
13 428:9cfd7a1d848e luis
  accepts_nested_attributes_for :authors, :bibtex_entry
14
15 385:a6f8c0584a92 luis
  attr_writer :current_step
16
17
  def current_step
18
    @current_step || steps.first
19
  end
20
21
  def steps
22
    %w[new review]
23
  end
24 390:5562a95edbf7 luis
25
  def next_step
26 391:fecd4b2f4b77 luis
    self.current_step = steps[steps.index(current_step)+1]
27 390:5562a95edbf7 luis
  end
28 385:a6f8c0584a92 luis
29 390:5562a95edbf7 luis
  def previous_step
30 391:fecd4b2f4b77 luis
    self.current_step = steps[steps.index(current_step)-1]
31 390:5562a95edbf7 luis
  end
32
33
  def first_step?
34
    current_step == steps.first
35
  end
36 376:ad71d0604ac2 luis
37 328:aed18b463206 luis
end