# HG changeset patch # User Chris Cannam # Date 1371649466 -3600 # Node ID 75f258d6f7475c2a584f8fbb832f49c22ede1468 # Parent 5490d6392ee32e6401160b87d34d25cedd572d15# Parent 9c2a5a4514a87d605050f67dbfe3ad95c5770f26 Merge diff -r 5490d6392ee3 -r 75f258d6f747 plugins/redmine_bibliography/app/controllers/publications_controller.rb --- 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 diff -r 5490d6392ee3 -r 75f258d6f747 plugins/redmine_bibliography/app/helpers/authorships_helper.rb --- 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 + + diff -r 5490d6392ee3 -r 75f258d6f747 plugins/redmine_bibliography/app/helpers/publications_helper.rb --- 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 diff -r 5490d6392ee3 -r 75f258d6f747 plugins/redmine_bibliography/app/models/authorship.rb --- 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}%" diff -r 5490d6392ee3 -r 75f258d6f747 plugins/redmine_bibliography/app/views/projects/_bibliography_box.html.erb --- 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"-%> <% end -%> diff -r 5490d6392ee3 -r 75f258d6f747 plugins/redmine_bibliography/app/views/publications/_add_project_form.html.erb --- 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| %> -
<%=l(:label_add_project_to_publication)%> -

- <%= label_tag "project_search", l(:label_project_search) %><%= text_field_tag 'project_search', nil %> -

+<%= 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| %> + +
<%=l(:label_add_project_to_publication)%> +

+ <%= label_tag "project_search", l(:label_project_search) %><%= text_field_tag 'project_search', nil %> +

- <%= 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') + -
- <% if params[:q] && params[:q].length > 1 %> - <%= projects_check_box_tags 'project[project_ids][]', @projects %> - <% end %> -
+
+ <% if params[:q] && params[:q].length > 1 %> + <%= projects_check_box_tags 'project[project_ids][]', @projects %> + <% end %> +
-

<%= submit_tag l(:button_add), :id => 'project-add-submit' %>

- - -
+

<%= submit_tag l(:button_add), :id => 'project-add-submit' %>

+
<% end %> diff -r 5490d6392ee3 -r 75f258d6f747 plugins/redmine_bibliography/app/views/publications/show.html.erb --- 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 @@

<%= l(:authors) %>

+ -<%- 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 @@

<%- end -%> - <% unless @publication.doi.blank? %>

<%= l(:field_doi)-%>: <%= link_to h(@publication.doi), "http://dx.doi.org/#{@publication.doi}", {:target => "_blank"} -%> diff -r 5490d6392ee3 -r 75f258d6f747 plugins/redmine_bibliography/config/routes.rb --- 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