changeset 1439:2b7911132501 live

Merge from cannam branch
author Chris Cannam
date Fri, 11 Oct 2013 09:33:58 +0100
parents 04cc33a44d4c (current diff) 96973aaacd75 (diff)
children 7465cceb8dfc e2485421fc14
files
diffstat 2 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Wed Oct 09 17:41:45 2013 +0100
+++ b/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Fri Oct 11 09:33:58 2013 +0100
@@ -82,10 +82,8 @@
   def edit
     find_project_by_project_id unless params[:project_id].nil?
 
-    @edit_view = true;
     @publication = Publication.find(params[:id])
     @selected_bibtex_entry_type_id = @publication.bibtex_entry.entry_type
-
     @bibtype_fields = BibtexEntryType.fields(@selected_bibtex_entry_type_id)
   end
 
@@ -202,10 +200,8 @@
     object_id = params[:object_id]
     @object_name = "publications[authorships_attributes][#{object_id}][search_results]"
 
-    # cc 20110909 -- revert to like instead of like_unique -- see #289
-    authorships_list = Authorship.like(params[:term]).group('author_id').find(:all, :limit => 100)
-
-    authors_list = authorships_list.collect do |x| x.author end
+    # todo: make sure query works with both pgres and mysql ~lf.20131010
+    authors_list = Author.joins(:authorships).where("LOWER(authorships.name_on_paper) LIKE LOWER(?)", "%#{params[:term]}%").uniq
 
     users_list = User.active.like(params[:term]).find(:all, :limit => 100)
 
--- a/plugins/redmine_bibliography/app/views/publications/_authorship_fields.html.erb	Wed Oct 09 17:41:45 2013 +0100
+++ b/plugins/redmine_bibliography/app/views/publications/_authorship_fields.html.erb	Fri Oct 11 09:33:58 2013 +0100
@@ -7,7 +7,11 @@
 
     <p class="author_associated search_author_tie">
       <%= f.check_box :search_author_tie, :label => '' -%>
-      <span>Not associated with any SoundSoftware site user.</span>
+      <% unless f.object.search_author_tie %>
+        <span>Not associated with any SoundSoftware site user.</span>
+      <% else %>
+        <span>Associated with <%= render_authorship_link(f.object.search_author_class, f.object.search_author_id) -%>.</span>
+      <% end %>
     </p>
 
     <%= f.hidden_field :search_author_class -%>