diff options
Diffstat (limited to 'app/controllers/projects/packages')
-rw-r--r-- | app/controllers/projects/packages/package_files_controller.rb | 16 | ||||
-rw-r--r-- | app/controllers/projects/packages/packages_controller.rb | 24 |
2 files changed, 40 insertions, 0 deletions
diff --git a/app/controllers/projects/packages/package_files_controller.rb b/app/controllers/projects/packages/package_files_controller.rb new file mode 100644 index 00000000000..dd6d875cd1e --- /dev/null +++ b/app/controllers/projects/packages/package_files_controller.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Projects + module Packages + class PackageFilesController < ApplicationController + include PackagesAccess + include SendFileUpload + + def download + package_file = project.package_files.find(params[:id]) + + send_upload(package_file.file, attachment: package_file.file_name) + end + end + end +end diff --git a/app/controllers/projects/packages/packages_controller.rb b/app/controllers/projects/packages/packages_controller.rb new file mode 100644 index 00000000000..fc4ef7a01dc --- /dev/null +++ b/app/controllers/projects/packages/packages_controller.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Projects + module Packages + class PackagesController < Projects::ApplicationController + include PackagesAccess + + before_action :authorize_destroy_package!, only: [:destroy] + + def show + @package = project.packages.find(params[:id]) + @package_files = @package.package_files.recent + @maven_metadatum = @package.maven_metadatum + end + + def destroy + @package = project.packages.find(params[:id]) + @package.destroy + + redirect_to project_packages_path(@project), status: :found, notice: _('Package was removed') + end + end + end +end |