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

add the log time button

Klaus Zanders1efcc0210ee2
diff --git a/modules/costs/app/components/my/time_tracking/daily_entries_table.rb b/modules/costs/app/components/my/time_tracking/daily_entries_table.rb
index f2b9ded2c4e..b163492d5f6 100644
--- a/modules/costs/app/components/my/time_tracking/daily_entries_table.rb
+++ b/modules/costs/app/components/my/time_tracking/daily_entries_table.rb
@@ -33,8 +33,6 @@ module My
class DailyEntriesTable < OpPrimer::BorderBoxTableComponent
columns :time, :hours, :subject, :project, :activity, :comments
- options :date, :time_entries
-
def row_class
TimeEntryRow
end
@@ -45,6 +43,20 @@ module My
def has_actions? = true
+ def action_row_header_content
+ render(Primer::Beta::IconButton.new(
+ icon: "plus",
+ scheme: :invisible,
+ size: :small,
+ tag: :a,
+ tooltip_direction: :e,
+ href: dialog_time_entries_path(onlyMe: true, date: options[:date]),
+ data: { "turbo-stream" => true },
+ label: t("label_log_time"),
+ aria: { label: t("label_log_time") }
+ ))
+ end
+
def headers
[
[:time, { caption: "Time" }],
diff --git a/modules/costs/app/components/my/time_tracking/table_component.html.erb b/modules/costs/app/components/my/time_tracking/table_component.html.erb
index 1a3d8a8f6e7..3bd72e72d76 100644
--- a/modules/costs/app/components/my/time_tracking/table_component.html.erb
+++ b/modules/costs/app/components/my/time_tracking/table_component.html.erb
@@ -21,8 +21,8 @@
) { "Log Time" }
end %>
- <%- range.each do |date| %>
- <%= render(Primer::OpenProject::Heading.new(tag: :h2)) { date.strftime("%A %d") } %>
- <%= render(My::TimeTracking::DailyEntriesTable.new(rows: time_entries_by_day[date])) %>
+ <%- 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(My::TimeTracking::DailyEntriesTable.new(rows: time_entries_by_day[date], date: date)) %>
<%- end %>
<%- end %>