Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Rename #calendar method to #index

Klaus Zanders0f9688971354
diff --git a/modules/costs/app/controllers/my/time_tracking_controller.rb b/modules/costs/app/controllers/my/time_tracking_controller.rb
index 1f799f29d77..ad9260c3684 100644
--- a/modules/costs/app/controllers/my/time_tracking_controller.rb
+++ b/modules/costs/app/controllers/my/time_tracking_controller.rb
@@ -32,7 +32,7 @@ module My
class TimeTrackingController < ApplicationController
before_action :require_login
- no_authorization_required!(:calendar, :day, :week, :month)
+ no_authorization_required!(:index, :day, :week, :month)
menu_item :my_time_tracking
@@ -40,7 +40,7 @@ module My
helper_method :current_day, :today?, :this_week?, :this_month?, :list_view_component, :view_mode
- def calendar
+ def index
if mobile?
redirect_to action: :day, view_mode: default_view_mode
else
diff --git a/modules/costs/config/routes.rb b/modules/costs/config/routes.rb
index 29a8ce80b38..642a837e29f 100644
--- a/modules/costs/config/routes.rb
+++ b/modules/costs/config/routes.rb
@@ -50,7 +50,7 @@ Rails.application.routes.draw do
namespace "my" do
get "/timer" => "timer#show", as: "timers"
- get "/time-tracking" => "time_tracking#calendar"
+ get "/time-tracking" => "time_tracking#index"
get "/time-tracking/day(-:view_mode)(/:date)" => "time_tracking#day",
as: :time_tracking_day
get "/time-tracking/week(-:view_mode)(/:date)" => "time_tracking#week",
diff --git a/modules/costs/lib/costs/engine.rb b/modules/costs/lib/costs/engine.rb
index 111ab738a03..f62be67afc3 100644
--- a/modules/costs/lib/costs/engine.rb
+++ b/modules/costs/lib/costs/engine.rb
@@ -144,28 +144,10 @@ module Costs
menu :global_menu,
:my_time_tracking,
- { controller: "/my/time_tracking", action: "calendar" },
+ { controller: "/my/time_tracking", action: "index" },
after: :my_page,
caption: :label_my_time_tracking,
icon: :stopwatch
-
- # menu :global_menu,
- # :my_time_tracking_today,
- # { controller: "/my/time_tracking", action: "day" },
- # parent: :my_time_tracking,
- # caption: :label_today
- #
- # menu :global_menu,
- # :my_time_tracking_this_week,
- # { controller: "/my/time_tracking", action: "week" },
- # parent: :my_time_tracking,
- # caption: :label_this_week
- #
- # menu :global_menu,
- # :my_time_tracking_this_month,
- # { controller: "/my/time_tracking", action: "month" },
- # parent: :my_time_tracking,
- # caption: :label_this_month
end
initializer "costs.settings" do
diff --git a/modules/costs/spec/controllers/my/time_tracking_controller_spec.rb b/modules/costs/spec/controllers/my/time_tracking_controller_spec.rb
index 81a144d372d..6fb62ff2e40 100644
--- a/modules/costs/spec/controllers/my/time_tracking_controller_spec.rb
+++ b/modules/costs/spec/controllers/my/time_tracking_controller_spec.rb
@@ -49,7 +49,7 @@ RSpec.describe My::TimeTrackingController do
end
it "redirects to the week calendar view" do
- get :calendar
+ get :index
expect(response).to redirect_to(action: :week, view_mode: "calendar")
end
end
@@ -60,7 +60,7 @@ RSpec.describe My::TimeTrackingController do
end
it "redirects to the week list view" do
- get :calendar
+ get :index
expect(response).to redirect_to(action: :week, view_mode: "list")
end
end
@@ -77,7 +77,7 @@ RSpec.describe My::TimeTrackingController do
end
it "redirects to the day calendar view" do
- get :calendar
+ get :index
expect(response).to redirect_to(action: :day, view_mode: "calendar")
end
end
@@ -88,7 +88,7 @@ RSpec.describe My::TimeTrackingController do
end
it "redirects to the day list view" do
- get :calendar
+ get :index
expect(response).to redirect_to(action: :day, view_mode: "list")
end
end