add :update action

This commit is contained in:
EricTYL 2020-02-05 15:41:24 +08:00
parent ec4226f1d2
commit 3df0ea1464
1 changed files with 10 additions and 1 deletions

View File

@ -2,7 +2,7 @@ class Admin::ActivitiesController < OrbitMemberController
layout "member_plugin" layout "member_plugin"
#include Admin::PersonalActivitiesHelper #include Admin::PersonalActivitiesHelper
before_action :set_activity, only: [:edit] before_action :set_activity, only: [:edit, :update]
#before_action :set_plugin #before_action :set_plugin
#before_action :need_access_right #before_action :need_access_right
@ -19,6 +19,11 @@ class Admin::ActivitiesController < OrbitMemberController
def edit def edit
end end
def update
@activity.update_attributes(activity_params)
redirect_to params['referer_url']
end
private private
def set_activity def set_activity
@ -32,4 +37,8 @@ class Admin::ActivitiesController < OrbitMemberController
end end
@activity = Activity.find_by(:uid => uid) rescue Activity.find(params[:id]) @activity = Activity.find_by(:uid => uid) rescue Activity.find(params[:id])
end end
def activity_params
params.require(:activity).permit(:activity_name, :activity_organizer, :activity_area, :year, :activity_start_date, :activity_end_date, :note)
end
end end