gitlab-org--gitlab-foss/app/controllers/projects/container_registry_controller.rb

29 lines
772 B
Ruby
Raw Normal View History

2016-05-08 16:50:30 -04:00
class Projects::ContainerRegistryController < Projects::ApplicationController
before_action :authorize_read_image!
before_action :authorize_update_image!, only: [:destroy]
before_action :tag, except: [:index]
layout 'project'
def index
@tags = container_registry_repository.tags
2016-05-08 16:50:30 -04:00
end
def destroy
if tag.delete
redirect_to namespace_project_container_registry_index_path(project.namespace, project)
else
redirect_to namespace_project_container_registry_index_path(project.namespace, project), alert: 'Failed to remove tag'
end
end
private
def container_registry_repository
@container_registry_repository ||= project.container_registry_repository
2016-05-08 16:50:30 -04:00
end
def tag
@tag ||= container_registry[params[:id]]
end
end