Project

General

Profile

Download (925 Bytes) Statistics
| Branch: | Tag: | Revision:

foreman_docker / app / controllers / registries_controller.rb @ ada932ab

1
class RegistriesController < ::ApplicationController
2
  include Foreman::Controller::AutoCompleteSearch
3
  before_filter :find_registry, :only => [:edit, :update, :destroy]
4

    
5
  def index
6
    @registries = DockerRegistry.search_for(params[:search], :order => params[:order])
7
      .paginate :page => params[:page]
8
  end
9

    
10
  def new
11
    @registry = DockerRegistry.new
12
  end
13

    
14
  def create
15
    @registry = DockerRegistry.new(params[:docker_registry])
16
    if @registry.save
17
      process_success
18
    else
19
      process_error
20
    end
21
  end
22

    
23
  def edit
24
  end
25

    
26
  def update
27
    if @registry.update_attributes(params[:docker_registry])
28
      process_success
29
    else
30
      process_error
31
    end
32
  end
33

    
34
  def destroy
35
    if @registry.destroy
36
      process_success
37
    else
38
      process_error
39
    end
40
  end
41

    
42
  def find_registry
43
    @registry = DockerRegistry.find(params[:id])
44
  rescue ActiveRecord::RecordNotFound
45
    not_found
46
  end
47
end