class Panel::PersonalLab::Desktop::PluginIntrosController < ApplicationController

  def index 
    @intro = PersonalLabIntro.where(:user_id => current_user.id.to_s).first
    if @intro.blank?
      @intro = PersonalLabIntro.new
      render "new", :layout => false
    else
      render "edit", :layout => false
    end
  end

  def create
     @intro = PersonalLabIntro.new(params[:personal_lab_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 = PersonalLabIntro.find(params[:id])
    if @intro.update_attributes(params[:personal_lab_intro])
      render :json => {"success" => true}.to_json
    else
      render :json => {"success" => false}.to_json
    end
  end

end