Skip to content
This repository
tree: 226cc2a597
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 73 lines (59 sloc) 1.566 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
# coding: UTF-8
class Cpanel::SiteNodesController < Cpanel::ApplicationController

  def index
    @site_nodes = SiteNode.desc('_id').paginate(:page => params[:page], :per_page => 20)

    respond_to do |format|
      format.html # index.html.erb
      format.json
    end
  end

  def show
    @site_node = SiteNode.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.json
    end
  end

  def new
    @site_node = SiteNode.new

    respond_to do |format|
      format.html # new.html.erb
      format.json
    end
  end

  def edit
    @site_node = SiteNode.find(params[:id])
  end

  def create
    @site_node = SiteNode.new(params[:site_node])

    respond_to do |format|
      if @site_node.save
        format.html { redirect_to(cpanel_site_nodes_path, :notice => 'Site node 创建成功。') }
        format.json
      else
        format.html { render :action => "new" }
        format.json
      end
    end
  end

  def update
    @site_node = SiteNode.find(params[:id])

    respond_to do |format|
      if @site_node.update_attributes(params[:site_node])
        format.html { redirect_to(cpanel_site_nodes_path, :notice => 'Site node 更新成功。') }
        format.json
      else
        format.html { render :action => "edit" }
        format.json
      end
    end
  end

  def destroy
    @site_node = SiteNode.find(params[:id])
    @site_node.destroy

    respond_to do |format|
      format.html { redirect_to(cpanel_site_nodes_path,:notice => "删除成功。") }
      format.json
    end
  end
end
Something went wrong with that request. Please try again.