From 677d438f85888ab142cf3b97ccd5da2f7303ca8c Mon Sep 17 00:00:00 2001 From: Anton Date: Mon, 18 Aug 2025 12:11:23 +0200 Subject: [PATCH] Add archived label to results dropdown and add link to results in shared tasks [SCI-12067] --- .../my_module_shareable_links_controller.rb | 11 +++++++++-- app/javascript/vue/protocol/step.vue | 5 ++++- app/javascript/vue/results/result.vue | 4 ++-- app/javascript/vue/results/results.vue | 2 ++ app/models/result.rb | 5 +++++ app/views/shareable_links/my_modules/_step.html.erb | 9 ++++++++- .../my_modules/results/_result.html.erb | 2 +- config/locales/en.yml | 1 + 8 files changed, 32 insertions(+), 7 deletions(-) diff --git a/app/controllers/my_module_shareable_links_controller.rb b/app/controllers/my_module_shareable_links_controller.rb index fe9055901..db7450b4c 100644 --- a/app/controllers/my_module_shareable_links_controller.rb +++ b/app/controllers/my_module_shareable_links_controller.rb @@ -43,8 +43,6 @@ class MyModuleShareableLinksController < ApplicationController @results_order = params[:order] || 'new' @results = @my_module.results.active - @results = @results.page(params[:page]).per(Constants::RESULTS_PER_PAGE_LIMIT) - @results = case @results_order when 'old' then @results.order(created_at: :asc) when 'old_updated' then @results.order(updated_at: :asc) @@ -54,6 +52,15 @@ class MyModuleShareableLinksController < ApplicationController else @results.order(created_at: :desc) end + if params[:result_id].present? + page = @results.find_page_number(params[:result_id].to_i, Constants::RESULTS_PER_PAGE_LIMIT) + params[:result_id] = nil + else + page = params[:page] + end + + @results = @results.page(page).per(Constants::RESULTS_PER_PAGE_LIMIT) + @gallery = @results.left_joins(:assets).pluck('assets.id').compact @disable_smart_annotation_links = true diff --git a/app/javascript/vue/protocol/step.vue b/app/javascript/vue/protocol/step.vue index af27fa4da..39f7018fc 100644 --- a/app/javascript/vue/protocol/step.vue +++ b/app/javascript/vue/protocol/step.vue @@ -105,9 +105,12 @@ :key="result.id" :title="result.name" :href="resultUrl(result.id, result.archived)" - class="py-2.5 px-3 hover:bg-sn-super-light-grey cursor-pointer block hover:no-underline text-sn-blue truncate" + class="py-2.5 px-3 hover:bg-sn-super-light-grey cursor-pointer hover:no-underline text-sn-blue truncate flex items-center gap-2" > {{ result.name }} +
+ {{ i18n.t('protocols.steps.archived_result') }} +