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
|
||||
|
||||
def create
|
||||
@attribute = MemberInfo.new(info_params)
|
||||
@attribute = MemberInfo.new(member_info_params)
|
||||
@attribute.save
|
||||
|
||||
redirect_to action: :index
|
||||
|
@ -38,7 +38,7 @@ class Admin::MemberInfosController < OrbitMemberController
|
|||
format.js { render 'admin/member_infos/add_attribute_field' }
|
||||
end
|
||||
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}
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(admin_member_infos_path) }
|
||||
|
@ -49,7 +49,10 @@ class Admin::MemberInfosController < OrbitMemberController
|
|||
|
||||
def 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
|
||||
|
||||
private
|
||||
|
@ -59,6 +62,10 @@ private
|
|||
end
|
||||
|
||||
def info_params
|
||||
params.require(:info).permit!
|
||||
end
|
||||
|
||||
def member_info_params
|
||||
params.require(:member_info).permit!
|
||||
end
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<%= Rails.logger.info"@@@@@"+attribute.inspect %>
|
||||
|
||||
<tr>
|
||||
<td><%= attribute.key %></td>
|
||||
|
@ -6,7 +7,7 @@
|
|||
<div class="quick-edit">
|
||||
<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(: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>
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
$("#<%= dom_id @attribute %>").remove();
|
||||
$(window.location.replace("<%= admin_member_infos_path %>"))
|
Loading…
Reference in New Issue