changeset 536:0058debf7871 cannam_integration

Merge from branch "feature_36"
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Tue, 26 Jul 2011 14:08:18 +0100
parents 7c7199e1f174 (current diff) 76d064830472 (diff)
children 168714032c7e
files
diffstat 6 files changed, 36 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Mon Jul 25 15:00:31 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Tue Jul 26 14:08:18 2011 +0100
@@ -21,14 +21,16 @@
 
   def create
     @publication = Publication.new(params[:publication])
+    
+    logger.error { "PUBLICATION CREATE ACTION" }
+    logger.error { params[:publication]  }
+    
+    
     @project = Project.find(params[:project_id])
 
     logger.error { "PARAMS publication" }
     logger.error { params[:publication] }
-
-    # array with the user ids
-    @users = []
-
+    
     @publication.projects << @project
     
     if @publication.save 
--- a/vendor/plugins/redmine_bibliography/app/models/authorship.rb	Mon Jul 25 15:00:31 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/models/authorship.rb	Tue Jul 26 14:08:18 2011 +0100
@@ -5,21 +5,23 @@
   accepts_nested_attributes_for :author
   accepts_nested_attributes_for :publication
   
- 
-  # setter and getter for virtual attribute :author search
-  def author_search
-  end 
   
-  def author_search=(string)
-  end
-
   # setter and getter for virtual attribute :user_id
   def user_id    
   end 
   
-  def user_id=(uid)
-    if User.find(uid).author.nil?      
-      User.find(uid).author = Author.new :name => User.find(uid).name
+  def user_id=(uid)  
+    unless uid.blank?
+      user = User.find(uid)                         
+      if user.author.nil?      
+        # TODO: should reflect the name_on_paper parameter
+        author = Author.new :name => user.name
+        author.save!
+        user.author = author
+        user.save!
+     end
+           
+    self.author_id = user.author.id
     end    
   end
 end
--- a/vendor/plugins/redmine_bibliography/app/models/publication.rb	Mon Jul 25 15:00:31 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/models/publication.rb	Tue Jul 26 14:08:18 2011 +0100
@@ -16,26 +16,4 @@
   
   has_and_belongs_to_many :projects, :uniq => true
   
-  attr_writer :current_step
-
-  def current_step
-    @current_step || steps.first
-  end
-  
-  def steps
-    %w[new review]
-  end
-  
-  def next_step
-    self.current_step = steps[steps.index(current_step)+1]
-  end
-
-  def previous_step
-    self.current_step = steps[steps.index(current_step)-1]
-  end
-  
-  def first_step?
-    current_step == steps.first
-  end
-
 end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/plugins/redmine_bibliography/app/views/my/blocks/_publications_box.html.erb	Tue Jul 26 14:08:18 2011 +0100
@@ -0,0 +1,14 @@
+<h3><%=l(:label_my_publications_box)%> <%= "(" + User.current.author.authorships.count.to_s + ")" unless User.current.author.nil? %></h3>
+
+<% Publication.find(:all).each do |pub|%>
+<div class="wiki">
+  <h3><%= link_to pub.title, pub %></h3> 
+  
+  <% pub.projects.each do |proj| %>
+    <%= link_to proj.name, proj %>
+  <% end %>
+  	
+</div>
+<% end %>
+
+
--- a/vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml	Mon Jul 25 15:00:31 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.rhtml	Tue Jul 26 14:08:18 2011 +0100
@@ -4,16 +4,9 @@
     <%= f.text_field :name_on_paper %><br />
     <em><%= h l("text_author_name_on_paper") %></em><br />
                                                 
-    <legend><%= "Identify Authors in the system…" %></legend>
-
     <%= link_to_function "Add Me as Author", "update_author_info(this," + User.current.get_author_info.to_json + ")", :class => 'icon icon-add', :id => "add_me_as_author" %>
 
-    <p>
-      <%= f.label :author_search, l(:label_project_search) %>
-      <%= f.text_field :author_search %>
-    </p>
-
-    <%= observe_field( form_tag_id(f.object_name, :author_search), :frequency => 0.5, :update => form_tag_id(f.object_name, :identify_author), :url => { :controller => 'publications', :action => 'autocomplete_for_author' }, :with => 'q')
+    <%= observe_field( form_tag_id(f.object_name, :name_on_paper), :frequency => 0.5, :update => form_tag_id(f.object_name, :identify_author), :url => { :controller => 'publications', :action => 'autocomplete_for_author' }, :with => 'q')
     %>
     
     <div id="<%= form_tag_id(f.object_name, :identify_author) %>">
--- a/vendor/plugins/redmine_bibliography/config/locales/en.yml	Mon Jul 25 15:00:31 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/config/locales/en.yml	Tue Jul 26 14:08:18 2011 +0100
@@ -4,6 +4,8 @@
   authors: "Authors"
   author: "Author"
   name: "Name"
+  publications_box: "My Publications"
+  label_my_publications_box: "My Publications"
   
   label_add_me_as_author: "Add me as an author"
   label_add_another_author: "Add another author"
@@ -17,7 +19,7 @@
   
   text_author_email: "Author's email address as on the paper."
   text_author_institution: "Author's institution name as on paper."
-  text_author_name_on_paper: "Name of the author as it appears on paper."
+  text_author_name_on_paper: "Name of the author as it appears on paper. (In case it applies, please use the autocomplete suggestions.)"
   
   # authorships model
   institution: "Institution"