# HG changeset patch # User luisf # Date 1306945672 -3600 # Node ID 9cfd7a1d848ea485a3b7c736625952e0978344d3 # Parent de7c31d4cf9a226fb4e7b1fddfc7a0373b298169 Created the Edit View (still not changing the DB) Small changes to Publications model. diff -r de7c31d4cf9a -r 9cfd7a1d848e vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb --- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Wed Jun 01 17:25:50 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Wed Jun 01 17:27:52 2011 +0100 @@ -53,7 +53,8 @@ end def edit - logger.error "AAAA edit" + @publication = Publication.find(params[:id]) + end @@ -64,7 +65,7 @@ end def show - @publication = Publication.find_by_id(params[:id]) + @publication = Publication.find(params[:id]) if @publication.nil? @publications = Publication.all diff -r de7c31d4cf9a -r 9cfd7a1d848e vendor/plugins/redmine_bibliography/app/models/publication.rb --- a/vendor/plugins/redmine_bibliography/app/models/publication.rb Wed Jun 01 17:25:50 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/models/publication.rb Wed Jun 01 17:27:52 2011 +0100 @@ -1,12 +1,17 @@ # vendor/plugins/redmine_bibliography/app/models/publication.rb class Publication < ActiveRecord::Base + unloadable + + has_many :authorships has_many :authors, :through => :authorships has_one :bibtex_entry validates_presence_of :title + accepts_nested_attributes_for :authors, :bibtex_entry + attr_writer :current_step def current_step diff -r de7c31d4cf9a -r 9cfd7a1d848e vendor/plugins/redmine_bibliography/app/views/publications/edit.html.erb --- a/vendor/plugins/redmine_bibliography/app/views/publications/edit.html.erb Wed Jun 01 17:25:50 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/edit.html.erb Wed Jun 01 17:27:52 2011 +0100 @@ -1,1 +1,49 @@

Publications#edit

+ +<% form_for @publication, :url => {:action => :edit} do |f| -%> + <%= f.error_messages %> +

+ <%= f.label :title, l(:title) %> <%= f.text_field :title %> +

+ + +

<%= l(:authors) -%>

+ + <% f.fields_for :authors do |author| %> +

+ <%= author.label :name, l("name") %> <%= author.text_field :name %> +

+ + <% end %> + + + <% f.fields_for @publication.bibtex_entry do |b| -%> +

+ <%= b.label :year, l(:year) %> <%= b.text_field :year %> +

+

+ <%= b.label :chapter, l(:chapter) %> <%= b.text_field :chapter %> +

+

+ <%= b.label :editor, l(:editor) %> <%= b.text_field :editor %> +

+

+ <%= b.label :booktitle, l(:booktitle) %> <%= b.text_field :booktitle %> +

+

+ <%= b.label :publisher, l(:publisher) %> <%= b.text_field :publisher %> +

+

+ <%= b.label :pages, l(:pages) %> <%= b.text_field :pages %> +

+ <% end -%> + + + + <%= f.submit "Submit" %> + + + + + +<% end -%> \ No newline at end of file