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 a SegmentedControl to switch views
Klaus Zanders05981940a8c4
diff --git a/modules/costs/app/components/my/time_tracking/calendar_component.html.erb b/modules/costs/app/components/my/time_tracking/calendar_component.html.erbindex f5db518556a..73843a75584 100644--- a/modules/costs/app/components/my/time_tracking/calendar_component.html.erb+++ b/modules/costs/app/components/my/time_tracking/calendar_component.html.erb@@ -2,6 +2,21 @@<% calendar_page.with_row { render(My::TimeTracking::HeaderComponent.new(mode:, date:, view_mode: :calendar)) } %><% calendar_page.with_row do %><%= render(Primer::OpenProject::SubHeader.new) do |component|+ component.with_filter_component do+ render(Primer::Alpha::SegmentedControl.new("aria-label": I18n.t(:label_meeting_date_time))) do |control|+ %i[day week month].each do |action|+ control.with_item(+ tag: :a,+ href: url_for(params.permit(:controller, :date).merge(action:, view_mode: "calendar")),+ icon: "calendar", # TODO: Replace with proper icon+ label: t("label_#{action}"),+ title: t("label_#{action}"),+ selected: (mode == action)+ )+ end+ end+ end+component.with_text { title }component.with_action_component dodiff --git a/modules/costs/app/components/my/time_tracking/header_component.html.erb b/modules/costs/app/components/my/time_tracking/header_component.html.erbindex 0201cb40011..0c620795ded 100644--- a/modules/costs/app/components/my/time_tracking/header_component.html.erb+++ b/modules/costs/app/components/my/time_tracking/header_component.html.erb@@ -7,21 +7,6 @@])- header.with_action_menu(- menu_arguments: { anchor_align: :end },- button_arguments: { button_block: calendar_mode_button_block }- ) do |menu|- %i[day week month].each do |action|- menu.with_item(- label: t("label_#{action}"),- tag: :a,- href: url_for(params.permit(:controller, :date, :view_mode).merge(action:))- ) do |item|- item.with_leading_visual_icon(icon: :calendar)- end- end- end-header.with_action_menu(menu_arguments: { anchor_align: :end },button_arguments: { button_block: view_mode_block }@@ -36,7 +21,7 @@menu.with_item(label: t(:label_list),tag: :a,- href: url_for(params.permit(:controller, :action, :date).merge(view_mode: "list"))+ href: url_for(params.permit(:controller, :date).merge(view_mode: "list", action: "week"))) do |item|item.with_leading_visual_icon(icon: "list-unordered")enddiff --git a/modules/costs/app/components/my/time_tracking/header_component.rb b/modules/costs/app/components/my/time_tracking/header_component.rbindex 4bd7f0b302d..3b3adb37f79 100644--- a/modules/costs/app/components/my/time_tracking/header_component.rb+++ b/modules/costs/app/components/my/time_tracking/header_component.rb@@ -80,29 +80,6 @@ module Myendendend-- def calendar_mode_button_block- case mode- when :day- lambda do |button|- button.with_leading_visual_icon(icon: :calendar)- button.with_trailing_action_icon(icon: "triangle-down")- t(:label_day)- end- when :week- lambda do |button|- button.with_leading_visual_icon(icon: :calendar)- button.with_trailing_action_icon(icon: "triangle-down")- t(:label_week)- end- when :month- lambda do |button|- button.with_leading_visual_icon(icon: :calendar)- button.with_trailing_action_icon(icon: "triangle-down")- t(:label_month)- end- end- endendendend