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
use the collapsible section component in the list view
Klaus Zanders568710c43a3f
diff --git a/modules/costs/app/components/my/time_tracking/list_component.html.erb b/modules/costs/app/components/my/time_tracking/list_component.html.erbindex b9988e90c71..2ce032fa8ad 100644--- a/modules/costs/app/components/my/time_tracking/list_component.html.erb+++ b/modules/costs/app/components/my/time_tracking/list_component.html.erb@@ -2,10 +2,19 @@<%= render(My::TimeTracking::HeaderComponent.new(mode:, date:, view_mode: :list)) %><%= render(My::TimeTracking::SubHeaderComponent.new(mode:, date:, view_mode: :list)) %>- <%- range.each_with_index do |date, i| %>- <%= 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: grouped_time_entries[date], date: date, mode: mode)) %>- <%- end %>-<%- end %>+ <% range.each do |date| %>+ <%= render(Primer::OpenProject::CollapsibleSection.new, collapsed: collapsed?(date)) do |section| %>+ <% section.with_title { date_title(date) } %>+ <% section.with_caption { date_caption(date) } %>+ <% section.with_additional_information do %>+ <%=+ render(Primer::Beta::Text.new(color: :muted)) { "#{date_additional(date)} - " } ++ render(Primer::Beta::Text.new) { total_hours_for(date) }+ %>+ <% end %>+ <% section.with_collapsible_content do %>+ <%= render(My::TimeTracking::DailyEntriesTable.new(rows: grouped_time_entries[date], date: date, mode: mode)) %>+ <% end %>+ <% end %>+ <% end %>+<% end %>diff --git a/modules/costs/app/components/my/time_tracking/list_component.rb b/modules/costs/app/components/my/time_tracking/list_component.rbindex fb94d9ba26f..b7b13d9f206 100644--- a/modules/costs/app/components/my/time_tracking/list_component.rb+++ b/modules/costs/app/components/my/time_tracking/list_component.rb@@ -63,8 +63,8 @@ module Myenddef total_hours_for(date)- total_hours = time_entries_by_day[date].sum(&:hours).round(2)- DurationConverter.output(total_hours, format: :hours_and_minutes)+ total_hours = grouped_time_entries[date].sum(&:hours).round(2)+ DurationConverter.output(total_hours, format: :hours_and_minutes).presence || "0h"enddef date_title(date)@@ -75,7 +75,16 @@ module Myendend- def date_additional_info(date)+ def date_additional(date)+ entries_count = grouped_time_entries[date].size+ "#{entries_count} #{TimeEntry.model_name.human(count: entries_count)}"+ end++ def collapsed?(_date)+ false+ end++ def date_caption(date)if mode == :monthif Date.current.beginning_of_week == datet(:label_this_week)