diff --git a/app/controllers/admin/journal_papers_controller.rb b/app/controllers/admin/journal_papers_controller.rb index 4c299ad..380400b 100644 --- a/app/controllers/admin/journal_papers_controller.rb +++ b/app/controllers/admin/journal_papers_controller.rb @@ -45,8 +45,8 @@ class Admin::JournalPapersController < OrbitMemberController format.html { redirect_to admin_journal_papers_path } format.xml { render :xml => @journal_paper, :status => :created, :location => @journal_paper } else - format.html { render action: "new" } - format.xml { render :xml => @journal_paper.errors, :status => :unprocessable_entity } + format.html { render action: 'new' } + format.json { render json: @extension.errors, status: :unprocessable_entity } end end end @@ -61,7 +61,7 @@ class Admin::JournalPapersController < OrbitMemberController format.xml { head :ok } else format.html { render action: "edit" } - format.xml { render :xml => @journal_paper.errors, :status => :unprocessable_entity } + format.json { render json: @extension.errors, status: :unprocessable_entity } end end end diff --git a/app/models/journal_paper.rb b/app/models/journal_paper.rb index bc7f981..08cd54c 100644 --- a/app/models/journal_paper.rb +++ b/app/models/journal_paper.rb @@ -47,7 +47,7 @@ class JournalPaper title = [] title << self.member_profile.name if self.member_profile_id.present? - title << (!self.journal_levels.blank? ? "#{self.journal_paper_authors.collect{|j| j.name}.join(', ')}" : nil) + title << (!self.journal_paper_authors.blank? ? "#{self.journal_paper_authors.collect{|j| j.name}.join(', ')}" : nil) if !self.publication_date.nil? pd = self.publication_date.strftime("%Y-%m-%d").split('-') title << pd[0] @@ -58,13 +58,13 @@ class JournalPaper title << self.issue_no if (self.issue_no.present? && self.issue_no != "0") title << "pp"+self.form_to_start+"-"+self.form_to_end if (self.form_to_start.present? && self.form_to_start != "0") title << ( !self.journal_levels.blank? ? "(#{self.journal_levels.collect{|x| x.title}.join(', ')})" : nil) - title.join(', ') + title.join(', ') end def authors authors = [] authors << self.member_profile.name if self.member_profile_id.present? - authors << (!self.journal_levels.blank? ? "#{self.journal_paper_authors.collect{|j| j.name}.join(', ')}" : nil) + authors << (!self.journal_paper_authors.blank? ? "#{self.journal_paper_authors.collect{|j| j.name}.join(', ')}" : nil) authors.join(', ') end diff --git a/app/views/admin/journal_papers/_form.html.erb b/app/views/admin/journal_papers/_form.html.erb index fee5018..7f4f119 100644 --- a/app/views/admin/journal_papers/_form.html.erb +++ b/app/views/admin/journal_papers/_form.html.erb @@ -13,7 +13,9 @@ <%= javascript_include_tag "lib/datetimepicker/date.time.picker.js" %> <%= javascript_include_tag "lib/datetimepicker/datetimepicker" %> <% end %> - +
+
<%= @journal_paper.errors.full_messages.first if @journal_paper.errors.any? %>
+