orbit-personalproject/app/controllers/panel/personal_project/desktop/plugin_intros_controller.rb

32 lines
875 B
Ruby

class Panel::PersonalProject::Desktop::PluginIntrosController < ApplicationController
def index
@intro = PersonalProjectIntro.where(:user_id => current_user.id.to_s).first
if @intro.blank?
@intro = PersonalProjectIntro.new
render "new", :layout => false
else
render "edit", :layout => false
end
end
def create
@intro = PersonalProjectIntro.new(params[:personal_project_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 = PersonalProjectIntro.find(params[:id])
if @intro.update_attributes(params[:personal_project_intro])
render :json => {"success" => true}.to_json
else
render :json => {"success" => false}.to_json
end
end
end