From 187a6a7c5acea5c78288317783dc3e2084c0763a Mon Sep 17 00:00:00 2001
From: kapill65chhpatel <kapil@cottagelabs.com>
Date: Tue, 21 Mar 2023 13:01:08 +0530
Subject: [PATCH] correct date format

---
 .../controllers/hyrax/dashboard_controller.rb | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 hyrax/app/controllers/hyrax/dashboard_controller.rb

diff --git a/hyrax/app/controllers/hyrax/dashboard_controller.rb b/hyrax/app/controllers/hyrax/dashboard_controller.rb
new file mode 100644
index 00000000..e31b68ef
--- /dev/null
+++ b/hyrax/app/controllers/hyrax/dashboard_controller.rb
@@ -0,0 +1,38 @@
+# frozen_string_literal: true
+module Hyrax
+  class DashboardController < ApplicationController
+    include Blacklight::Base
+    include Hyrax::Breadcrumbs
+    with_themed_layout 'dashboard'
+    before_action :authenticate_user!
+    before_action :build_breadcrumbs, only: [:show]
+    before_action :set_date_range
+
+    ##
+    # @!attribute [rw] sidebar_partials
+    #   @return [Hash]
+    #
+    # @example Add a custom partial to the tasks sidebar block
+    #   Hyrax::DashboardController.sidebar_partials[:tasks] << "hyrax/dashboard/sidebar/custom_task"
+    class_attribute :sidebar_partials
+    self.sidebar_partials = { activity: [], configuration: [], repository_content: [], tasks: [] }
+
+    def show
+      if can? :read, :admin_dashboard
+        @presenter = Hyrax::Admin::DashboardPresenter.new
+        @admin_set_rows = Hyrax::AdminSetService.new(self).search_results_with_work_count(:read)
+        render 'show_admin'
+      else
+        @presenter = Dashboard::UserPresenter.new(current_user, view_context, params[:since])
+        render 'show_user'
+      end
+    end
+
+    private
+
+    def set_date_range
+      @start_date = params[:start_date] || (Time.zone.today - 1.month).strftime('%Y-%m-%d')
+      @end_date = params[:end_date] || (Time.zone.today + 1.day).strftime('%Y-%m-%d')
+    end
+  end
+end
\ No newline at end of file
-- 
GitLab