Project

General

Profile

Download (942 Bytes) Statistics
| Branch: | Tag: | Revision:
6e50fa1d Ohad Levy
class EnvironmentsController < ApplicationController
1c4e9d45 Ohad Levy
include Foreman::Controller::Environments
8104eced Ohad Levy
include Foreman::Controller::AutoCompleteSearch
bee8f73b Ohad Levy
32f72fd6 Joseph Mitchell Magen
before_filter :find_by_name, :only => %w{edit update destroy}
0c96d0bf Ohad Levy
5f6b2196 Paul Kelly
def index
acfbc458 Marek Hulan
@environments = resource_base.search_for(params[:search], :order => params[:order]).paginate(:page => params[:page])
145db863 Dmitri Dolguikh
@host_counter = Host.group(:environment_id).where(:environment_id => @environments.select(&:id)).count
5f6b2196 Paul Kelly
end

def new
@environment = Environment.new
end

def create
@environment = Environment.new(params[:environment])
if @environment.save
b28fdce4 Ohad Levy
process_success
5f6b2196 Paul Kelly
else
b28fdce4 Ohad Levy
process_error
5f6b2196 Paul Kelly
end
end

def edit
end
392a9112 Paul Kelly
5f6b2196 Paul Kelly
def update
if @environment.update_attributes(params[:environment])
b28fdce4 Ohad Levy
process_success
5f6b2196 Paul Kelly
else
b28fdce4 Ohad Levy
process_error
5f6b2196 Paul Kelly
end
6e50fa1d Ohad Levy
end
5f6b2196 Paul Kelly
def destroy
if @environment.destroy
b28fdce4 Ohad Levy
process_success
5f6b2196 Paul Kelly
else
b28fdce4 Ohad Levy
process_error
5f6b2196 Paul Kelly
end
end

6e50fa1d Ohad Levy
end