Project

General

Profile

Download (1.03 KB) Statistics
| Branch: | Tag: | Revision:

foreman_docker / app / controllers / registries_controller.rb @ 401c0065

1 ada932ab Dmitri Dolguikh
class RegistriesController < ::ApplicationController
2
  include Foreman::Controller::AutoCompleteSearch
3 cc6d0d73 David Davis
  include Foreman::Controller::Parameters::DockerRegistry
4 9d5ef1c9 Ondřej Pražák
  before_action :find_registry, :only => [:edit, :update, :destroy]
5 ada932ab Dmitri Dolguikh
6
  def index
7
    @registries = DockerRegistry.search_for(params[:search], :order => params[:order])
8 ac230210 David Davis
                  .paginate :page => params[:page]
9 ada932ab Dmitri Dolguikh
  end
10
11
  def new
12
    @registry = DockerRegistry.new
13
  end
14
15
  def create
16 cc6d0d73 David Davis
    @registry = DockerRegistry.new(docker_registry_params)
17 ada932ab Dmitri Dolguikh
    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 cc6d0d73 David Davis
    if @registry.update_attributes(docker_registry_params)
29 ada932ab Dmitri Dolguikh
      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 401c0065 Ivan Necas
  protected
44
45
  def model_of_controller
46
    DockerRegistry
47
  end
48
49 ada932ab Dmitri Dolguikh
  def find_registry
50
    @registry = DockerRegistry.find(params[:id])
51
  rescue ActiveRecord::RecordNotFound
52
    not_found
53
  end
54
end