84 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Ruby
		
	
	
	
			
		
		
	
	
			84 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Ruby
		
	
	
	
class Admin::PersonalPluginIntrosController < OrbitMemberController
 | 
						|
     
 | 
						|
  include OrbitControllerLib::DivisionForDisable
 | 
						|
  
 | 
						|
  before_filter :authenticate_user!
 | 
						|
  before_filter :is_admin?
 | 
						|
 | 
						|
  
 | 
						|
  def index
 | 
						|
 | 
						|
    get_types
 | 
						|
    @plugin_intro = @types.where(:user_id => params[:user_id]).first
 | 
						|
 | 
						|
    if @plugin_intro.blank?
 | 
						|
 | 
						|
      @set_type = @types.new()
 | 
						|
      @url = eval("panel_#{@app_type_name}_back_end_#{@app_type}s_path(:user_id=>params[:user_id])")
 | 
						|
      @verb = :post
 | 
						|
 | 
						|
    else
 | 
						|
 | 
						|
      @set_type = @types.find(@plugin_intro.id)
 | 
						|
      @url = polymorphic_path(["panel_#{@app_type_name}_back_end", @plugin_intro])
 | 
						|
      @verb = :put
 | 
						|
 | 
						|
    end
 | 
						|
 | 
						|
  end
 | 
						|
 | 
						|
 | 
						|
  def show
 | 
						|
 | 
						|
  end
 | 
						|
 | 
						|
 | 
						|
  def new
 | 
						|
  end
 | 
						|
  
 | 
						|
 | 
						|
  def edit
 | 
						|
  end
 | 
						|
 | 
						|
  def create
 | 
						|
    
 | 
						|
	  get_types
 | 
						|
	
 | 
						|
    @plugin_intro = @types.new(params[:plugin_intro]) 
 | 
						|
 | 
						|
    respond_to do |format|
 | 
						|
      if @plugin_intro.save
 | 
						|
        format.html { redirect_to(admin_users_new_interface_url(:id=>params[:plugin_intro][:user_id],:show_plugin_profile=>@reback_name)) }
 | 
						|
      end
 | 
						|
    end
 | 
						|
 | 
						|
  end
 | 
						|
 | 
						|
 | 
						|
  def update
 | 
						|
  
 | 
						|
	  get_types
 | 
						|
	
 | 
						|
    @plugin_intro = @types.find(params[:id]) 
 | 
						|
 | 
						|
    respond_to do |format|
 | 
						|
          
 | 
						|
      if @plugin_intro.update_attributes(params[:plugin_intro])
 | 
						|
        format.html { redirect_to(admin_users_new_interface_url(:id=>params[:plugin_intro][:user_id],:show_plugin_profile=>@reback_name)) }
 | 
						|
      end
 | 
						|
    end
 | 
						|
 | 
						|
  end
 | 
						|
 | 
						|
 | 
						|
  def destroy
 | 
						|
  end
 | 
						|
  
 | 
						|
  protected
 | 
						|
  
 | 
						|
  def get_types
 | 
						|
    @types = @app_type.classify.constantize
 | 
						|
  end
 | 
						|
  
 | 
						|
end
 |