# HG changeset patch # User Chris Cannam # Date 1313151305 -3600 # Node ID 658cfb4816182a643eb0f6e7e027193a4dd8e957 # Parent 5818ebc113622e72fa39ad02e91ca21c63d0c9c5 Order BibTeX entry types in a sensible order for presentation to user, instead of alphabetically by BibTeX name as previously (requires database re-seed). Provide a label for each entry type, and use it in the edit dropdown and show page. Omit duplicate entry type (conference) from edit dropdown. Use existing entry attribute labels in show_bibtex_fields. diff -r 5818ebc11362 -r 658cfb481618 vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb --- a/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb Fri Aug 12 12:07:22 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb Fri Aug 12 13:15:05 2011 +0100 @@ -106,10 +106,10 @@ bibtex_entry.attributes.each do |field| if field[1] != nil - s << "

" + field[0].titleize + "

" + s << "

" + l("field_#{field[0]}") + "

" if field[0] == "entry_type" - s << bibtex_entry.entry_type_name.capitalize + s << bibtex_entry.entry_type_label else s << bibtex_entry.attributes[field[0]].to_s end diff -r 5818ebc11362 -r 658cfb481618 vendor/plugins/redmine_bibliography/app/models/bibtex_entry.rb --- a/vendor/plugins/redmine_bibliography/app/models/bibtex_entry.rb Fri Aug 12 12:07:22 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/models/bibtex_entry.rb Fri Aug 12 13:15:05 2011 +0100 @@ -9,6 +9,9 @@ BibtexEntryType.find(entry_type).name end - + def entry_type_label + entry_type = self.entry_type + BibtexEntryType.find(entry_type).label + end end diff -r 5818ebc11362 -r 658cfb481618 vendor/plugins/redmine_bibliography/app/models/bibtex_entry_type.rb --- a/vendor/plugins/redmine_bibliography/app/models/bibtex_entry_type.rb Fri Aug 12 12:07:22 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/models/bibtex_entry_type.rb Fri Aug 12 13:15:05 2011 +0100 @@ -1,2 +1,8 @@ class BibtexEntryType < ActiveRecord::Base + def redundant? + name == 'conference' # conference is a duplicate of inproceedings + end + def label + l("field_bibtex_#{name}") + end end diff -r 5818ebc11362 -r 658cfb481618 vendor/plugins/redmine_bibliography/app/views/publications/_bibtex_fields.html.erb --- a/vendor/plugins/redmine_bibliography/app/views/publications/_bibtex_fields.html.erb Fri Aug 12 12:07:22 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/views/publications/_bibtex_fields.html.erb Fri Aug 12 13:15:05 2011 +0100 @@ -1,6 +1,6 @@

- <%= f.collection_select(:entry_type, BibtexEntryType.find(:all), :id, :name, {:selected => @selected_bibtex_entry_type_id, :prompt => true}) %> + <%= f.collection_select(:entry_type, BibtexEntryType.find(:all).reject { |x| x.redundant? }, :id, :label, {:selected => @selected_bibtex_entry_type_id, :prompt => true}) %>

<%= f.text_field :year, :size => 4 %> diff -r 5818ebc11362 -r 658cfb481618 vendor/plugins/redmine_bibliography/config/locales/en.yml --- a/vendor/plugins/redmine_bibliography/config/locales/en.yml Fri Aug 12 12:07:22 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/config/locales/en.yml Fri Aug 12 13:15:05 2011 +0100 @@ -76,6 +76,21 @@ field_url: "URL" field_volume: "Volume" field_year: "Year" + + field_bibtex_article: Journal article + field_bibtex_book: Book + field_bibtex_booklet: Booklet + field_bibtex_conference: Article in conference proceedings + field_bibtex_inbook: Book chapter or part + field_bibtex_incollection: Part of a collection + field_bibtex_inproceedings: Article in conference proceedings + field_bibtex_manual: Technical manual + field_bibtex_masterthesis: "Master's thesis" + field_bibtex_misc: Other + field_bibtex_phdthesis: "PhD thesis" + field_bibtex_proceedings: Conference proceedings + field_bibtex_techreport: Technical report + field_bibtex_unpublished: Unpublished label_author_1: First author label_author_2: Second author diff -r 5818ebc11362 -r 658cfb481618 vendor/plugins/redmine_bibliography/db/seed_data/bibtex_entry_types_list.txt --- a/vendor/plugins/redmine_bibliography/db/seed_data/bibtex_entry_types_list.txt Fri Aug 12 12:07:22 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/db/seed_data/bibtex_entry_types_list.txt Fri Aug 12 13:15:05 2011 +0100 @@ -1,14 +1,14 @@ +inproceedings +conference article +masterthesis +phdthesis book booklet -conference inbook incollection -inproceedings manual -masterthesis +techreport +proceedings +unpublished misc -phdthesis -proceedings -techreport -unpublished