Mercurial > hg > soundsoftware-site
changeset 1053:80cf86be1611 bibplugin_bibtex
created partial for author suggestions; renders this partial after the AJAX call using RJS.
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Mon, 19 Nov 2012 13:48:57 +0000 |
parents | 6674e52e20bf |
children | cde00909adc8 |
files | vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb vendor/plugins/redmine_bibliography/app/views/publications/_suggest_author.html.erb vendor/plugins/redmine_bibliography/app/views/publications/new/_bibtex.html.erb vendor/plugins/redmine_bibliography/app/views/publications/parse_bibtex.rjs |
diffstat | 4 files changed, 15 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- /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 @@ + +<p> + Author <%= h author %> +</p> +
--- 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 @@ - - <div class="box"> <%= text_area_tag :bibtex_paste, "Please paste your bibtex entry here" , :class => "wiki", :style => 'width:90%' -%> @@ -10,3 +8,4 @@ <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
--- 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, '<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