changeset 1320:75f258d6f747 redmine-2.2-integration

Merge
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Wed, 19 Jun 2013 14:44:26 +0100
parents 5490d6392ee3 (current diff) 9c2a5a4514a8 (diff)
children a7dcfc46fbe2
files
diffstat 8 files changed, 38 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Wed Jun 19 14:44:02 2013 +0100
+++ b/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Wed Jun 19 14:44:26 2013 +0100
@@ -5,8 +5,7 @@
   unloadable
 
   model_object Publication
-  # before_filter :find_model_object, :except => [:new, :create, :index, :show_bibtex_fields, :autocomplete_for_project, :add_author, :sort_author_order, :autocomplete_for_author, :get_user_info ]
-
+  before_filter :find_model_object, :only => [ :show, :add_project ]
   before_filter :find_project_by_project_id, :authorize, :only => [ :edit, :new, :update, :create ]
 
   def new
--- a/plugins/redmine_bibliography/app/helpers/authorships_helper.rb	Wed Jun 19 14:44:02 2013 +0100
+++ b/plugins/redmine_bibliography/app/helpers/authorships_helper.rb	Wed Jun 19 14:44:26 2013 +0100
@@ -19,3 +19,5 @@
   end
 
 end
+
+
--- a/plugins/redmine_bibliography/app/helpers/publications_helper.rb	Wed Jun 19 14:44:02 2013 +0100
+++ b/plugins/redmine_bibliography/app/helpers/publications_helper.rb	Wed Jun 19 14:44:26 2013 +0100
@@ -111,7 +111,7 @@
             confirm_msg = false
           end
 
-          s << link_to_remote(l(:button_delete), { :url => { :controller => 'publications', :action => 'remove_project', :id => publication, :remove_project_id => proj,  :project_id => @project }, :method => :post, :confirm => confirm_msg }, :class => 'icon icon-del')
+          s << link_to(l(:button_delete), { :url => { :controller => 'publications', :action => 'remove_project', :id => publication, :remove_project_id => proj,  :project_id => @project }, :method => :post, :confirm => confirm_msg }, :class => 'icon icon-del', :remote => :true)
         end
       end
 
--- a/plugins/redmine_bibliography/app/models/authorship.rb	Wed Jun 19 14:44:02 2013 +0100
+++ b/plugins/redmine_bibliography/app/models/authorship.rb	Wed Jun 19 14:44:26 2013 +0100
@@ -12,6 +12,8 @@
   attr_accessor :search_author_class, :search_author_id, :search_name, :search_results, :identify_author
   before_save :associate_author_user
 
+  acts_as_list
+
   # todo: review usage of scope --lf.20130108
   scope :like_unique, lambda {|q|
     s = "%#{q.to_s.strip.downcase}%"
--- a/plugins/redmine_bibliography/app/views/projects/_bibliography_box.html.erb	Wed Jun 19 14:44:02 2013 +0100
+++ b/plugins/redmine_bibliography/app/views/projects/_bibliography_box.html.erb	Wed Jun 19 14:44:26 2013 +0100
@@ -20,7 +20,7 @@
          <%= link_to l(:bibtex_link).html_safe, "javascript:void(0)", :class => "bibtex-link"-%>
        </dd>
        <dd class="bibtex-textarea collapsed" style="display: none;">
-         <textarea readonly> <%= print_bibtex_format(publication) %> </textarea>
+         <textarea readonly> <%= print_bibtex_format(publication) -%> </textarea>
        </dd>
    <% end -%>
      </dl>
--- a/plugins/redmine_bibliography/app/views/publications/_add_project_form.html.erb	Wed Jun 19 14:44:02 2013 +0100
+++ b/plugins/redmine_bibliography/app/views/publications/_add_project_form.html.erb	Wed Jun 19 14:44:26 2013 +0100
@@ -1,29 +1,29 @@
-<% form_remote_for(:publication, 
-                     :url => {:controller => 'publications', :action => 'add_project', :id => @publication, :project_id => @project}, 
-                     :method => :post,
-                     :html => { :id => 'add_project_form' }, 
-									   :loading => "$('project-add-submit').disable()",
-									   :complete => "$('project-add-submit').enable()") do |f| %>
-								<fieldset><legend><%=l(:label_add_project_to_publication)%></legend>
-	      <p>
-	        <%= label_tag "project_search", l(:label_project_search) %><%= text_field_tag 'project_search', nil %>
-	      </p>
+<%= form_for(:publication, 
+            :remote => true, 
+            :url => {:controller => 'publications', :action => 'add_project', :id => @publication, :project_id => @project}, 
+            :method => :post,
+            :html => { :id => 'add_project_form' }, 
+            :loading => "$('project-add-submit').disable()",
+            :complete => "$('project-add-submit').enable()") do |f| %>
+						
+              <fieldset><legend><%=l(:label_add_project_to_publication)%></legend>
+                <p>
+                  <%= label_tag "project_search", l(:label_project_search) %><%= text_field_tag 'project_search', nil %>
+	              </p>
 	     
-	      <%= observe_field(:project_search,
-               :frequency => 0.5,
-               :update => :projects,
-               :url => { :controller => 'publications', :action => 'autocomplete_for_project', :id => @publication },
-               :with => 'q')
-                %>
+                 observe_field(:project_search,
+                 :frequency => 0.5,
+                 :update => :projects,
+                 :url => { :controller => 'publications', :action => 'autocomplete_for_project', :id => @publication },
+                 :with => 'q')
+                
 
-					<div id="projects">
-					<% if params[:q] && params[:q].length > 1 %>
-			  		  <%= projects_check_box_tags 'project[project_ids][]', @projects %>
-					<% end %>
-					</div>
+                <div id="projects">                  
+                  <% if params[:q] && params[:q].length > 1 %>
+                    <%= projects_check_box_tags 'project[project_ids][]', @projects %>
+                  <% end %>
+                </div>
 
-        <p><%= submit_tag l(:button_add), :id => 'project-add-submit' %></p>
-    
-    
-      </fieldset>
+                <p><%= submit_tag l(:button_add), :id => 'project-add-submit' %></p>    
+              </fieldset>
   <% end %>
--- a/plugins/redmine_bibliography/app/views/publications/show.html.erb	Wed Jun 19 14:44:02 2013 +0100
+++ b/plugins/redmine_bibliography/app/views/publications/show.html.erb	Wed Jun 19 14:44:26 2013 +0100
@@ -11,21 +11,21 @@
 <div class="box">
 
 <h4><%= l(:authors) %></h4>
+
 <ul id="authorships">
   <% for authorship in @publication.authorships.find(:all, :order => :auth_order) %>
     <% content_tag_for :li, authorship do %>
       <%- if User.current.allowed_to?(:edit_publication, @project) && @publication.authorships.length > 1 -%>
         <span class="handle">[drag to reorder]</span>
       <%- end -%>
-      <%= link_to_authorship authorship %> <em><%= h authorship.institution %></em> <br />
+      
+      <%= link_to_authorship authorship %> <em><%= h(authorship.institution) %></em>
+      
+      <br />
     <%- end -%>
   <%- end -%>
 </ul>
 
-<%- if User.current.allowed_to?(:edit_publication, @project) && @publication.authorships.length > 1 -%>
-  <%= sortable_element("authorships", :url => { :controller => :publications, :action => :sort_author_order }, :handle => "handle") %>
-<%- end -%>
-
 <%- if @publication.bibtex_entry != nil -%>
   <%= show_bibtex_fields(@publication.bibtex_entry) %>
 <%- end -%>
@@ -36,7 +36,6 @@
   </p>
 <%- end -%>
 
-
 <% unless @publication.doi.blank? %>
   <p>
     <b><%= l(:field_doi)-%>:</b> <%= link_to h(@publication.doi), "http://dx.doi.org/#{@publication.doi}", {:target => "_blank"} -%>
--- a/plugins/redmine_bibliography/config/routes.rb	Wed Jun 19 14:44:02 2013 +0100
+++ b/plugins/redmine_bibliography/config/routes.rb	Wed Jun 19 14:44:26 2013 +0100
@@ -5,6 +5,7 @@
 
     match "authors/show/:id", :to => 'authors#show'
 
+    match "publications/add_project/:id", :to => 'publications#add_project'
 
 
     resources :publications