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
show today/yesterday
Klaus Zanderse024f07d5802
diff --git a/modules/costs/app/components/my/time_tracking/table_component.html.erb b/modules/costs/app/components/my/time_tracking/list_component.html.erbsimilarity index 91%rename from modules/costs/app/components/my/time_tracking/table_component.html.erbrename to modules/costs/app/components/my/time_tracking/list_component.html.erbindex 3bd72e72d76..13dd2c0c42c 100644--- a/modules/costs/app/components/my/time_tracking/table_component.html.erb+++ b/modules/costs/app/components/my/time_tracking/list_component.html.erb@@ -22,7 +22,9 @@end %><%- range.each_with_index do |date, i| %>- <%= render(Primer::OpenProject::Heading.new(tag: :h2, classes: class_names("mt-3" => !i.zero?))) { date.strftime("%A %d") } %>+ <%= render(Primer::OpenProject::Heading.new(tag: :h2, classes: class_names("mt-3" => !i.zero?))) do+ date_title(date)+ end %><%= render(My::TimeTracking::DailyEntriesTable.new(rows: time_entries_by_day[date], date: date)) %><%- end %><%- end %>diff --git a/modules/costs/app/components/my/time_tracking/table_component.rb b/modules/costs/app/components/my/time_tracking/list_component.rbsimilarity index 84%rename from modules/costs/app/components/my/time_tracking/table_component.rbrename to modules/costs/app/components/my/time_tracking/list_component.rbindex fa4056bd8a5..701057a3cbc 100644--- a/modules/costs/app/components/my/time_tracking/table_component.rb+++ b/modules/costs/app/components/my/time_tracking/list_component.rb@@ -30,7 +30,7 @@module Mymodule TimeTracking- class TableComponent < ApplicationComponent+ class ListComponent < ApplicationComponentinclude OpTurbo::Streamableinclude ComponentNavigation@@ -65,6 +65,18 @@ module Mytotal_hours = time_entries_by_day[date].sum(&:hours).round(2)DurationConverter.output(total_hours, format: :hours_and_minutes)end++ def date_title(date)+ result = [date.strftime("%A %d")]++ if date.today?+ result << render(Primer::Beta::Text.new(color: :muted)) { t("label_today") }+ elsif date.yesterday?+ result << render(Primer::Beta::Text.new(color: :muted)) { t("label_yesterday") }+ end++ safe_join(result, " ")+ endendendenddiff --git a/modules/costs/app/controllers/my/time_tracking_controller.rb b/modules/costs/app/controllers/my/time_tracking_controller.rbindex 7c2f1594d9a..cf596ae1623 100644--- a/modules/costs/app/controllers/my/time_tracking_controller.rb+++ b/modules/costs/app/controllers/my/time_tracking_controller.rb@@ -127,7 +127,7 @@ module Mydef list_view_componentif params[:view_mode] == "list"- My::TimeTracking::TableComponent.new(time_entries: @time_entries, mode: params[:action].to_sym, date: current_day)+ My::TimeTracking::ListComponent.new(time_entries: @time_entries, mode: params[:action].to_sym, date: current_day)elseMy::TimeTracking::CalendarComponent.new(time_entries: @time_entries, mode: params[:action].to_sym, date: current_day)end