Revision 1317:2805873c0147 plugins

View differences:

plugins/redmine_bibliography/app/controllers/publications_controller.rb
5 5
  unloadable
6 6

  
7 7
  model_object Publication
8
  # 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 ]
9

  
8
  before_filter :find_model_object, :only => [ :show, :add_project ]
10 9
  before_filter :find_project_by_project_id, :authorize, :only => [ :edit, :new, :update, :create ]
11 10

  
12 11
  def new
plugins/redmine_bibliography/app/helpers/authorships_helper.rb
19 19
  end
20 20

  
21 21
end
22

  
23

  
plugins/redmine_bibliography/app/helpers/publications_helper.rb
111 111
            confirm_msg = false
112 112
          end
113 113

  
114
          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')
114
          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)
115 115
        end
116 116
      end
117 117

  
plugins/redmine_bibliography/app/models/authorship.rb
12 12
  attr_accessor :search_author_class, :search_author_id, :search_name, :search_results, :identify_author
13 13
  before_save :associate_author_user
14 14

  
15
  acts_as_list
16

  
15 17
  # todo: review usage of scope --lf.20130108
16 18
  scope :like_unique, lambda {|q|
17 19
    s = "%#{q.to_s.strip.downcase}%"
plugins/redmine_bibliography/app/views/projects/_bibliography_box.html.erb
20 20
         <%= link_to l(:bibtex_link).html_safe, "javascript:void(0)", :class => "bibtex-link"-%>
21 21
       </dd>
22 22
       <dd class="bibtex-textarea collapsed" style="display: none;">
23
         <textarea readonly> <%= print_bibtex_format(publication) %> </textarea>
23
         <textarea readonly> <%= print_bibtex_format(publication) -%> </textarea>
24 24
       </dd>
25 25
   <% end -%>
26 26
     </dl>
plugins/redmine_bibliography/app/views/publications/_add_project_form.html.erb
1
<% form_remote_for(:publication, 
2
                     :url => {:controller => 'publications', :action => 'add_project', :id => @publication, :project_id => @project}, 
3
                     :method => :post,
4
                     :html => { :id => 'add_project_form' }, 
5
									   :loading => "$('project-add-submit').disable()",
6
									   :complete => "$('project-add-submit').enable()") do |f| %>
7
								<fieldset><legend><%=l(:label_add_project_to_publication)%></legend>
8
	      <p>
9
	        <%= label_tag "project_search", l(:label_project_search) %><%= text_field_tag 'project_search', nil %>
10
	      </p>
1
<%= form_for(:publication, 
2
            :remote => true, 
3
            :url => {:controller => 'publications', :action => 'add_project', :id => @publication, :project_id => @project}, 
4
            :method => :post,
5
            :html => { :id => 'add_project_form' }, 
6
            :loading => "$('project-add-submit').disable()",
7
            :complete => "$('project-add-submit').enable()") do |f| %>
8
						
9
              <fieldset><legend><%=l(:label_add_project_to_publication)%></legend>
10
                <p>
11
                  <%= label_tag "project_search", l(:label_project_search) %><%= text_field_tag 'project_search', nil %>
12
	              </p>
11 13
	     
12
	      <%= observe_field(:project_search,
13
               :frequency => 0.5,
14
               :update => :projects,
15
               :url => { :controller => 'publications', :action => 'autocomplete_for_project', :id => @publication },
16
               :with => 'q')
17
                %>
14
                 observe_field(:project_search,
15
                 :frequency => 0.5,
16
                 :update => :projects,
17
                 :url => { :controller => 'publications', :action => 'autocomplete_for_project', :id => @publication },
18
                 :with => 'q')
19
                
18 20

  
19
					<div id="projects">
20
					<% if params[:q] && params[:q].length > 1 %>
21
			  		  <%= projects_check_box_tags 'project[project_ids][]', @projects %>
22
					<% end %>
23
					</div>
21
                <div id="projects">                  
22
                  <% if params[:q] && params[:q].length > 1 %>
23
                    <%= projects_check_box_tags 'project[project_ids][]', @projects %>
24
                  <% end %>
25
                </div>
24 26

  
25
        <p><%= submit_tag l(:button_add), :id => 'project-add-submit' %></p>
26
    
27
    
28
      </fieldset>
27
                <p><%= submit_tag l(:button_add), :id => 'project-add-submit' %></p>    
28
              </fieldset>
29 29
  <% end %>
plugins/redmine_bibliography/app/views/publications/show.html.erb
11 11
<div class="box">
12 12

  
13 13
<h4><%= l(:authors) %></h4>
14

  
14 15
<ul id="authorships">
15 16
  <% for authorship in @publication.authorships.find(:all, :order => :auth_order) %>
16 17
    <% content_tag_for :li, authorship do %>
17 18
      <%- if User.current.allowed_to?(:edit_publication, @project) && @publication.authorships.length > 1 -%>
18 19
        <span class="handle">[drag to reorder]</span>
19 20
      <%- end -%>
20
      <%= link_to_authorship authorship %> <em><%= h authorship.institution %></em> <br />
21
      
22
      <%= link_to_authorship authorship %> <em><%= h(authorship.institution) %></em>
23
      
24
      <br />
21 25
    <%- end -%>
22 26
  <%- end -%>
23 27
</ul>
24 28

  
25
<%- if User.current.allowed_to?(:edit_publication, @project) && @publication.authorships.length > 1 -%>
26
  <%= sortable_element("authorships", :url => { :controller => :publications, :action => :sort_author_order }, :handle => "handle") %>
27
<%- end -%>
28

  
29 29
<%- if @publication.bibtex_entry != nil -%>
30 30
  <%= show_bibtex_fields(@publication.bibtex_entry) %>
31 31
<%- end -%>
......
36 36
  </p>
37 37
<%- end -%>
38 38

  
39

  
40 39
<% unless @publication.doi.blank? %>
41 40
  <p>
42 41
    <b><%= l(:field_doi)-%>:</b> <%= link_to h(@publication.doi), "http://dx.doi.org/#{@publication.doi}", {:target => "_blank"} -%>
plugins/redmine_bibliography/config/routes.rb
5 5

  
6 6
    match "authors/show/:id", :to => 'authors#show'
7 7

  
8
    match "publications/add_project/:id", :to => 'publications#add_project'
8 9

  
9 10

  
10 11
    resources :publications

Also available in: Unified diff