Project

General

Profile

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

foreman-docker / app / controllers / registries_controller.rb @ 9d5ef1c9

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

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

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

    
15
  def create
16
    @registry = DockerRegistry.new(docker_registry_params)
17
    if @registry.save
18
      process_success
19
    else
20
      process_error
21
    end
22
  end
23

    
24
  def edit
25
  end
26

    
27
  def update
28
    if @registry.update_attributes(docker_registry_params)
29
      process_success
30
    else
31
      process_error
32
    end
33
  end
34

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

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