fix journal paper new errors

This commit is contained in:
Saurabh Bhatia 2014-07-10 17:25:26 +08:00
parent adea371161
commit 5992be0d19
3 changed files with 9 additions and 7 deletions

View File

@ -45,8 +45,8 @@ class Admin::JournalPapersController < OrbitMemberController
format.html { redirect_to admin_journal_papers_path } format.html { redirect_to admin_journal_papers_path }
format.xml { render :xml => @journal_paper, :status => :created, :location => @journal_paper } format.xml { render :xml => @journal_paper, :status => :created, :location => @journal_paper }
else else
format.html { render action: "new" } format.html { render action: 'new' }
format.xml { render :xml => @journal_paper.errors, :status => :unprocessable_entity } format.json { render json: @extension.errors, status: :unprocessable_entity }
end end
end end
end end
@ -61,7 +61,7 @@ class Admin::JournalPapersController < OrbitMemberController
format.xml { head :ok } format.xml { head :ok }
else else
format.html { render action: "edit" } 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 end
end end

View File

@ -47,7 +47,7 @@ class JournalPaper
title = [] title = []
title << self.member_profile.name if self.member_profile_id.present? 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? if !self.publication_date.nil?
pd = self.publication_date.strftime("%Y-%m-%d").split('-') pd = self.publication_date.strftime("%Y-%m-%d").split('-')
title << pd[0] title << pd[0]
@ -58,13 +58,13 @@ class JournalPaper
title << self.issue_no if (self.issue_no.present? && self.issue_no != "0") 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 << "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 << ( !self.journal_levels.blank? ? "(#{self.journal_levels.collect{|x| x.title}.join(', ')})" : nil)
title.join(', ') title.join(', ')
end end
def authors def authors
authors = [] authors = []
authors << self.member_profile.name if self.member_profile_id.present? 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(', ') authors.join(', ')
end end

View File

@ -13,7 +13,9 @@
<%= javascript_include_tag "lib/datetimepicker/date.time.picker.js" %> <%= javascript_include_tag "lib/datetimepicker/date.time.picker.js" %>
<%= javascript_include_tag "lib/datetimepicker/datetimepicker" %> <%= javascript_include_tag "lib/datetimepicker/datetimepicker" %>
<% end %> <% end %>
<div class="form-group has-error">
<center><%= @journal_paper.errors.full_messages.first if @journal_paper.errors.any? %></center>
</div>
<!-- Input Area --> <!-- Input Area -->
<div class="input-area"> <div class="input-area">