# HG changeset patch
# User luisf
# Date 1301934017 -3600
# Node ID 4be6b16bc6f95ba91d759081fc0c900cf78dc6ab
# Parent ad71d0604ac2f1fd6cd9be932028a9b59d189f1e
DEV commit: beginning of bibtex parser integration.
diff -r ad71d0604ac2 -r 4be6b16bc6f9 vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb
--- a/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Thu Mar 31 18:59:07 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb Mon Apr 04 17:20:17 2011 +0100
@@ -1,21 +1,52 @@
class PublicationsController < ApplicationController
+ def parse_bibtex_text
+
+ logger.error "BBBBBBBB"
+
+ bibtex_entry = params[:bibtex_entry]
+
+
+
+
+ # logger.error bibtex_entry
+
+ if bibtex_entry
+ Bibtex::Parser.parse_string(bibtex_entry).map do |entry|
+ logger.error entry[:title]
+ logger.error entry[:year]
+ logger.error entry.type
+ end
+ end
+
+ logger.error "FIM"
+
+ end
+
def new
-
- @publication = Publication.new(params[:publication])
-
- if @publication.save
- logger.error "GRAVOU XXXdsfgXXX"
- else
- logger.error "nao gravou"
+
+ logger.error "AAAAAA"
+
+ logger.error request.request_method
+
+ if request.post?
+ parse_bibtex_text
+ @publication = Publication.new(params[:publication])
+
+ if @publication.save
+ logger.error "GRAVOU XXXdsfgXXX"
+ else
+ logger.error "nao gravou"
+ end
+
end
-
+
end
def create
-
+
logger.error "AAAA create"
-
+
@publication.save
end
@@ -24,13 +55,13 @@
end
def edit
- logger.error "AAAA edit"
+ logger.error "AAAA edit"
end
def update
-
- logger.error "AAAA update"
+
+ logger.error "AAAA update"
end
diff -r ad71d0604ac2 -r 4be6b16bc6f9 vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb
--- a/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb Thu Mar 31 18:59:07 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb Mon Apr 04 17:20:17 2011 +0100
@@ -1,2 +1,6 @@
+require 'rubygems'
+require 'bibtex'
+
module PublicationsHelper
+
end
diff -r ad71d0604ac2 -r 4be6b16bc6f9 vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb
--- a/vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb Thu Mar 31 18:59:07 2011 +0100
+++ b/vendor/plugins/redmine_bibliography/app/views/publications/new.html.erb Mon Apr 04 17:20:17 2011 +0100
@@ -8,6 +8,14 @@
<%= f.text_field :title %>
+
+
+
+ <%=label_tag :bibtex_entry %>
+ <%=text_area_tag :bibtex_entry%>
+
+
+
<%= submit_tag l(:button_submit) %>
<% end %>