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 @ 454:2f1a308c4c11

History | View | Annotate | Download (872 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 445:77f88379115a luis
6 328:aed18b463206 luis
  has_many :authorships
7 447:565f82b8ff9c luis
  has_many :authors, :through => :authorships, :uniq => true
8 446:995d4c99843d luis
9 445:77f88379115a luis
  has_one :bibtex_entry, :dependent => :destroy
10 376:ad71d0604ac2 luis
11
  validates_presence_of :title
12 445:77f88379115a luis
13
  accepts_nested_attributes_for :authorships
14 446:995d4c99843d luis
  accepts_nested_attributes_for :authors, :allow_destroy => true
15 454:2f1a308c4c11 luis
  accepts_nested_attributes_for :bibtex_entry, :allow_destroy => true
16
17
  has_and_belongs_to_many :projects
18 428:9cfd7a1d848e luis
19 385:a6f8c0584a92 luis
  attr_writer :current_step
20
21
  def current_step
22
    @current_step || steps.first
23
  end
24
25
  def steps
26
    %w[new review]
27
  end
28 390:5562a95edbf7 luis
29
  def next_step
30 391:fecd4b2f4b77 luis
    self.current_step = steps[steps.index(current_step)+1]
31 390:5562a95edbf7 luis
  end
32 385:a6f8c0584a92 luis
33 390:5562a95edbf7 luis
  def previous_step
34 391:fecd4b2f4b77 luis
    self.current_step = steps[steps.index(current_step)-1]
35 390:5562a95edbf7 luis
  end
36
37
  def first_step?
38
    current_step == steps.first
39
  end
40 376:ad71d0604ac2 luis
41 328:aed18b463206 luis
end