desktop fix edit and delete

This commit is contained in:
JiangRu 2014-12-10 10:40:45 +08:00
parent 229f561594
commit 5694ed3b7f
3 changed files with 8 additions and 3 deletions

View File

@ -2,7 +2,8 @@ class Admin::ExperiencesController < OrbitMemberController
layout "member_plugin" layout "member_plugin"
include Admin::PersonalExperiencesHelper include Admin::PersonalExperiencesHelper
before_action :set_experience, only: [:show, :edit , :update, :destroy] before_action :set_experience, only: [:show, :edit , :update]
before_action :find_experience, only: [:destroy]
before_action :set_plugin before_action :set_plugin
before_action :get_settings,:only => [:new, :edit, :setting] before_action :get_settings,:only => [:new, :edit, :setting]
@ -113,6 +114,10 @@ class Admin::ExperiencesController < OrbitMemberController
@experience = Experience.find_by(:uid => uid) rescue Experience.find("53c4fd3548345219f04c0000") @experience = Experience.find_by(:uid => uid) rescue Experience.find("53c4fd3548345219f04c0000")
end end
def find_experience
@experience = Experience.find_by(id: params[:id])
end
def experience_params def experience_params
params.require(:experience).permit! rescue nil params.require(:experience).permit! rescue nil
end end

View File

@ -1,4 +1,4 @@
<%= form_for @experience, url:'/admin/experiences/'+@experience.id.to_s, html: {class: "form-horizontal main-forms previewable"} do |f| %> <%= form_for @experience, url: admin_experience_path(@experience), html: {class: "form-horizontal main-forms previewable"} do |f| %>
<fieldset> <fieldset>
<%= render partial: 'form', locals: {f: f} %> <%= render partial: 'form', locals: {f: f} %>
</fieldset> </fieldset>

View File

@ -48,7 +48,7 @@
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills hide"> <ul class="nav nav-pills hide">
<% if has_access? %> <% if has_access? %>
<li><%= link_to t('edit'), '/admin/members/'+@member.to_param+'/experiences/'+experience.id+'/edit' %></li> <li><%= link_to t('edit'), edit_admin_experience_path(experience) %></li>
<li><%= link_to t(:delete_), admin_experience_path(id: experience.id, member_profile_id: @member.id), method: :delete, remote: true, data: { confirm: t('sure?') } %></li> <li><%= link_to t(:delete_), admin_experience_path(id: experience.id, member_profile_id: @member.id), method: :delete, remote: true, data: { confirm: t('sure?') } %></li>
<% end %> <% end %>
</ul> </ul>