From 5694ed3b7ffa0f27f841f9e90df59c163d5dfbde Mon Sep 17 00:00:00 2001 From: JiangRu Date: Wed, 10 Dec 2014 10:40:45 +0800 Subject: [PATCH] desktop fix edit and delete --- app/controllers/admin/experiences_controller.rb | 7 ++++++- app/views/admin/experiences/edit.html.erb | 2 +- app/views/plugin/personal_experience/_profile.html.erb | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/controllers/admin/experiences_controller.rb b/app/controllers/admin/experiences_controller.rb index 1480fce..5e2a30c 100644 --- a/app/controllers/admin/experiences_controller.rb +++ b/app/controllers/admin/experiences_controller.rb @@ -2,7 +2,8 @@ class Admin::ExperiencesController < OrbitMemberController layout "member_plugin" 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 :get_settings,:only => [:new, :edit, :setting] @@ -113,6 +114,10 @@ class Admin::ExperiencesController < OrbitMemberController @experience = Experience.find_by(:uid => uid) rescue Experience.find("53c4fd3548345219f04c0000") end + def find_experience + @experience = Experience.find_by(id: params[:id]) + end + def experience_params params.require(:experience).permit! rescue nil end diff --git a/app/views/admin/experiences/edit.html.erb b/app/views/admin/experiences/edit.html.erb index 154e5b7..f76b66d 100644 --- a/app/views/admin/experiences/edit.html.erb +++ b/app/views/admin/experiences/edit.html.erb @@ -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| %>
<%= render partial: 'form', locals: {f: f} %>
diff --git a/app/views/plugin/personal_experience/_profile.html.erb b/app/views/plugin/personal_experience/_profile.html.erb index 938b0e3..2a2d5b9 100644 --- a/app/views/plugin/personal_experience/_profile.html.erb +++ b/app/views/plugin/personal_experience/_profile.html.erb @@ -48,7 +48,7 @@