Fix url encode and rescue in duration
This commit is contained in:
parent
f93b778abd
commit
120ee02f0c
|
@ -17,7 +17,7 @@ class Admin::DiplomasController < OrbitMemberController
|
|||
@member = MemberProfile.find(diploma_params['member_profile_id']) rescue nil
|
||||
@diploma = Diploma.new(diploma_params)
|
||||
@diploma.save
|
||||
redirect_to '/admin/members/'+@member.to_param+'/Diploma'
|
||||
redirect_to URI.encode('/admin/members/'+@member.to_param+'/Diploma')
|
||||
end
|
||||
|
||||
def edit
|
||||
|
@ -30,7 +30,7 @@ class Admin::DiplomasController < OrbitMemberController
|
|||
@diploma = Diploma.find(params[:id])
|
||||
@diploma.update_attributes(diploma_params)
|
||||
@diploma.save
|
||||
redirect_to '/admin/members/'+@member.to_param+'/Diploma'
|
||||
redirect_to URI.encode('/admin/members/'+@member.to_param+'/Diploma')
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
@ -66,7 +66,7 @@ class Admin::DiplomasController < OrbitMemberController
|
|||
@intro = @intro.nil? ? DiplomaIntro.new({:member_profile_id=>@member.id}) : @intro
|
||||
@intro.update_attributes(intro_params)
|
||||
@intro.save
|
||||
redirect_to '/admin/members/'+@member.to_param+'/Diploma'
|
||||
redirect_to URI.encode('/admin/members/'+@member.to_param+'/Diploma')
|
||||
end
|
||||
|
||||
def get_settings
|
||||
|
|
|
@ -26,7 +26,11 @@ class Diploma
|
|||
before_validation :add_http
|
||||
|
||||
def duration
|
||||
self.start_date.strftime('%Y.%m')+' ~ '+self.end_date.strftime('%Y.%m')
|
||||
if !self.start_date.nil? or !self.end_date.nil?
|
||||
(self.start_date.strftime('%Y.%m') rescue "")+' ~ '+(self.end_date.strftime('%Y.%m') rescue "")
|
||||
else
|
||||
""
|
||||
end
|
||||
end
|
||||
|
||||
def slug_title
|
||||
|
|
Loading…
Reference in New Issue