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 @ 445:77f88379115a

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