# HG changeset patch # User luisf # Date 1316182463 -3600 # Node ID b1debf464389d8ff761a06039e95d718b00bbdf8 # Parent 4481db876cdb98476e4cf3ff21655ff575cba98f Validates the presence of at least one author diff -r 4481db876cdb -r b1debf464389 vendor/plugins/redmine_bibliography/app/models/authorship.rb --- a/vendor/plugins/redmine_bibliography/app/models/authorship.rb Fri Sep 16 14:37:24 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/models/authorship.rb Fri Sep 16 15:14:23 2011 +0100 @@ -6,6 +6,8 @@ accepts_nested_attributes_for :author accepts_nested_attributes_for :publication + + validates_presence_of :name_on_paper attr_accessor :is_user, :author_user_id, :search_name, :identify_author, :search_results before_save :associate_author_user diff -r 4481db876cdb -r b1debf464389 vendor/plugins/redmine_bibliography/app/models/publication.rb --- a/vendor/plugins/redmine_bibliography/app/models/publication.rb Fri Sep 16 14:37:24 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/app/models/publication.rb Fri Sep 16 15:14:23 2011 +0100 @@ -9,6 +9,7 @@ has_one :bibtex_entry, :dependent => :destroy validates_presence_of :title + validates_length_of :authorships, :minimum => 1, :message => l("error_no_authors") accepts_nested_attributes_for :authorships accepts_nested_attributes_for :authors, :allow_destroy => true diff -r 4481db876cdb -r b1debf464389 vendor/plugins/redmine_bibliography/config/locales/en.yml --- a/vendor/plugins/redmine_bibliography/config/locales/en.yml Fri Sep 16 14:37:24 2011 +0100 +++ b/vendor/plugins/redmine_bibliography/config/locales/en.yml Fri Sep 16 15:14:23 2011 +0100 @@ -16,6 +16,8 @@ identify_author_correct: "Yes, but I need to correct some details below" identify_author_no: "No, the author was not found in the search" + error_no_authors: "Please add at least one author to this publication." + label_all_publications: All Publications label_all_publications_for_project: Publications associated with %{project} label_authors_show: "Authorships by this author"