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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
add stubs for controller methods
Klaus Zandersce4325d9f58f
diff --git a/modules/costs/app/controllers/my/time_tracking_controller.rb b/modules/costs/app/controllers/my/time_tracking_controller.rbnew file mode 100644index 00000000000..9ceaefbd6b3--- /dev/null+++ b/modules/costs/app/controllers/my/time_tracking_controller.rb@@ -0,0 +1,69 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module My+ class TimeTrackingController < ApplicationController+ before_action :require_login++ no_authorization_required!(:day, :week, :month)++ current_menu_item do |ctrl|+ if ctrl.params[:action] == "day" && ctrl.current_day == Time.zone.today+ :my_time_tracking_today+ else+ :my_time_tracking+ end+ end++ layout "global"++ def day; end++ def week; end++ def month; end++ def default_breadcrumb+ "my time"+ end++ def current_day+ @current_day ||= if params[:date].present?+ begin+ Date.parse(params[:date])+ rescue StandardError+ Time.zone.today+ end+ else+ Time.zone.today+ end+ end+ end+enddiff --git a/modules/costs/app/controllers/my/timer_controller.rb b/modules/costs/app/controllers/my/timer_controller.rbindex d3bde9cd283..f9d070ae722 100644--- a/modules/costs/app/controllers/my/timer_controller.rb+++ b/modules/costs/app/controllers/my/timer_controller.rb@@ -33,6 +33,8 @@ module Mybefore_action :require_loginbefore_action :find_active_timer, only: %i[show]+ no_authorization_required! :show+def showrender layout: nilenddiff --git a/modules/costs/app/views/my/time_tracking/day.html.erb b/modules/costs/app/views/my/time_tracking/day.html.erbnew file mode 100644index 00000000000..4f04629f9b9--- /dev/null+++ b/modules/costs/app/views/my/time_tracking/day.html.erb@@ -0,0 +1,6 @@+<%=+ render Primer::OpenProject::PageHeader.new do |header|+ header.with_title { "my time: day view" }+ header.with_breadcrumbs(["my time"])+ end+%>diff --git a/modules/costs/app/views/my/time_tracking/month.html.erb b/modules/costs/app/views/my/time_tracking/month.html.erbnew file mode 100644index 00000000000..88a3b74e667--- /dev/null+++ b/modules/costs/app/views/my/time_tracking/month.html.erb@@ -0,0 +1,6 @@+<%=+ render Primer::OpenProject::PageHeader.new do |header|+ header.with_title { "my time: month" }+ header.with_breadcrumbs(["my time"])+ end+%>diff --git a/modules/costs/app/views/my/time_tracking/week.html.erb b/modules/costs/app/views/my/time_tracking/week.html.erbnew file mode 100644index 00000000000..f9b68609a16--- /dev/null+++ b/modules/costs/app/views/my/time_tracking/week.html.erb@@ -0,0 +1,6 @@+<%=+ render Primer::OpenProject::PageHeader.new do |header|+ header.with_title { "my time week" }+ header.with_breadcrumbs(["my time"])+ end+%>diff --git a/modules/costs/config/routes.rb b/modules/costs/config/routes.rbindex dc129df6c34..3f4d3d70702 100644--- a/modules/costs/config/routes.rb+++ b/modules/costs/config/routes.rb@@ -47,8 +47,12 @@ Rails.application.routes.draw doget "/time_entries/dialog" => "time_entries#dialog"end- scope "my" do- get "/timer" => "my/timer#show", as: "my_timers"+ namespace "my" do+ get "/timer" => "timer#show", as: "timers"++ get "/time-tracking/day" => "time_tracking#day"+ get "/time-tracking/week" => "time_tracking#week"+ get "/time-tracking/month" => "time_tracking#month"endscope "projects/:project_id", as: "project", module: "projects" dodiff --git a/modules/costs/lib/costs/engine.rb b/modules/costs/lib/costs/engine.rbindex 32538e828fe..18838251cb8 100644--- a/modules/costs/lib/costs/engine.rb+++ b/modules/costs/lib/costs/engine.rb@@ -34,10 +34,7 @@ module Costsinclude OpenProject::Plugins::ActsAsOpEngine- register "costs",- author_url: "https://www.openproject.org",- bundled: true,- settings: { menu_item: :costs_settings } do+ register "costs", author_url: "https://www.openproject.org", bundled: true, settings: { menu_item: :costs_settings } doproject_module :costs dopermission :view_time_entries,{},@@ -144,6 +141,31 @@ module Costsif: ->(*) { User.current.admin? },parent: :admin_costs,caption: :enumeration_activities++ menu :global_menu,+ :my_time_tracking,+ { controller: "/my/time_tracking", action: "day" },+ 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_monthendinitializer "costs.settings" do