Revision 446:995d4c99843d

View differences:

vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb
10 10
    # we'll always want a new publication to have its bibtex entry
11 11
    @publication.build_bibtex_entry
12 12
    
13
    # and at least one author
14
    @publication.authors.build
15
    
13 16
    # the step we're at in the form
14 17
    @publication.current_step = session[:publication_step]
15 18

  
vendor/plugins/redmine_bibliography/app/models/publication.rb
5 5
  
6 6
  has_many :authorships
7 7
  has_many :authors, :through => :authorships
8
  
8 9
  has_one :bibtex_entry, :dependent => :destroy
9 10

  
10 11
  validates_presence_of :title
11 12

  
12 13
  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
  
16
  
14
  accepts_nested_attributes_for :authors, :allow_destroy => true
15
  accepts_nested_attributes_for :bibtex_entry, :allow_destroy => true 
17 16
  
18 17
  attr_writer :current_step
19 18

  
vendor/plugins/redmine_bibliography/app/views/publications/_edit.html.erb
12 12
    </p>
13 13
  <%- end -%>
14 14
  
15
  
16
  <h3>Other Details</h3>
17
  
15 18
  <% f.fields_for :bibtex_entry do |bib| -%>
16 19
    <p> 
17 20
      <%= bib.label :year, l(:year) %>  <%= bib.text_field :year %>  
vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb
3 3
<%= h @publication.title %>
4 4

  
5 5
<h4>Authors</h4>
6
<% @publication.authors.each do |author| %>
7
<%= h author.name  %> <br />
8
<% end %>
6
  <% for author in @publication.authors %>
7
      <%= h author.name  %> <br />
8
  <% end %>
9 9
<br />
10 10

  
11 11
<%- if @publication.bibtex_entry != nil -%>

Also available in: Unified diff