To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / vendor / plugins / redmine_bibliography / app / controllers / publications_controller.rb @ 391:fecd4b2f4b77

History | View | Annotate | Download (1.37 KB)

1 385:a6f8c0584a92 luis
# vendor/plugins/redmine_bibliography/app/controllers/publications_controller.rb
2
3 328:aed18b463206 luis
class PublicationsController < ApplicationController
4
5 385:a6f8c0584a92 luis
  # parse string with bibtex authors
6
  # return an ordered array
7
  def parse_authors
8
9
  end
10
11
  def parse_bibtex_file
12
13
  end
14
15 384:4be6b16bc6f9 luis
  def parse_bibtex_text
16
    bibtex_entry = params[:bibtex_entry]
17
18 385:a6f8c0584a92 luis
    if bibtex_entry
19
      bib = BibTeX.parse bibtex_entry
20
21
      # parses the bibtex entries
22
      bib.data.map do |d|
23
        result = ''
24
        if d.class == BibTeX::Entry
25
          #    d.replace!(bib.strings)
26 391:fecd4b2f4b77 luis
27
          result = [author, '. ', d.title].join
28 385:a6f8c0584a92 luis
        end
29 391:fecd4b2f4b77 luis
      end
30 384:4be6b16bc6f9 luis
31
    end
32
  end
33
34 385:a6f8c0584a92 luis
  def new
35
    @publication = Publication.new
36 386:8ed0a0a268e0 luis
    @publication.current_step = session[:publication_step]
37 391:fecd4b2f4b77 luis
38 328:aed18b463206 luis
  end
39
40 390:5562a95edbf7 luis
  def create
41
    @publication = Publication.new(params[:publication])
42 391:fecd4b2f4b77 luis
    @publication.current_step = session[:publication_step]
43 384:4be6b16bc6f9 luis
44 391:fecd4b2f4b77 luis
    parse_bibtex_text
45 384:4be6b16bc6f9 luis
46 390:5562a95edbf7 luis
    if params[:back_button]
47
      @publication.previous_step
48
    else
49
      @publication.next_step
50
    end
51
52
    session[:publication_step] = @publication.current_step
53
54
    render "new"
55 329:4575b631f6ce luis
  end
56
57
  def index
58
    @publications = Publication.find(:all)
59 328:aed18b463206 luis
  end
60
61
  def edit
62 384:4be6b16bc6f9 luis
    logger.error "AAAA edit"
63 376:ad71d0604ac2 luis
64 328:aed18b463206 luis
  end
65
66
  def update
67 384:4be6b16bc6f9 luis
68
    logger.error "AAAA update"
69 376:ad71d0604ac2 luis
70
71 328:aed18b463206 luis
  end
72 329:4575b631f6ce luis
73
  def show
74
    @publication = Publication.find(params[id])
75
    @authors = @publication.authors
76
  end
77
78
79 328:aed18b463206 luis
end