diff --git a/app/controllers/archive_controller.rb b/app/controllers/archive_controller.rb index a375c9f0245..69714ace9c0 100644 --- a/app/controllers/archive_controller.rb +++ b/app/controllers/archive_controller.rb @@ -5,6 +5,9 @@ class ArchiveController < ApplicationController before_action :find_rubygem before_action :verify_mfa_requirement + def show + end + def create authorize @rubygem, :archive? @rubygem.archive!(current_user) diff --git a/app/helpers/rubygems_helper.rb b/app/helpers/rubygems_helper.rb index 7898a9e9475..f3720ab5342 100644 --- a/app/helpers/rubygems_helper.rb +++ b/app/helpers/rubygems_helper.rb @@ -97,6 +97,14 @@ def rubygem_trusted_publishers_link(rubygem) link_to t("rubygems.aside.links.trusted_publishers"), rubygem_trusted_publishers_path(rubygem.slug), class: "gem__link t-list__item" end + def rubygems_archive_link(rubygem) + link_to t("rubges.aside.links.archive"), rubygems_archive_path(rubygem.slug), class: "gem__link t-list__item", method: "post" + end + + def rubygems_unarchive_link(rubygem) + link_to t("rubges.aside.links.unarchive"), rubygems_archive_path(rubygem.slug), class: "gem__link t-list__item", method: "delete" + end + def oidc_api_key_role_links(rubygem) roles = current_user.oidc_api_key_roles.for_rubygem(rubygem) diff --git a/config/routes.rb b/config/routes.rb index f532cea097f..8c5ae359dd2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -227,6 +227,7 @@ resources :adoptions, only: %i[index] resources :trusted_publishers, controller: 'oidc/rubygem_trusted_publishers', only: %i[index create destroy new] + get 'archive', to: 'archive#show' post 'archive', to: 'archive#create' delete 'archive', to: 'archive#destroy' end