Fix update and delete,Add acquired_date
This commit is contained in:
parent
a1c6f293c1
commit
dd83b8ef70
|
|
@ -31,17 +31,29 @@ class Admin::CertificatesController < OrbitMemberController
|
|||
@intro = @intro.nil? ? CertificateIntro.new({:member_profile_id=>@member.id}) : @intro
|
||||
end
|
||||
|
||||
def destroy
|
||||
@course.destroy
|
||||
redirect_to admin_courses_path(:page => params[:page])
|
||||
end
|
||||
|
||||
def update
|
||||
@course.update_attributes(course_params)
|
||||
@course.save
|
||||
redirect_to params[:referer_url]
|
||||
end
|
||||
def destroy
|
||||
@certificate.destroy
|
||||
respond_to do |format|
|
||||
# 刪除後,直接導向證照的總列表網址
|
||||
format.html { redirect_to(admin_certificates_url) }
|
||||
format.js
|
||||
format.json { render json: { "success" => true } }
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@member = @certificate.member_profile rescue nil
|
||||
# 使用正確的證照參數:certificate_params
|
||||
@certificate.update_attributes(certificate_params)
|
||||
@certificate.save
|
||||
|
||||
if params[:desktop] == "true"
|
||||
render json: { "data" => get_paper_list }.to_json
|
||||
else
|
||||
# 更新成功後,直接跟隨表單帶過來的來源網址返回
|
||||
redirect_to params['referer_url']
|
||||
end
|
||||
end
|
||||
def update_frontend_setting
|
||||
@member = MemberProfile.find(params['member_profile_id']) rescue nil
|
||||
@intro = CertificateIntro.find_by(:member_profile_id=>@member.id) rescue nil
|
||||
|
|
@ -89,4 +101,4 @@ class Admin::CertificatesController < OrbitMemberController
|
|||
end
|
||||
@certificate = Certificate.find_by(:uid => uid) rescue Certificate.find(params[:id])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ class Certificate
|
|||
include Slug
|
||||
|
||||
field :issued_by
|
||||
field :acquired_date, type: Date
|
||||
field :title, as: :slug_title, type: String, localize: true
|
||||
|
||||
belongs_to :member_profile
|
||||
|
|
@ -85,4 +86,4 @@ class Certificate
|
|||
}
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -101,6 +101,14 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- acquired_date -->
|
||||
<div class="control-group big-group">
|
||||
<label class="control-label muted"><%= t("personal_certificate.acquired_date") %></label>
|
||||
<div class="controls">
|
||||
<%= f.datetime_picker :acquired_date, :no_label => true, :format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD", :value => @certificate.acquired_date, :new_record => @certificate.new_record? %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Status Module -->
|
||||
|
|
@ -122,4 +130,4 @@
|
|||
<input type="hidden" name="referer_url" value="<%= request.referer %>">
|
||||
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||
<%= link_to t('cancel'), request.referer, :class=>"btn" %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
$('#certificate_<%= @certificate.id.to_s %>').remove();
|
||||
|
|
@ -5,5 +5,6 @@ en:
|
|||
certificate: Certificate
|
||||
personal_certificate:
|
||||
issued_by: Issued By
|
||||
acquired_date: Acquired date
|
||||
certificate: Certificate
|
||||
title: Certificate
|
||||
title: Certificate
|
||||
|
|
|
|||
|
|
@ -5,5 +5,6 @@ zh_tw:
|
|||
certificate: 證照
|
||||
personal_certificate:
|
||||
issued_by: 發照單位
|
||||
acquired_date: 取得日期
|
||||
certificate: 證照名稱
|
||||
title: 證照名稱
|
||||
title: 證照名稱
|
||||
|
|
|
|||
Loading…
Reference in New Issue