# HG changeset patch # User luisf # Date 1353332937 0 # Node ID 80cf86be16117cfb9b3511bf936a9b9b93f7bf87 # Parent 6674e52e20bfc55ca1d0ae7b10f5782ebbc2231a created partial for author suggestions; renders this partial after the AJAX call using RJS. diff -r 6674e52e20bf -r 80cf86be1611 vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb --- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Mon Nov 19 11:56:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Mon Nov 19 13:48:57 2012 +0000 @@ -43,7 +43,10 @@ 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 @@ -82,16 +85,6 @@ # rescue BibtexParsingError => e # logger.error { "Bibtex Parsing Error #{bib.errors}" } - # todo: not showing... should be inside render? -# flash[:error] = e.message - -# respond_to do |format| -# format.js{ -# render(:update) {|page| -# } -# } -# end - # end diff -r 6674e52e20bf -r 80cf86be1611 vendor/plugins/redmine_bibliography/app/views/publications/_suggest_author.html.erb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_suggest_author.html.erb Mon Nov 19 13:48:57 2012 +0000 @@ -0,0 +1,5 @@ + +

+ Author <%= h author %> +

+ diff -r 6674e52e20bf -r 80cf86be1611 vendor/plugins/redmine_bibliography/app/views/publications/new/_bibtex.html.erb --- a/vendor/plugins/redmine_bibliography/app/views/publications/new/_bibtex.html.erb Mon Nov 19 11:56:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/new/_bibtex.html.erb Mon Nov 19 13:48:57 2012 +0000 @@ -1,5 +1,3 @@ - -
<%= text_area_tag :bibtex_paste, "Please paste your bibtex entry here" , :class => "wiki", :style => 'width:90%' -%> @@ -10,3 +8,4 @@

Preview

+

Authors

\ No newline at end of file diff -r 6674e52e20bf -r 80cf86be1611 vendor/plugins/redmine_bibliography/app/views/publications/parse_bibtex.rjs --- a/vendor/plugins/redmine_bibliography/app/views/publications/parse_bibtex.rjs Mon Nov 19 11:56:29 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/parse_bibtex.rjs Mon Nov 19 13:48:57 2012 +0000 @@ -1,8 +1,14 @@ if @bibtex_parse_success page.insert_html :bottom, :ieee_prev, @ieee_prev page.insert_html :top, :content, '
Successfully Parsed BibTeX
' + + @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, '
Error parsing BibTeX.
' end + flash.discard \ No newline at end of file