Revision 428:9cfd7a1d848e vendor/plugins/redmine_bibliography/app

View differences:

vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb
53 53
  end
54 54

  
55 55
  def edit
56
    logger.error "AAAA edit"
56
    @publication = Publication.find(params[:id])
57

  
57 58

  
58 59
  end
59 60

  
......
64 65
  end
65 66

  
66 67
  def show
67
    @publication = Publication.find_by_id(params[:id])
68
    @publication = Publication.find(params[:id])
68 69

  
69 70
    if @publication.nil?
70 71
        @publications = Publication.all
vendor/plugins/redmine_bibliography/app/models/publication.rb
1 1
# vendor/plugins/redmine_bibliography/app/models/publication.rb
2 2

  
3 3
class Publication < ActiveRecord::Base
4
  unloadable
5

  
6

  
4 7
  has_many :authorships
5 8
  has_many :authors, :through => :authorships
6 9
  has_one :bibtex_entry
7 10

  
8 11
  validates_presence_of :title
9 12
  
13
  accepts_nested_attributes_for :authors, :bibtex_entry
14
  
10 15
  attr_writer :current_step
11 16

  
12 17
  def current_step
vendor/plugins/redmine_bibliography/app/views/publications/edit.html.erb
1 1
<h2>Publications#edit</h2>
2

  
3
<% form_for @publication, :url => {:action => :edit} do |f| -%>
4
  <%= f.error_messages %>
5
  <p>
6
    <%= f.label :title, l(:title) %>  <%= f.text_field :title %>  
7
  </p>
8
  
9

  
10
  <h3><%= l(:authors) -%></h3>
11
  
12
  <% f.fields_for :authors do |author| %>
13
    <p>
14
      <%= author.label :name, l("name") %> <%= author.text_field :name %>            
15
    </p>
16
    
17
  <% end %>
18
  
19
  
20
  <% f.fields_for @publication.bibtex_entry do |b| -%>
21
    <p> 
22
      <%= b.label :year, l(:year) %>  <%= b.text_field :year %>  
23
    </p>
24
    <p> 
25
      <%= b.label :chapter, l(:chapter) %>  <%= b.text_field :chapter %>  
26
    </p>
27
    <p>  
28
      <%= b.label :editor, l(:editor) %>  <%= b.text_field :editor %>  
29
    </p>
30
    <p> 
31
      <%= b.label :booktitle, l(:booktitle) %>  <%= b.text_field :booktitle %>  
32
    </p>
33
    <p> 
34
      <%= b.label :publisher, l(:publisher) %>  <%= b.text_field :publisher %>  
35
    </p>
36
    <p> 
37
      <%= b.label :pages, l(:pages) %>  <%= b.text_field :pages %>  
38
    </p>
39
  <% end -%>
40

  
41

  
42

  
43
  <%= f.submit "Submit" %>
44

  
45

  
46

  
47

  
48

  
49
<% end -%>

Also available in: Unified diff