changeset 613:3b63cea01e7b feature_36

Fixes bug preventing Projects being associated with newly created publications.
author luisf
date Tue, 23 Aug 2011 14:49:27 +0100
parents 8fa35731c959
children 712324fee0c0
files vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb vendor/plugins/redmine_bibliography/app/views/publications/edit.html.erb vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb vendor/plugins/redmine_bibliography/config/locales/en.yml
diffstat 4 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Tue Aug 23 13:45:30 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Tue Aug 23 14:49:27 2011 +0100
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb
 
 class PublicationsController < ApplicationController
@@ -21,19 +22,18 @@
   end
 
   def create    
-    @project_id = params[:project_id]    
+    @project = Project.find(params[:project_id])
+
     @author_options = Authorship.like_unique(User.name).find(:all, :limit => 100)
         
     @publication = Publication.new(params[:publication])
-        
-    # @project = Project.find(params[:project_id])
     @publication.projects << @project unless @project.nil?
         
     if @publication.save 
       flash[:notice] = "Successfully created publication."
-      redirect_to :action => :show, :id => @publication, :project_id => @project_id
+      redirect_to :action => :show, :id => @publication, :project_id => @project
     else
-      render :action => 'new', :project_id => @project_id
+      render :action => 'new', :project_id => @project
     end
   end
 
--- a/vendor/plugins/redmine_bibliography/app/views/publications/edit.html.erb	Tue Aug 23 13:45:30 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/edit.html.erb	Tue Aug 23 14:49:27 2011 +0100
@@ -4,7 +4,7 @@
 
 <h2><%=l(:label_publication_show)%></h2>
 
-<% form_for @publication, :url => { :project_id  => @project_id, :action => :update }, :builder => TabularFormBuilder do |f| -%>
+<% form_for @publication, :url => { :project_id  => @project, :action => :update }, :builder => TabularFormBuilder do |f| -%>
   <%= render :partial => 'form', :locals => { :f => f }  %>
 
   <div style="clear:both"></div>
--- a/vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb	Tue Aug 23 13:45:30 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb	Tue Aug 23 14:49:27 2011 +0100
@@ -4,7 +4,7 @@
 
 <h2><%=l(:label_publication_new)%></h2>
 
-<% form_for @publication, :url => { :project_id  => @project_id, :action => :create }, :builder => TabularFormBuilder do |f| -%>
+<% form_for @publication, :url => { :project_id  => @project, :action => :create }, :builder => TabularFormBuilder do |f| -%>
   <%= render :partial => 'form', :locals => { :f => f }  %>
   <div style="clear:both"></div>
   <%= f.submit %>
--- a/vendor/plugins/redmine_bibliography/config/locales/en.yml	Tue Aug 23 13:45:30 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/config/locales/en.yml	Tue Aug 23 14:49:27 2011 +0100
@@ -11,7 +11,7 @@
   label_all_publications: All Publications
   label_all_publications_for_project: Publications associated with %{project}
   label_authors_show: "Authorships by this author"
-  label_authors_show: "List of authors"
+  label_authors_index: "List of authors"
   
   field_authorship_publication_title: "Publication Title"
   field_authorship_name: "Name"