Mercurial > hg > soundsoftware-site
changeset 586:658cfb481618 feature_36
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.
author | Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
---|---|
date | Fri, 12 Aug 2011 13:15:05 +0100 |
parents | 5818ebc11362 |
children | 9e866f13c984 |
files | vendor/plugins/redmine_bibliography/app/helpers/publications_helper.rb vendor/plugins/redmine_bibliography/app/models/bibtex_entry.rb vendor/plugins/redmine_bibliography/app/models/bibtex_entry_type.rb vendor/plugins/redmine_bibliography/app/views/publications/_bibtex_fields.html.erb vendor/plugins/redmine_bibliography/config/locales/en.yml vendor/plugins/redmine_bibliography/db/seed_data/bibtex_entry_types_list.txt |
diffstat | 6 files changed, 35 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- 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 << "<h4>" + field[0].titleize + "</h4>" + s << "<h4>" + l("field_#{field[0]}") + "</h4>" 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
--- 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
--- 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
--- 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 @@ <p><label for="bibtex_entry_type"><%=l("field_entry_type")%> <span class="required">*</span></label> - <%= 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}) %> </p> <p> <%= f.text_field :year, :size => 4 %>
--- 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
--- 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