changeset 547:56ad0c490f5e feature_36

Closes Bug #217. The project_id parameter is now being sent in all links. This may generate some errors when outside a project, but I shall file new issues as I detect them.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Fri, 29 Jul 2011 19:15:26 +0100
parents 7c4b96efa402
children 3954b253cdb3 a1e091bee818 2df99e8d191e
files vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb vendor/plugins/redmine_bibliography/app/views/publications/_form.html.erb vendor/plugins/redmine_bibliography/app/views/publications/edit.html.erb vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb vendor/plugins/redmine_bibliography/config/locales/en.yml
diffstat 6 files changed, 15 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Fri Jul 29 18:14:28 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Fri Jul 29 19:15:26 2011 +0100
@@ -68,7 +68,9 @@
     end
   end
 
-  def edit    
+  def edit   
+    find_project_by_project_id unless params[:project_id].nil?
+     
     @publication = Publication.find(params[:id])
     @selected_bibtex_entry_type_id = @publication.bibtex_entry.entry_type  
   end
@@ -92,12 +94,10 @@
   end
 
   def show
-    logger.error { "PARAMS PROJECT_ID #{params[:project_id]} <---" }
-
     find_project_by_project_id unless params[:project_id].nil?
     
     @publication = Publication.find(params[:id])
-
+    
     if @publication.nil?
         @publications = Publication.all
         render "index", :alert => 'The publication was not found!'
--- a/vendor/plugins/redmine_bibliography/app/views/publications/_form.html.erb	Fri Jul 29 18:14:28 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/_form.html.erb	Fri Jul 29 19:15:26 2011 +0100
@@ -12,8 +12,6 @@
 
     <p><%= link_to_add_fields l(:label_add_another_author), f, :authorships %></p>
 
-    <%= f.submit %>
-
 </div>
 
 <div class="splitcontentright">      
--- a/vendor/plugins/redmine_bibliography/app/views/publications/edit.html.erb	Fri Jul 29 18:14:28 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/edit.html.erb	Fri Jul 29 19:15:26 2011 +0100
@@ -6,8 +6,10 @@
 
 <% form_for @publication, :url => { :project_id  => @project_id, :action => :update }, :builder => TabularFormBuilder do |f| -%>
   <%= render :partial => 'form', :locals => { :f => f }  %>
+  
+  <%= f.submit %>
 <% end %>
 <p>
-  <%= link_to "Show", @publication %> |
-  <%= link_to "View All", publications_path %>
+  <%= link_to l(:label_publication_show), { :controller => "publications", :action => "show", :id => @publication, :project_id => @project } %> |
+  <%= link_to l(:label_publication_index), { :controller => "publications", :action => "index", :project_id => @project } %>
 </p>
--- a/vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb	Fri Jul 29 18:14:28 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb	Fri Jul 29 19:15:26 2011 +0100
@@ -6,4 +6,5 @@
 
 <% form_for @publication, :url => { :project_id  => @project_id, :action => :create }, :builder => TabularFormBuilder do |f| -%>
   <%= render :partial => 'form', :locals => { :f => f }  %>
+  <%= f.submit %>
 <% end %>
\ No newline at end of file
--- a/vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb	Fri Jul 29 18:14:28 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb	Fri Jul 29 19:15:26 2011 +0100
@@ -22,7 +22,7 @@
 <%- end -%>
 
 <p>
-  <%= link_to "Edit", edit_publication_path(@publication) %> |
+  <%= link_to l(:label_publication_edit), { :controller => "publications", :action => "edit", :id => @publication, :project_id => @project } %> |
   <%= link_to "Destroy", @publication, :confirm => 'Are you sure?', :method => :delete %> |
   <%= link_to "View All", publications_path %>
 </p>
@@ -32,13 +32,10 @@
 <% projects = Project.active.find(:all, :limit => 100, :order => 'name ASC') - @publication.projects %>
 
 <div class="splitcontentright">
-
-
-  <h4>List of Projects</h4>
+  
+  <h4><%=l(:label_publication_project_index)%></h4>
   <p id="list_projects">
     <%= render :partial => 'list_projects' %>
   </p>
-
-  <%= render :partial => 'add_project_form' %>
-    
+    <%= render :partial => 'add_project_form' %>    
 </div>
\ No newline at end of file
--- a/vendor/plugins/redmine_bibliography/config/locales/en.yml	Fri Jul 29 18:14:28 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/config/locales/en.yml	Fri Jul 29 19:15:26 2011 +0100
@@ -29,6 +29,8 @@
   label_publication_show: "Publication Details"
   label_add_project_to_publication: "Add Project to Publication"
   label_project_search: "Search by name: "
+  label_publication_project_index: "Projects associated with this publication"
+  label_publication_index: "View all publications"
   
   text_author_email: "Author's email address as on the paper."
   text_author_institution: "Author's institution name as on paper."