Mercurial > hg > soundsoftware-site
changeset 1090:cde00909adc8 bibplugin_bibtex
Merge
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Mon, 26 Nov 2012 17:36:31 +0000 |
parents | 80cf86be1611 (diff) 6b67deb0674b (current diff) |
children | 3d387b121e85 |
files | |
diffstat | 14 files changed, 252 insertions(+), 134 deletions(-) [+] |
line wrap: on
line diff
--- a/app/models/attachment.rb Mon Nov 19 18:58:29 2012 +0000 +++ b/app/models/attachment.rb Mon Nov 26 17:36:31 2012 +0000 @@ -69,7 +69,7 @@ end end end - + def file nil end @@ -168,7 +168,7 @@ end def self.latest_attach(attachments, filename) - attachments.sort_by(&:created_on).reverse.detect { + attachments.sort_by(&:created_on).reverse.detect { |att| att.filename.downcase == filename.downcase } end
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Mon Nov 26 17:36:31 2012 +0000 @@ -1,11 +1,13 @@ # -*- coding: utf-8 -*- # vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb +class BibtexParsingError < Exception; end + class PublicationsController < ApplicationController unloadable model_object Publication - before_filter :find_model_object, :except => [:new, :create, :index, :get_bibtex_required_fields, :autocomplete_for_project, :add_author, :sort_author_order, :autocomplete_for_author, :get_user_info ] + before_filter :find_model_object, :except => [:parse_bibtex, :new, :create, :index, :get_bibtex_required_fields, :autocomplete_for_project, :add_author, :sort_author_order, :autocomplete_for_author, :get_user_info ] before_filter :find_project_by_project_id, :authorize, :only => [ :edit, :new, :update, :create ] def new @@ -16,13 +18,78 @@ @publication.build_bibtex_entry # and at least one author - # @publication.authorships.build.build_author + # @publication.authorships.build.build_author @author_options = [["#{User.current.name} (@#{User.current.mail.partition('@')[2]})", "#{User.current.class.to_s}_#{User.current.id.to_s}"]] - - end - def create + def parse_bibtex + find_project_by_project_id + @bibtex_parse_success = true + + begin + bibtex_paste = params[:bibtex_paste] + bib = BibTeX.parse(bibtex_paste) + rescue + # todo: output errors to user + # bib.errors.present? + @bibtex_parse_success = false + # @bibtex_parsing_error = bib.errors[0].trace[4] + # logger.error { "BibTex Parsing Error: #{@bibtex_parsing_error}" } + logger.error { "BibTex Parsing Error" } + end + + respond_to do |format| + # todo: response for HTML + format.html{} + + if @bibtex_parse_success + # todo: should this code be here? + @ieee_prev = CiteProc.process bib.to_citeproc, :style => :ieee, :format => :html + @bibtex_parsed_authors = bib[0].authors + logger.error { "Authors: #{@bibtex_parsed_authors}" } + end + + format.js + + + end + end + + +# respond_to do |format| +# format.js { +# render(:update) {|page| +# flash.now[:notice] = "Correctly parsed BibTeX entry" +# +# bibtex_entry_no = BibtexEntryType.find_by_name(bib[0].type.to_s).id +# page["publication_title"].value = bib[0][:title] +# page["publication_bibtex_entry_attributes_entry_type"].value = #bibtex_entry_no +# +# BibtexEntryType.fields(bibtex_entry_no).each do |field| +# page["publication_bibtex_entry_attributes_#{field}"].value = bib[0][field#] +# end +# +# # for each author simulates a click and fills the author info +## bib[0].authors.each do |author| +## page["add_another_author"].click +## page.alert(bib[0].authors.length) +## page.alert(page["authors"].first.id) +## end +# +# +# +# } +# } +# end + +# rescue BibtexParsingError => e +# logger.error { "Bibtex Parsing Error #{bib.errors}" } + +# end + + + + def create @project = Project.find(params[:project_id]) @author_options = [] @@ -30,7 +97,7 @@ @publication = Publication.new(params[:publication]) @publication.projects << @project unless @project.nil? - if @publication.save + if @publication.save @publication.notify_authors_publication_added(@project) flash[:notice] = "Successfully created publication." @@ -58,20 +125,18 @@ # method for creating "pasted" bibtex entries if bibtex_entry - parse_bibtex_list bibtex_entry + parse_bibtex_list bibtex_entry end end def get_bibtex_required_fields - unless params[:value].empty? - fields = BibtexEntryType.fields(params[:value]) - end + fields = BibtexEntryType.fields(params[:q]) respond_to do |format| format.js { - render(:update) {|page| - if params[:value].empty? + render(:update) {|page| + if params[:q].empty? page << "hideOnLoad();" else page << "show_required_bibtex_fields(#{fields.to_json()});" @@ -92,27 +157,25 @@ end end - def edit + def edit find_project_by_project_id unless params[:project_id].nil? @edit_view = true; @publication = Publication.find(params[:id]) @selected_bibtex_entry_type_id = @publication.bibtex_entry.entry_type - @author_options = [] + @author_options = [] - @bibtype_fields = BibtexEntryType.fields(@selected_bibtex_entry_type_id) + @bibtype_fields = BibtexEntryType.fields(@selected_bibtex_entry_type_id) end - def update - @publication = Publication.find(params[:id]) + def update + @publication = Publication.find(params[:id]) @author_options = [] - logger.error { "INSIDE THE UPDATE ACTION IN THE PUBLICATION CONTROLLER" } - if @publication.update_attributes(params[:publication]) - flash[:notice] = "Successfully updated Publication." + flash[:notice] = "Successfully Updated Publication." if !params[:project_id].nil? redirect_to :action => :show, :id => @publication, :project_id => params[:project_id] @@ -121,7 +184,7 @@ end else render :action => 'edit' - end + end end @@ -143,7 +206,7 @@ return authors_entry.split(" and ") end - # parses a list of bibtex + # parses a list of bibtex def parse_bibtex_list(bibtex_list) bibliography = BibTeX.parse bibtex_list @@ -156,11 +219,11 @@ create_bibtex_entry d end end - end + end - def create_bibtex_entry(d) + def create_bibtex_entry(d) @publication = Publication.new - @bentry = BibtexEntry.new + @bentry = BibtexEntry.new authors = [] institution = "" email = "" @@ -178,17 +241,17 @@ else @bentry[field] = d[field] end - end + end @publication.bibtex_entry = @bentry @publication.save - # what is this for??? + # what is this for??? # @created_publications << @publication.id # need to save all authors - # and establish the author-publication association - # via the authorships table + # and establish the author-publication association + # via the authorships table authors.each_with_index.map do |authorname, idx| author = Author.new(:name => authorname) if author.save! @@ -220,12 +283,13 @@ def autocomplete_for_project @publication = Publication.find(params[:id]) - @projects = Project.active.like(params[:q]).find(:all, :limit => 100) - @publication.projects + @projects = Project.active.like(params[:q]).find(:all, :limit => 100) - @publication.projects logger.debug "Query for \"#{params[:q]}\" returned \"#{@projects.size}\" results" render :layout => false end - def autocomplete_for_author + + def autocomplete_for_author @results = [] object_id = params[:object_id] @@ -239,8 +303,8 @@ @results = users_list - # TODO: can be optimized… - authorships_list.each do |authorship| + # TODO: can be optimized… + authorships_list.each do |authorship| flag = true users_list.each do |user| @@ -254,7 +318,7 @@ @results << authorship if flag end - render :layout => false + render :layout => false end def get_user_info @@ -272,7 +336,7 @@ respond_to do |format| format.js { - render(:update) {|page| + render(:update) {|page| page[name_field].value = item.name page[email_field].value = item.mail page[institution_field].value = item.institution @@ -294,16 +358,16 @@ end def add_project - @projects = Project.find(params[:publication][:project_ids]) + @projects = Project.find(params[:publication][:project_ids]) @publication.projects << @projects - @project = Project.find(params[:project_id]) + @project = Project.find(params[:project_id]) - # TODO luisf should also respond to HTML??? + # TODO luisf should also respond to HTML??? respond_to do |format| format.html { redirect_to :back } - format.js { - render(:update) {|page| - page[:add_project_form].reset + format.js { + render(:update) {|page| + page[:add_project_form].reset page.replace_html :list_projects, :partial => 'list_projects' } } @@ -320,14 +384,14 @@ @publication.projects.delete proj if request.post? end else - logger.error { "Cannot remove project from publication list" } + logger.error { "Cannot remove project from publication list" } end logger.error { "CURRENT project name#{proj.name} and wanna delete #{@project.name}" } - render(:update) {|page| + render(:update) {|page| page.replace_html "list_projects", :partial => 'list_projects', :id => @publication - } + } end def destroy
--- a/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb Mon Nov 26 17:36:31 2012 +0000 @@ -4,6 +4,13 @@ module PublicationsHelper include AuthorshipsHelper + def create_publication_tabs + tabs = [ + {:name => 'bibtex', :partial => 'publications/new/bibtex', :label => :label_bibtex}, + {:name => 'default', :partial => 'publications/new/default', :label => :label_default} + ] + end + def link_to_publication(publication, options={}, html_options = nil) url = {:controller => 'publications', :action => 'show', :id => publication}.merge(options) link_to(h(publication.title), url, html_options) @@ -12,20 +19,20 @@ def projects_check_box_tags(name, projects) s = '' projects.sort.each do |project| - if User.current.allowed_to?(:edit_publication, project) + if User.current.allowed_to?(:edit_publication, project) s << "<label>#{ check_box_tag name, project.id, false } #{link_to_project project}</label>\n" s << '<br />' end end - s + s end - + def choose_author_link(object_name, items) # called by autocomplete_for_author (publications' action/view) # creates the select list based on the results array # results is an array with both Users and Authorships objects - + @author_options = [] @results.each do |result| email_bit = result.mail.partition('@')[2] @@ -34,26 +41,26 @@ end @author_options << ["#{result.name} #{email_bit}", "#{result.class.to_s}_#{result.id.to_s}"] end - + if @results.size > 0 s = select_tag( form_tag_name(object_name, :author_search_results), options_for_select(@author_options), { :id => form_tag_id(object_name, :author_search_results), :size => 3} ) s << observe_field( form_tag_id(object_name, :author_search_results), :on => 'click', :function => "alert('Element changed')", :with => 'q') else s = "<em>No Authors found that match your search… sorry!</em>" - end + end end def link_to_remove_fields(name, f) f.hidden_field(:_destroy) + link_to_function(name, "remove_fields(this)", :class => 'icon icon-del') end - + def link_to_add_author_fields(name, f, association, action) new_object = f.object.class.reflect_on_association(association).klass.new fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder| render(association.to_s.singularize + "_fields", :f => builder) - end + end link_to_function(name, h("add_author_fields(this, '#{association}', '#{escape_javascript(fields)}', '#{action}')"), { :class => 'icon icon-add', :id => "add_another_author" }) - end + end def sanitized_object_name(object_name) object_name.gsub(/\]\[|[^-a-zA-Z0-9:.]/,"_").sub(/_$/,"") @@ -62,75 +69,75 @@ def sanitized_method_name(method_name) method_name.sub(/\?$/, "") end - + def form_tag_name(object_name, method_name) str = "#{object_name.to_s}[#{sanitized_method_name(method_name.to_s)}]" - str.to_sym + str.to_sym end - - def form_tag_id(object_name, method_name) + + def form_tag_id(object_name, method_name) str = "#{sanitized_object_name(object_name.to_s)}_#{sanitized_method_name(method_name.to_s)}" str.to_sym end - + def form_object_id(object_name) str = object_name.split("\[").last().gsub("\]","") str.to_sym end - def render_authorships_list(publication) + def render_authorships_list(publication) s = '<p>' - + publication.authorships.each do |authorship| s << link_to_authorship(authorship) s << "<br /><em>#{authorship.institution}</em></p>" - end + end - s + s end - - def render_projects_list(publication, show_delete_icon) + + def render_projects_list(publication, show_delete_icon) s= "" - + publication.projects.visible.each do |proj| s << link_to_project(proj, {}, :class => 'publication_project') - - if show_delete_icon + + if show_delete_icon if User.current.allowed_to?(:edit_publication, @project) if @project == proj # todo: move this message to yml file confirm_msg = 'Are you sure you want to remove the current project from this publication\'s projects list?' else 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') + 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') end end - - s << "<br />" - end - s + s << "<br />" + end + + s end - + def show_cite_proc_entry(publication) # code that should be moved either to the model or to the controller? - + publication.print_entry(:ieee) end - + def print_bibtex_entry(publication) publication.print_entry(:bibtex) end - - + + def show_bibtex_fields(bibtex_entry) s = "" bibtex_entry.attributes.keys.sort.each do |key| value = bibtex_entry.attributes[key].to_s next if key == 'id' or key == 'publication_id' or value == "" - s << "<h4>" + l("field_#{key}") + "</h4>" + s << "<h4>" + l("field_#{key}") + "</h4>" s << "<p>" if key == "entry_type" s << bibtex_entry.entry_type_label @@ -140,6 +147,6 @@ s << "</p>" end s - end + end end
--- a/vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.html.erb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_authorship_fields.html.erb Mon Nov 26 17:36:31 2012 +0000 @@ -1,9 +1,4 @@ -<%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %> - - -<div id="authors" class="fields"> -<!-- <h4><%= l("label_author_1") %></h4> --> - +<fieldset> <div id="<%= form_tag_id( f.object_name, :search_author ) %>" style=<%= "display:none;" unless params[:action] == "new" %> > <p> <%= f.text_field :search_name, :size => 25 %> @@ -12,10 +7,10 @@ <%# link_to_function l(:label_author_is_me), "update_author_info(this," + User.current.get_author_info.to_json + ")", :id => "add_me_as_author" %> <p> - <%= f.select :search_results, options_for_select(@author_options), {}, {:size => 5, - :onChange => remote_function( :url => { :controller => :publications, :action => :get_user_info, :object_id => form_object_id(f.object_name) }, :with => "'value=' + - value" )} %> - </p> + <%= f.select :search_results, options_for_select(@author_options), {}, {:size => 5, + :onChange => remote_function( :url => { :controller => :publications, :action => :get_user_info, :object_id => form_object_id(f.object_name) }, :with => "'value=' + + value" )} %> + </p> <p style="margin-bottom: -2.5em; padding-bottom; 0"><label><%= l(:identify_author_question) %></label></p> <p class="author_identify"> @@ -25,7 +20,7 @@ <label class='inline'><%= radio_button_tag(:identify_author, "no", true, :name => form_tag_name(f.object_name,:identify_author ), :id => form_tag_id( f.object_name, :identify_author_no ), :onchange => "identify_author_status($(this).value, #{form_object_id(f.object_name) });") %> <%= l(:identify_author_no) %> </label><br /> </p> - </div> + </div> <div class='author_edit' id="<%= form_tag_id( f.object_name, :edit_author_info ) %>"> <p> @@ -38,21 +33,18 @@ </p> </div> - <div class="box" id="<%= form_tag_id( f.object_name, :show_author_info ) %>" style="display: none"> - </div> - + <p> - - <%- if params[:action] == 'new' -%> - <%= button_to_function l(:label_save_author), {}, { :onclick => "toggle_save_author(#{form_object_id(f.object_name)}); return false;", :id => form_tag_id( f.object_name, :edit_save_button )} %> - <%- else -%> - <%= button_to_function l(:label_edit_author), {}, { :onclick => "toggle_save_author(#{form_object_id(f.object_name)}); return false;", :id => form_tag_id( f.object_name, :edit_save_button )} %> - <%- end -%> - + <%- if params[:action] == 'new' -%> + <%= button_to_function l(:label_save_author), {}, { :onclick => "toggle_save_author(#{form_object_id(f.object_name)}); return false;", :id => form_tag_id( f.object_name, :edit_save_button )} %> + <%- else -%> + <%= button_to_function l(:label_edit_author), {}, { :onclick => "toggle_save_author(#{form_object_id(f.object_name)}); return false;", :id => form_tag_id( f.object_name, :edit_save_button )} %> + <%- end -%> <%= link_to_remove_fields l("remove_author"), f %> </p> -</div> -<br/> +<br /> +</fieldset> +
--- a/vendor/plugins/redmine_bibliography/app/views/publications/_bibtex_fields.html.erb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_bibtex_fields.html.erb Mon Nov 26 17:36:31 2012 +0000 @@ -3,12 +3,17 @@ <%= f.collection_select :entry_type, BibtexEntryType.find(:all).reject { |x| x.redundant? }, :id, - :label, - { :selected => @selected_bibtex_entry_type_id, :prompt => true }, - :onChange => remote_function( :url => { :controller => :publications, :action => :get_bibtex_required_fields}, :with => "'value=' + value" ) + :label, + { :prompt => true } %> </p> + +<%= observe_field :publication_bibtex_entry_attributes_entry_type, :url => { :controller => :publications, :action => :get_bibtex_required_fields }, + :frequency => 0.25, + :with => 'q' + %> + <p class="bibtex hol"> <%= f.text_field :year, :size => 4 %> </p>
--- a/vendor/plugins/redmine_bibliography/app/views/publications/_form.html.erb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_form.html.erb Mon Nov 26 17:36:31 2012 +0000 @@ -1,9 +1,9 @@ -<%= f.error_messages %> +<%= f.error_messages %> +<%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %> <h3><%= f.text_field :title, :required => true, :size => 70 %></h3> -<div class="splitcontentleft"> - <h3><%= l(:label_publication_other_details) %></h3> +<h3><%= l(:label_publication_other_details) %></h3> <div class="box tabular"> <% f.fields_for :bibtex_entry do |builder| -%> <%= render :partial => 'bibtex_fields', :locals => { :f => builder} %> @@ -14,18 +14,15 @@ <br /> <em><%= l(:text_external_url) %></em> </p> + </div> - </div> -</div> - -<div class="splitcontentright"> - <h3><%= l(:authors) %></h3> +<h3><%= l(:authors) %></h3> <div class="box tabular"> - <% f.fields_for :authorships do |builder| -%> - <%= render "authorship_fields", :f => builder %> - <%- end -%> + <div id="authors" class="fields"> + <% f.fields_for :authorships do |builder| -%> + <%= render "authorship_fields", :f => builder %> + <%- end -%> + </div> <%= link_to_add_author_fields l(:label_add_an_author), f, :authorships, params[:action] %> </div> -</div> - - +</div> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_suggest_author.html.erb Mon Nov 26 17:36:31 2012 +0000 @@ -0,0 +1,5 @@ + +<p> + Author <%= h author %> +</p> +
--- a/vendor/plugins/redmine_bibliography/app/views/publications/edit.html.erb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/edit.html.erb Mon Nov 26 17:36:31 2012 +0000 @@ -1,6 +1,6 @@ <% content_for :header_tags do %> <%= javascript_include_tag 'authors', :plugin => 'redmine_bibliography' %> - <%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %> + <%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %> <%= javascript_tag 'Event.observe(window, "load", function(e){show_required_bibtex_fields(' + @bibtype_fields.to_json + ')});' %> <% end %>
--- a/vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb Mon Nov 26 17:36:31 2012 +0000 @@ -1,12 +1,23 @@ <% content_for :header_tags do %> - <%= javascript_include_tag 'authors', :plugin => 'redmine_bibliography' %> - <%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %> + <%= javascript_include_tag 'authors', :plugin => 'redmine_bibliography' -%> + <!--<%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' -%>--> <% end %> +<%= error_messages_for 'publication' %> + <h2><%=l(:label_publication_new)%></h2> -<% form_for @publication, :url => { :project_id => @project, :action => :create }, :builder => TabularFormBuilder do |f| -%> - <%= render :partial => 'form', :locals => { :f => f } %> - <div style="clear:both"></div> - <%= f.submit %> -<% end %> +<div class="splitcontentleft"> + <p>To create a publication you can either parse a BibTeX entry or enter the publication details manually.<p> + + <%= render :partial => 'publications/new/bibtex' %> + + <!-- <%= render_tabs create_publication_tabs %> --> +</div> + +<div class="splitcontentright"> + + <%= render :partial => 'publications/new/default' %> + + +</div> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/new/_bibtex.html.erb Mon Nov 26 17:36:31 2012 +0000 @@ -0,0 +1,11 @@ +<div class="box"> + <%= text_area_tag :bibtex_paste, "Please paste your bibtex entry here" , :class => "wiki", :style => 'width:90%' -%> + + <br /> + + <%= link_to_remote "Parse BiBTeX", :url => { :project_id => @project, :action => :parse_bibtex}, :with => "'bibtex_paste=' + $('bibtex_paste').value" -%> +</div> + +<div class="box" id="ieee_prev"><h3>Preview</h3></div> + +<div class="box" id="suggest_bibtex_authors"><h3>Authors</h3></div> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/new/_default.html.erb Mon Nov 26 17:36:31 2012 +0000 @@ -0,0 +1,10 @@ +<% form_for @publication, :url => { :project_id => @project, :action => :create }, :builder => TabularFormBuilder do |f| -%> + <div class="box tabular settings"> + <fieldset> + <%= render :partial => 'form', :locals => { :f => f } %> + + <div style="clear:both"></div> + <%= f.submit %> + </fieldset> + </div> +<%- end -%> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/parse_bibtex.rjs Mon Nov 26 17:36:31 2012 +0000 @@ -0,0 +1,14 @@ +if @bibtex_parse_success + page.insert_html :bottom, :ieee_prev, @ieee_prev + page.insert_html :top, :content, '<div class="flash notice">Successfully Parsed BibTeX</div>' + + @bibtex_parsed_authors.each do |auth| + page.insert_html :bottom, :suggest_bibtex_authors, :partial => "suggest_author" , :locals => {:author => auth} + end + +else + page.insert_html :top, :content, '<div class="flash error">Error parsing BibTeX.</div>' +end + + +flash.discard \ No newline at end of file
--- a/vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/show.html.erb Mon Nov 26 17:36:31 2012 +0000 @@ -1,3 +1,5 @@ +<%= stylesheet_link_tag 'bibliography', :plugin => 'redmine_bibliography' %> + <h2><%=l(:label_publication_show)%></h2> <div class="box">
--- a/vendor/plugins/redmine_bibliography/assets/javascripts/authors.js Mon Nov 19 18:58:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/assets/javascripts/authors.js Mon Nov 26 17:36:31 2012 +0000 @@ -6,9 +6,9 @@ function add_author_fields(link, association, content, action) { var new_id = new Date().getTime(); var regexp = new RegExp("new_" + association, "g"); - $(link).insert({ - before: content.replace(regexp, new_id) - }); + + $('authors').insert(content.replace(regexp, new_id)); + if(action != "new"){ toggle_save_author(new_id, $(link)); };