# HG changeset patch
# User luisf
# Date 1319210422 -3600
# Node ID b96d3005ee7998473cbe2158e9f8c1bee9164f12
# Parent a0e028d6060a1c42dc762261f53d74b1db1a2d76# Parent 37e39e437b2c30e83598befa496dc6133483c46a
Merge from branch "live"
diff -r a0e028d6060a -r b96d3005ee79 vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Mon Sep 19 12:48:52 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Fri Oct 21 16:20:22 2011 +0100
@@ -64,21 +64,21 @@
def get_bibtex_required_fields
- fields = BibtexEntryType.fields(params[:value])
- all_fields = BibtexEntryType.all_fields
+ unless params[:value].empty?
+ fields = BibtexEntryType.fields(params[:value])
+ end
respond_to do |format|
format.js {
- render(:update) {|page|
- all_fields.each_with_index do |field, idx|
- unless fields.include? field
- page["publication_bibtex_entry_attributes_#{field}"].up('p').hide()
- else
- page["publication_bibtex_entry_attributes_#{field}"].up('p').show()
- end
+ render(:update) {|page|
+ if params[:value].empty?
+ page << "hideOnLoad();"
+ else
+ page << "show_required_bibtex_fields(#{fields.to_json()});"
end
}
}
+
end
end
diff -r a0e028d6060a -r b96d3005ee79 vendor/plugins/redmine_bibliography/app/helpers/authorships_helper.rb
--- a/vendor/plugins/redmine_bibliography/app/helpers/authorships_helper.rb Mon Sep 19 12:48:52 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/helpers/authorships_helper.rb Fri Oct 21 16:20:22 2011 +0100
@@ -1,2 +1,21 @@
+# -*- coding: undecided -*-
module AuthorshipsHelper
+
+ # Generates a link to either author or user, depending on which is
+ # available
+ def link_to_authorship(authorship)
+ s = ''
+ if authorship.author.nil?
+ # legacy reasons…
+ s << h(authorship.name_on_paper)
+ else
+ if authorship.author.user.nil?
+ s << link_to(authorship.name_on_paper, :controller => 'authors', :action => 'show', :id => authorship.author)
+ else
+ s << link_to(authorship.name_on_paper, :controller => 'users', :action => 'show', :id => authorship.author.user)
+ end
+ end
+ s
+ end
+
end
diff -r a0e028d6060a -r b96d3005ee79 vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb
--- a/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb Mon Sep 19 12:48:52 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb Fri Oct 21 16:20:22 2011 +0100
@@ -2,6 +2,7 @@
require 'bibtex'
module PublicationsHelper
+ include AuthorshipsHelper
def link_to_publication(publication, options={}, html_options = nil)
url = {:controller => 'publications', :action => 'show', :id => publication}.merge(options)
@@ -77,17 +78,7 @@
s = ''
publication.authorships.each do |authorship|
-
- if authorship.author.nil?
- # legacy reasons…
- s << h(authorship.name_on_paper)
- else
- if authorship.author.user.nil?
- s << link_to(authorship.name_on_paper, :controller => 'authors', :action => 'show', :id => authorship.author)
- else
- s << link_to(authorship.name_on_paper, :controller => 'users', :action => 'show', :id => authorship.author.user)
- end
- end
+ s << link_to_authorship(authorship)
s << "
#{authorship.institution}
"
end
diff -r a0e028d6060a -r b96d3005ee79 vendor/plugins/redmine_bibliography/app/models/bibtex_entry_type.rb
--- a/vendor/plugins/redmine_bibliography/app/models/bibtex_entry_type.rb Mon Sep 19 12:48:52 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/models/bibtex_entry_type.rb Fri Oct 21 16:20:22 2011 +0100
@@ -1,7 +1,5 @@
class BibtexEntryType < ActiveRecord::Base
- @@all_fields = [ "booktitle", "editor", "publisher", "chapter", "pages", "volume", "series", "address", "edition", "month", "year", "type", "note", "number", "journal", "howpublished", "key", "school" ]
-
@@fields = Hash['article', ['journal', 'year', 'volume', 'number', 'pages', 'month', 'note' ],
'book' , [ 'editor', 'publisher', 'volume', 'series', 'address', 'edition', 'month', 'year', 'note' ],
'booklet' , [ 'howpublished', 'address', 'year', 'month', 'note', 'key' ],
@@ -28,8 +26,4 @@
def self.fields (type)
@@fields[ self.find(type).name ]
end
-
- def self.all_fields
- @@all_fields
- end
end
diff -r a0e028d6060a -r b96d3005ee79 vendor/plugins/redmine_bibliography/app/views/authors/show.html.erb
--- a/vendor/plugins/redmine_bibliography/app/views/authors/show.html.erb Mon Sep 19 12:48:52 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/authors/show.html.erb Fri Oct 21 16:20:22 2011 +0100
@@ -1,6 +1,6 @@
<%=l(:label_authors_show)%>
-
+
\ No newline at end of file
+
+
+<% content_for :sidebar do %>
+<% end %>
+
diff -r a0e028d6060a -r b96d3005ee79 vendor/plugins/redmine_bibliography/app/views/publications/_bibtex_fields.html.erb
--- a/vendor/plugins/redmine_bibliography/app/views/publications/_bibtex_fields.html.erb Mon Sep 19 12:48:52 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/_bibtex_fields.html.erb Fri Oct 21 16:20:22 2011 +0100
@@ -8,73 +8,73 @@
:onChange => remote_function( :url => { :controller => :publications, :action => :get_bibtex_required_fields}, :with => "'value=' + value" )
%>
-
- <%= f.text_field :year, :size => 4, :class => 'bibtex' %>
+
+
+ <%= f.text_field :year, :size => 4 %>
-
- <%= f.text_field :month, :size => 4, :class => 'bibtex' %>
+
+ <%= f.text_field :month, :size => 4%>
-
- <%= f.text_field :chapter, :size => 15, :class => 'bibtex' %>
+
+ <%= f.text_field :chapter, :size => 15%>
-
- <%= f.text_field :editor, :size => 33, :class => 'bibtex' %>
+
+ <%= f.text_field :editor, :size => 33 %>
-
- <%= f.text_field :booktitle, :size => 33, :class => 'bibtex' %>
+
+ <%= f.text_field :booktitle, :size => 33 %>
-
- <%= f.text_field :publisher,:size => 33, :class => 'bibtex' %>
+
+ <%= f.text_field :publisher,:size => 33 %>
-
- <%= f.text_field :pages, :size => 12, :class => 'bibtex' %>
+
+ <%= f.text_field :pages, :size => 12 %>
-
- <%= f.text_field :address, :class => 'bibtex' %>
+
+ <%= f.text_field :address %>
-
- <%= f.text_field :annote, :class => 'bibtex' %>
+
+ <%= f.text_field :annote %>
-
- <%= f.text_field :crossref, :class => 'bibtex' %>
+
+ <%= f.text_field :crossref %>
-
- <%= f.text_field :edition, :class => 'bibtex' %>
+
+ <%= f.text_field :edition %>
-
- <%= f.text_field :eprint, :class => 'bibtex' %>
+
+ <%= f.text_field :eprint %>
-
- <%= f.text_field :howpublished, :class => 'bibtex' %>
+
+ <%= f.text_field :howpublished %>
-
- <%= f.text_field :journal, :class => 'bibtex' %>
+
+ <%= f.text_field :journal %>
-
- <%= f.text_field :key, :class => 'bibtex' %>
+
+ <%= f.text_field :key %>
-
- <%= f.text_field :note, :class => 'bibtex' %>
+
+ <%= f.text_field :note %>
-
- <%= f.text_field :number, :class => 'bibtex' %>
+
+ <%= f.text_field :number %>
-
- <%= f.text_field :organization, :class => 'bibtex' %>
+
+ <%= f.text_field :organization %>
-
- <%= f.text_field :school, :class => 'bibtex' %>
+
+ <%= f.text_field :school %>
-
- <%= f.text_field :series, :class => 'bibtex' %>
+
+ <%= f.text_field :series %>
-
- <%= f.text_field :type, :class => 'bibtex' %>
+
+ <%= f.text_field :type %>
-
- <%= f.text_field :url, :class => 'bibtex' %>
+
+ <%= f.text_field :url %>
-
- <%= f.text_field :volume, :class => 'bibtex' %>
-
-
+
+ <%= f.text_field :volume %>
+
\ No newline at end of file
diff -r a0e028d6060a -r b96d3005ee79 vendor/plugins/redmine_bibliography/app/views/publications/edit.html.erb
--- a/vendor/plugins/redmine_bibliography/app/views/publications/edit.html.erb Mon Sep 19 12:48:52 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/edit.html.erb Fri Oct 21 16:20:22 2011 +0100
@@ -1,7 +1,7 @@
<% content_for :header_tags do %>
<%= javascript_include_tag 'authors', :plugin => 'redmine_bibliography' %>
<%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %>
- <%= javascript_tag 'Event.observe(window, "load", function(e){show_all_required_bibtex_fields(' + @bibtype_fields.to_json + ')});' %>
+ <%= javascript_tag 'Event.observe(window, "load", function(e){show_required_bibtex_fields(' + @bibtype_fields.to_json + ')});' %>
<% end %>
<%=l(:label_publication_show)%>
diff -r a0e028d6060a -r b96d3005ee79 vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb
--- a/vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb Mon Sep 19 12:48:52 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb Fri Oct 21 16:20:22 2011 +0100
@@ -1,7 +1,6 @@
<% content_for :header_tags do %>
<%= javascript_include_tag 'authors', :plugin => 'redmine_bibliography' %>
<%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %>
- <%= javascript_tag 'Event.observe(window, "load", hide_all_bibtex_required_fields);' %>
<% end %>
<%=l(:label_publication_new)%>
diff -r a0e028d6060a -r b96d3005ee79 vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb
--- a/vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb Mon Sep 19 12:48:52 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb Fri Oct 21 16:20:22 2011 +0100
@@ -14,7 +14,7 @@
<%- if User.current.allowed_to?(:edit_publication, @project) && @publication.authorships.length > 1 -%>
[drag to reorder]
<%- end -%>
- <%= h authorship.name_on_paper %> <%= h authorship.institution %>
+ <%= link_to_authorship authorship %> <%= h authorship.institution %>
<%- end -%>
<%- end -%>
diff -r a0e028d6060a -r b96d3005ee79 vendor/plugins/redmine_bibliography/app/views/users/show.rhtml
--- a/vendor/plugins/redmine_bibliography/app/views/users/show.rhtml Mon Sep 19 12:48:52 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/users/show.rhtml Fri Oct 21 16:20:22 2011 +0100
@@ -43,6 +43,7 @@
+ <% if @user.author %>
<% @publications = Publication.all(:include => :authors, :conditions => "authors.id = #{@user.author.id}") %>
@@ -65,7 +66,7 @@
<% end %>
-
+ <% end %>
<% unless @events_by_day.empty? %>
diff -r a0e028d6060a -r b96d3005ee79 vendor/plugins/redmine_bibliography/assets/javascripts/authors.js
--- a/vendor/plugins/redmine_bibliography/assets/javascripts/authors.js Mon Sep 19 12:48:52 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/assets/javascripts/authors.js Fri Oct 21 16:20:22 2011 +0100
@@ -57,16 +57,17 @@
toggle_div("publication_authorships_attributes_" + form_object_id +"_search_author");
}
-function edit_author(form_object_id){}
+function hide_all_bibtex_required_fields(){$$('p.bibtex').each(function(s){s.hide()})}
-function hide_all_bibtex_required_fields() {
- $$('input.bibtex').each(function(s){
- s.up('p').hide();
- })}
-
-function show_all_required_bibtex_fields(entrytype_fields) {
- $$('input.bibtex').each(function(s){
- if(entrytype_fields.indexOf(s.id.split('_').last()) == -1){s.up('p').hide()};
+// entrytype_fields is a jsno array with the fields requires by the selected bibtex entry
+function show_required_bibtex_fields(entrytype_fields) {
+ $$('p.bibtex').each(function(s){
+ if(entrytype_fields.indexOf(s.down('input').id.split('_').last()) != -1){
+ s.show();
+ }
+ else {
+ s.hide();
+ }
})
}
\ No newline at end of file
diff -r a0e028d6060a -r b96d3005ee79 vendor/plugins/redmine_bibliography/config/locales/en.yml
--- a/vendor/plugins/redmine_bibliography/config/locales/en.yml Mon Sep 19 12:48:52 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/config/locales/en.yml Fri Oct 21 16:20:22 2011 +0100
@@ -23,12 +23,12 @@
label_all_publications: All Publications
label_all_publications_for_project: Publications associated with %{project}
- label_authors_show: "Authorships by this author"
+ label_authors_show: "Authorships associated with this author"
label_authors_index: "List of authors"
- field_authorship_publication_title: "Publication Title"
- field_authorship_name: "Name"
- field_authorship_email: "Email Address"
+ field_authorship_publication_title: "Publication"
+ field_authorship_name: "Name on Paper"
+ field_authorship_email: "Email"
field_authorship_institution: "Institution"
field_external_url: "External URL"
@@ -86,7 +86,7 @@
field_publication_id: "Publication_id"
field_address: "Address"
field_annote: "Annote"
- field_booktitle: "Book Title"
+ field_booktitle: "Title of Book or Proceedings"
field_chapter: "Chapter"
field_crossref: "Cross Reference"
field_edition: "Edition"