# HG changeset patch # User luisf # Date 1354557195 0 # Node ID 6d85e9ea961cdfeb4502ffbb1cac0bbf2d7d8223 # Parent e5b80648aaa591f9bcd547dc2f6a13b87ae0945d (dev commit) added a submit button; correctly posts the form's data. Started working on the create from bibtex action. diff -r e5b80648aaa5 -r 6d85e9ea961c vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb --- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Mon Dec 03 12:55:16 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Mon Dec 03 17:53:15 2012 +0000 @@ -7,7 +7,7 @@ unloadable model_object Publication - 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_model_object, :except => [:parse_bibtex, :new, :create, :create_from_bibtex, :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 @@ -50,18 +50,25 @@ @ieee_prev = CiteProc.process bib.to_citeproc, :style => :ieee, :format => :html bibtex_parsed_authors = bib[0].authors + # todo: need to create a bibtex object + ## and add it to the session hash + + # creates stucture with author suggestions bibtex_parsed_authors.each do |auth| @suggested_authors[auth] = suggest_authors(auth.last) end - - logger.error { "Suggested Authors: #{@suggested_authors}" } - end format.js end end + def create_from_bibtex + find_project_by_project_id + logger.error { "INSIDE CREATE FROM BIBTEX" } + + end + def create @project = Project.find(params[:project_id]) diff -r e5b80648aaa5 -r 6d85e9ea961c vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb --- a/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb Mon Dec 03 12:55:16 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb Mon Dec 03 17:53:15 2012 +0000 @@ -153,7 +153,7 @@ end def create_author_suggestion_radio(radio_object, author) - s = radio_button_tag(radio_object, author.id, false) + s = radio_button_tag(radio_object, "author_#{author.id}", false) # todo: returns first non empty name... author.authorships.each do |auth| unless auth.name_on_paper.nil? @@ -166,7 +166,7 @@ end def create_user_suggestion_radio(radio_object, user) - s = radio_button_tag(radio_object, user.id, false) + s = radio_button_tag(radio_object, "user_#{user.id}", false) s << user.name s << '
' s diff -r e5b80648aaa5 -r 6d85e9ea961c vendor/plugins/redmine_bibliography/app/models/publication.rb --- a/vendor/plugins/redmine_bibliography/app/models/publication.rb Mon Dec 03 12:55:16 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/models/publication.rb Mon Dec 03 17:53:15 2012 +0000 @@ -37,7 +37,6 @@ :description => Proc.new {|o| o.print_entry(:ieee)}, :url => Proc.new {|o| {:controller => 'publications', :action => 'show', :id => o.id }} - # Ensure error message uses proper text instead of # bibtex_entry.entry_type (#268). There has to be a better way to # do this! diff -r e5b80648aaa5 -r 6d85e9ea961c vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb --- a/vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb Mon Dec 03 12:55:16 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb Mon Dec 03 17:53:15 2012 +0000 @@ -7,5 +7,4 @@

<%=l(:label_publication_new)%>

- -<%= render_tabs create_publication_tabs %> +<%= render_tabs create_publication_tabs -%> diff -r e5b80648aaa5 -r 6d85e9ea961c vendor/plugins/redmine_bibliography/app/views/publications/new/_bibtex.html.erb --- a/vendor/plugins/redmine_bibliography/app/views/publications/new/_bibtex.html.erb Mon Dec 03 12:55:16 2012 +0000 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/new/_bibtex.html.erb Mon Dec 03 17:53:15 2012 +0000 @@ -1,17 +1,23 @@ -
-
-

Paste your bibtex entry

-
- <%= text_area_tag :bibtex_paste, "Please paste your bibtex entry here" , :class => "wiki", :style => 'width:90%; height:100px;' -%> -
- <%= link_to_remote "Parse BiBTeX", :url => { :project_id => @project, :action => :parse_bibtex}, :with => "'bibtex_paste=' + $('bibtex_paste').value" -%> +<% form_for @publication, :url => { :project_id => @project, :action => :create_from_bibtex }, :builder => TabularFormBuilder do |f| -%> + +
+
+

Paste your bibtex entry

+
+ <%= text_area_tag :bibtex_paste, "Please paste your bibtex entry here" , :class => "wiki", :style => 'width:90%; height:100px;' -%> +
+ <%= link_to_remote "Parse BiBTeX", :url => { :project_id => @project, :action => :parse_bibtex}, :with => "'bibtex_paste=' + $('bibtex_paste').value" -%> +
-
-
-

Preview and correct

+
+

Preview and correct

-

Preview

-

Authors

-
\ No newline at end of file +

Preview

+

Authors

+
+ + <%= f.submit %> + +<%- end -%>