To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / vendor / plugins / redmine_bibliography / app / models / publication.rb @ 446:995d4c99843d
History | View | Annotate | Download (819 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 | 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 | accepts_nested_attributes_for :bibtex_entry, :allow_destroy => true |
||
| 16 | 428:9cfd7a1d848e | luis | |
| 17 | 385:a6f8c0584a92 | luis | attr_writer :current_step
|
| 18 | |||
| 19 | def current_step |
||
| 20 | @current_step || steps.first
|
||
| 21 | end
|
||
| 22 | |||
| 23 | def steps |
||
| 24 | %w[new review]
|
||
| 25 | end
|
||
| 26 | 390:5562a95edbf7 | luis | |
| 27 | def next_step |
||
| 28 | 391:fecd4b2f4b77 | luis | self.current_step = steps[steps.index(current_step)+1] |
| 29 | 390:5562a95edbf7 | luis | end
|
| 30 | 385:a6f8c0584a92 | luis | |
| 31 | 390:5562a95edbf7 | luis | def previous_step |
| 32 | 391:fecd4b2f4b77 | luis | self.current_step = steps[steps.index(current_step)-1] |
| 33 | 390:5562a95edbf7 | luis | end
|
| 34 | |||
| 35 | def first_step? |
||
| 36 | current_step == steps.first |
||
| 37 | end
|
||
| 38 | 376:ad71d0604ac2 | luis | |
| 39 | 328:aed18b463206 | luis | end |