123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
- class NetworksController < ApplicationController
- before_filter :authentication_check
- # GET /networks
- # GET /networks.json
- def index
- @networks = Network.all
- respond_to do |format|
- format.html # index.html.erb
- format.json { render :json => @networks }
- end
- end
- # GET /networks/1
- # GET /networks/1.json
- def show
- @network = Network.find(params[:id])
- respond_to do |format|
- format.html # show.html.erb
- format.json { render :json => @network }
- end
- end
- # GET /networks/new
- # GET /networks/new.json
- def new
- @network = Network.new
- respond_to do |format|
- format.html # new.html.erb
- format.json { render :json => @network }
- end
- end
- # GET /networks/1/edit
- def edit
- @network = Network.find(params[:id])
- end
- # POST /networks
- # POST /networks.json
- def create
- @network = Network.new(params[:network])
- respond_to do |format|
- if @network.save
- format.html { redirect_to @network, :notice => 'Network was successfully created.' }
- format.json { render :json => @network, :status => :created }
- else
- format.html { render :action => "new" }
- format.json { render :json => @network.errors, :status => :unprocessable_entity }
- end
- end
- end
- # PUT /networks/1
- # PUT /networks/1.json
- def update
- @network = Network.find(params[:id])
- respond_to do |format|
- if @network.update_attributes(params[:network])
- format.html { redirect_to @network, :notice => 'Network was successfully updated.' }
- format.json { render :json => @network, :status => :ok }
- else
- format.html { render :action => "edit" }
- format.json { render :json => @network.errors, :status => :unprocessable_entity }
- end
- end
- end
- # DELETE /networks/1
- # DELETE /networks/1.json
- def destroy
- @network = Network.find(params[:id])
- @network.destroy
- respond_to do |format|
- format.html { redirect_to networks_url }
- format.json { head :ok }
- end
- end
- end
|