forked from saurabh/orbit4-5
fixed delete in member info
This commit is contained in:
parent
8657977cd7
commit
65c87ce778
|
@ -21,7 +21,7 @@ class Admin::MemberInfosController < OrbitMemberController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@attribute = MemberInfo.new(info_params)
|
@attribute = MemberInfo.new(member_info_params)
|
||||||
@attribute.save
|
@attribute.save
|
||||||
|
|
||||||
redirect_to action: :index
|
redirect_to action: :index
|
||||||
|
@ -38,7 +38,7 @@ class Admin::MemberInfosController < OrbitMemberController
|
||||||
format.js { render 'admin/member_infos/add_attribute_field' }
|
format.js { render 'admin/member_infos/add_attribute_field' }
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@attribute.update_attributes(info_params)
|
@attribute.update_attributes(member_info_params)
|
||||||
@attribute.member_profile_fields.each{|t| t.destroy if t["to_delete"] == true}
|
@attribute.member_profile_fields.each{|t| t.destroy if t["to_delete"] == true}
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to(admin_member_infos_path) }
|
format.html { redirect_to(admin_member_infos_path) }
|
||||||
|
@ -49,7 +49,10 @@ class Admin::MemberInfosController < OrbitMemberController
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@attribute.destroy
|
@attribute.destroy
|
||||||
redirect_to action: :index
|
respond_to do |format|
|
||||||
|
format.html { redirect_to admin_member_infos_path }
|
||||||
|
format.js { render 'admin/member_infos/destroy' }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -59,6 +62,10 @@ private
|
||||||
end
|
end
|
||||||
|
|
||||||
def info_params
|
def info_params
|
||||||
|
params.require(:info).permit!
|
||||||
|
end
|
||||||
|
|
||||||
|
def member_info_params
|
||||||
params.require(:member_info).permit!
|
params.require(:member_info).permit!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
<%= Rails.logger.info"@@@@@"+attribute.inspect %>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= attribute.key %></td>
|
<td><%= attribute.key %></td>
|
||||||
|
@ -6,7 +7,7 @@
|
||||||
<div class="quick-edit">
|
<div class="quick-edit">
|
||||||
<ul class="nav nav-pills">
|
<ul class="nav nav-pills">
|
||||||
<%= content_tag(:li, link_to(t(:add_attribute_field),edit_admin_member_info_path(attribute))) if current_user.is_admin? %>
|
<%= content_tag(:li, link_to(t(:add_attribute_field),edit_admin_member_info_path(attribute))) if current_user.is_admin? %>
|
||||||
<%= content_tag(:li, link_to(t(:delete_),admin_member_info_path(attribute, :at=>params[:at]), :confirm => t(:sure?), :method => :delete, :class=>"text-error", :remote => true)) if current_user.is_admin? %>
|
<%= content_tag(:li, link_to(t(:delete_),admin_member_info_path(attribute), data: { confirm: t('sure?') }, method: :delete, class: "text-error", remote: true)) if current_user.is_admin? %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
$("#<%= dom_id @attribute %>").remove();
|
||||||
|
$(window.location.replace("<%= admin_member_infos_path %>"))
|
Loading…
Reference in New Issue