From d40145afeae8677cdff62ad41fcd5e445d5367a3 Mon Sep 17 00:00:00 2001 From: Ryan Orlando Date: Tue, 24 Sep 2024 15:42:10 -0400 Subject: [PATCH] remove admin workflows controller override --- .../hyrax/admin/workflows_controller.rb | 86 ------------------- 1 file changed, 86 deletions(-) delete mode 100644 app/controllers/hyrax/admin/workflows_controller.rb diff --git a/app/controllers/hyrax/admin/workflows_controller.rb b/app/controllers/hyrax/admin/workflows_controller.rb deleted file mode 100644 index 355276ae..00000000 --- a/app/controllers/hyrax/admin/workflows_controller.rb +++ /dev/null @@ -1,86 +0,0 @@ -# frozen_string_literal: true -module Hyrax - # Presents a list of works in workflow - class Admin::WorkflowsController < ApplicationController - before_action :ensure_authorized! - with_themed_layout 'dashboard' - class_attribute :deposited_workflow_state_name - - # Works that are in this workflow state (see workflow json template) are excluded from the - # status list and display in the "Published" tab - self.deposited_workflow_state_name = 'deposited' - - def index - add_breadcrumb t(:'hyrax.controls.home'), root_path - add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path - add_breadcrumb t(:'hyrax.admin.sidebar.tasks'), '#' - add_breadcrumb t(:'hyrax.admin.sidebar.workflow_review'), request.path - - # Changed the two lines bellow - # these two lines seem like they are no longer needed - # Todo: if lines unneeded delete file - @status_list = Hyrax::Workflow::StatusListService.new(self, "-workflow_state_name_ssim:#{deposited_workflow_state_name} AND createdby_tesim:#{Contribution::SELFDEP}") - @published_list = Hyrax::Workflow::StatusListService.new(self, "workflow_state_name_ssim:#{deposited_workflow_state_name} AND createdby_tesim:#{Contribution::SELFDEP}") - - assign_action_objects_params - @response = WorkflowResponse.new(actionable_objects.to_a, actionable_objects.total_count, current_page, per_page, under_review?) - end - - private - - def ensure_authorized! - authorize! :review, :submissions - end - - def actionable_objects - @actionable_objects ||= - Hyrax::Workflow::ActionableObjects.new(user: current_user) - end - - def current_page - @page ||= params.fetch('page', 1).to_i - end - - def per_page - @per_page ||= params.fetch('per_page', 10).to_i - end - - def assign_action_objects_params - actionable_objects.page = current_page - actionable_objects.per_page = per_page - actionable_objects.workflow_state_filter = (under_review? ? '!' : '') + deposited_workflow_state_name - end - - def under_review? - @under_review = params['state'] != 'published' - end - - class WorkflowResponse - attr_reader :total_count - attr_reader :current_page - attr_reader :per_page - attr_reader :docs - attr_reader :under_review - - def initialize(docs, total_count, page, per_page, under_review) - @docs = docs - @total_count = total_count - @per_page = per_page.to_i - @current_page = page.to_i - @under_review = under_review - end - - def total_pages - (total_count.to_f / per_page).ceil - end - - def limit_value - docs.length - end - - def viewing_under_review? - under_review - end - end - end -end