Sha256: 42fbaf083d53af29b1150a241258f7e63b8e7ac3ed176e1f7bb3d738046d7655

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 KB

Contents

class DomainsController < ApplicationController
  include Foreman::Controller::AutoCompleteSearch
  before_filter :find_by_name, :only => %w{show edit update destroy}

  def index
    values = Domain.search_for(params[:search], :order => params[:order])
    respond_to do |format|
      format.html do
        @domains = values.paginate :page => params[:page]
        @counter = Host.count(:group => :domain_id, :conditions => {:domain_id => @domains.all})
      end
      format.json { render :json => values }
    end
  end

  def new
    @domain = Domain.new
    @domain.domain_parameters.build
  end

  def show
    respond_to do |format|
      format.json { render :json => @domain }
    end
  end

  def create
    @domain = Domain.new(params[:domain])
    if @domain.save
      process_success
    else
      process_error
    end
  end

  def edit
  end

  def update
    if @domain.update_attributes(params[:domain])
      process_success
    else
      process_error
    end
  end

  def destroy
    if @domain.destroy
      process_success
    else
      process_error
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman_discovery-1.0.0 test/foreman_app/app/controllers/domains_controller.rb
foreman_discovery-1.0.0.rc4 test/foreman_app/app/controllers/domains_controller.rb
foreman_discovery-1.0.0.rc3 test/foreman_app/app/controllers/domains_controller.rb
foreman_discovery-1.0.0.rc2 test/foreman_app/app/controllers/domains_controller.rb
foreman_discovery-1.0.0.rc1 test/foreman_app/app/controllers/domains_controller.rb