Mercurial > hg > soundsoftware-site
changeset 724:b96d3005ee79 luisf
Merge from branch "live"
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Fri, 21 Oct 2011 16:20:22 +0100 |
parents | a0e028d6060a (current diff) 37e39e437b2c (diff) |
children | 1308652d7c19 |
files | |
diffstat | 12 files changed, 103 insertions(+), 94 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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
--- 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 = '<p>' 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 << "<br /><em>#{authorship.institution}</em></p>" end
--- 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
--- 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 @@ <h2><%=l(:label_authors_show)%></h2> -<div class="splitcontentleft"> +<div class="autoscroll"> <table class="list authors"> <thead> <tr> @@ -21,4 +21,8 @@ <% end %> </tbody> </table> -</div> \ No newline at end of file +</div> + +<% content_for :sidebar do %> +<% end %> +
--- 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" ) %> </p> -<p> - <%= f.text_field :year, :size => 4, :class => 'bibtex' %> + +<p class="bibtex hol"> + <%= f.text_field :year, :size => 4 %> </p> -<p> - <%= f.text_field :month, :size => 4, :class => 'bibtex' %> +<p class="bibtex hol"> + <%= f.text_field :month, :size => 4%> </p> -<p> - <%= f.text_field :chapter, :size => 15, :class => 'bibtex' %> +<p class="bibtex hol"> + <%= f.text_field :chapter, :size => 15%> </p> -<p> - <%= f.text_field :editor, :size => 33, :class => 'bibtex' %> +<p class="bibtex hol"> + <%= f.text_field :editor, :size => 33 %> </p> -<p> - <%= f.text_field :booktitle, :size => 33, :class => 'bibtex' %> +<p class="bibtex hol"> + <%= f.text_field :booktitle, :size => 33 %> </p> -<p> - <%= f.text_field :publisher,:size => 33, :class => 'bibtex' %> +<p class="bibtex hol"> + <%= f.text_field :publisher,:size => 33 %> </p> -<p> - <%= f.text_field :pages, :size => 12, :class => 'bibtex' %> +<p class="bibtex hol"> + <%= f.text_field :pages, :size => 12 %> </p> -<p> - <%= f.text_field :address, :class => 'bibtex' %> +<p class="bibtex hol"> + <%= f.text_field :address %> </p> -<p> - <%= f.text_field :annote, :class => 'bibtex' %> +<p class="bibtex hol"> + <%= f.text_field :annote %> </p> -<p> - <%= f.text_field :crossref, :class => 'bibtex' %> +<p class="bibtex hol"> + <%= f.text_field :crossref %> </p> -<p> - <%= f.text_field :edition, :class => 'bibtex' %> +<p class="bibtex hol"> + <%= f.text_field :edition %> </p> -<p> - <%= f.text_field :eprint, :class => 'bibtex' %> +<p class="bibtex hol"> + <%= f.text_field :eprint %> </p> -<p> - <%= f.text_field :howpublished, :class => 'bibtex' %> +<p class="bibtex hol"> + <%= f.text_field :howpublished %> </p> -<p> - <%= f.text_field :journal, :class => 'bibtex' %> +<p class="bibtex hol"> + <%= f.text_field :journal %> </p> -<p> - <%= f.text_field :key, :class => 'bibtex' %> +<p class="bibtex hol"> + <%= f.text_field :key %> </p> -<p> - <%= f.text_field :note, :class => 'bibtex' %> +<p class="bibtex hol"> + <%= f.text_field :note %> </p> -<p> - <%= f.text_field :number, :class => 'bibtex' %> +<p class="bibtex hol"> + <%= f.text_field :number %> </p> -<p> - <%= f.text_field :organization, :class => 'bibtex' %> +<p class="bibtex hol"> + <%= f.text_field :organization %> </p> -<p> - <%= f.text_field :school, :class => 'bibtex' %> +<p class="bibtex hol"> + <%= f.text_field :school %> </p> -<p> - <%= f.text_field :series, :class => 'bibtex' %> +<p class="bibtex hol"> + <%= f.text_field :series %> </p> -<p> - <%= f.text_field :type, :class => 'bibtex' %> +<p class="bibtex hol"> + <%= f.text_field :type %> </p> -<p> - <%= f.text_field :url, :class => 'bibtex' %> +<p class="bibtex hol"> + <%= f.text_field :url %> </p> -<p> - <%= f.text_field :volume, :class => 'bibtex' %> -</p> - +<p class="bibtex hol"> + <%= f.text_field :volume %> +</p> \ No newline at end of file
--- 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 %> <h2><%=l(:label_publication_show)%></h2>
--- 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 %> <h2><%=l(:label_publication_new)%></h2>
--- 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 -%> <span class="handle">[drag to reorder]</span> <%- end -%> - <%= h authorship.name_on_paper %> <em><%= h authorship.institution %></em> <br /> + <%= link_to_authorship authorship %> <em><%= h authorship.institution %></em> <br /> <%- end -%> <%- end -%> </ul>
--- 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 @@ <div class="splitcontentright"> + <% if @user.author %> <div id="bibliography"> <% @publications = Publication.all(:include => :authors, :conditions => "authors.id = #{@user.author.id}") %> @@ -65,7 +66,7 @@ </dd> <% end %> </div> - + <% end %> <% unless @events_by_day.empty? %>
--- 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
--- 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"