32 lines
861 B
Ruby
32 lines
861 B
Ruby
class Panel::PersonalHonor::Desktop::PluginIntrosController < ApplicationController
|
|
|
|
def index
|
|
@intro = PersonalHonorIntro.where(:user_id => current_user.id.to_s).first
|
|
if @intro.blank?
|
|
@intro = PersonalHonorIntro.new
|
|
render "new", :layout => false
|
|
else
|
|
render "edit", :layout => false
|
|
end
|
|
end
|
|
|
|
def create
|
|
@intro = PersonalHonorIntro.new(params[:personal_honor_intro])
|
|
@intro.user_id = current_user.id
|
|
if @intro.save
|
|
render :json => {"success" => true}.to_json
|
|
else
|
|
render :json => {"success" => false}.to_json
|
|
end
|
|
end
|
|
|
|
def update
|
|
@intro = PersonalHonorIntro.find(params[:id])
|
|
if @intro.update_attributes(params[:personal_honor_intro])
|
|
render :json => {"success" => true}.to_json
|
|
else
|
|
render :json => {"success" => false}.to_json
|
|
end
|
|
end
|
|
|
|
end |