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
WIP: Time entries tabs
Inga Mai6d32a3d16972
diff --git a/app/controllers/time_entries/reports_controller.rb b/app/controllers/time_entries/reports_controller.rbindex 22ead314132..d81882fc8a9 100644--- a/app/controllers/time_entries/reports_controller.rb+++ b/app/controllers/time_entries/reports_controller.rb@@ -28,6 +28,8 @@#++class TimeEntries::ReportsController < ApplicationController+ helper_method :gon+menu_item :issuesbefore_action :find_optional_projectbefore_action :load_available_criteriasdiff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rbindex db3e0a0fe1b..392d637713a 100644--- a/app/controllers/timelog_controller.rb+++ b/app/controllers/timelog_controller.rb@@ -29,6 +29,8 @@#++class TimelogController < ApplicationController+ helper_method :gon+before_action :find_work_package, only: %i[new create]before_action :find_project, only: %i[new create]before_action :find_time_entry, only: %i[show edit update destroy]diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rbindex 876ca822415..96d5982db56 100644--- a/app/helpers/custom_fields_helper.rb+++ b/app/helpers/custom_fields_helper.rb@@ -31,14 +31,54 @@module CustomFieldsHelperdef custom_fields_tabs[- { name: 'WorkPackageCustomField', partial: 'custom_fields/tab', path: custom_fields_path(tab: :WorkPackageCustomField), label: :label_work_package_plural },- { name: 'TimeEntryCustomField', partial: 'custom_fields/tab', path: custom_fields_path(tab: :TimeEntryCustomField), label: :label_spent_time },- { name: 'ProjectCustomField', partial: 'custom_fields/tab', path: custom_fields_path(tab: :ProjectCustomField), label: :label_project_plural },- { name: 'VersionCustomField', partial: 'custom_fields/tab', path: custom_fields_path(tab: :VersionCustomField), label: :label_version_plural },- { name: 'UserCustomField', partial: 'custom_fields/tab', path: custom_fields_path(tab: :UserCustomField), label: :label_user_plural },- { name: 'GroupCustomField', partial: 'custom_fields/tab', path: custom_fields_path(tab: :GroupCustomField), label: :label_group_plural },- { name: 'TimeEntryActivityCustomField', partial: 'custom_fields/tab', path: custom_fields_path(tab: :TimeEntryActivityCustomField), label: TimeEntryActivity::OptionName },- { name: 'IssuePriorityCustomField', partial: 'custom_fields/tab', path: custom_fields_path(tab: :IssuePriorityCustomField), label: IssuePriority::OptionName }+ {+ name: 'WorkPackageCustomField',+ partial: 'custom_fields/tab',+ path: custom_fields_path(tab: :WorkPackageCustomField),+ label: :label_work_package_plural+ },+ {+ name: 'TimeEntryCustomField',+ partial: 'custom_fields/tab',+ path: custom_fields_path(tab: :TimeEntryCustomField),+ label: :label_spent_time+ },+ {+ name: 'ProjectCustomField',+ partial: 'custom_fields/tab',+ path: custom_fields_path(tab: :ProjectCustomField),+ label: :label_project_plural+ },+ {+ name: 'VersionCustomField',+ partial: 'custom_fields/tab',+ path: custom_fields_path(tab: :VersionCustomField),+ label: :label_version_plural+ },+ {+ name: 'UserCustomField',+ partial: 'custom_fields/tab',+ path: custom_fields_path(tab: :UserCustomField),+ label: :label_user_plural+ },+ {+ name: 'GroupCustomField',+ partial: 'custom_fields/tab',+ path: custom_fields_path(tab: :GroupCustomField),+ label: :label_group_plural+ },+ {+ name: 'TimeEntryActivityCustomField',+ partial: 'custom_fields/tab',+ path: custom_fields_path(tab: :TimeEntryActivityCustomField),+ label: TimeEntryActivity::OptionName+ },+ {+ name: 'IssuePriorityCustomField',+ partial: 'custom_fields/tab',+ path: custom_fields_path(tab: :IssuePriorityCustomField),+ label: IssuePriority::OptionName+ }]enddiff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rbindex f9dd15670f6..3244a4605cd 100644--- a/app/helpers/groups_helper.rb+++ b/app/helpers/groups_helper.rb@@ -29,9 +29,25 @@module GroupsHelperdef group_settings_tabs- [{ name: 'general', partial: 'groups/general', path: edit_group_path(@group), label: :label_general },- { name: 'users', partial: 'groups/users', path: edit_group_path(@group, tab: :users), label: :label_user_plural },- { name: 'memberships', partial: 'groups/memberships', path: edit_group_path(@group, tab: :memberships), label: :label_project_plural }+ [+ {+ name: 'general',+ partial: 'groups/general',+ path: edit_group_path(@group),+ label: :label_general+ },+ {+ name: 'users',+ partial: 'groups/users',+ path: edit_group_path(@group, tab: :users),+ label: :label_user_plural+ },+ {+ name: 'memberships',+ partial: 'groups/memberships',+ path: edit_group_path(@group, tab: :memberships),+ label: :label_project_plural+ }]enddiff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rbindex 6defce57458..0ca213c4874 100644--- a/app/helpers/settings_helper.rb+++ b/app/helpers/settings_helper.rb@@ -34,12 +34,42 @@ module SettingsHelperdef administration_settings_tabs[- { name: 'general', partial: 'settings/general', path: settings_path, label: :label_general },- { name: 'display', partial: 'settings/display', path: settings_path(tab: :display), label: :label_display },- { name: 'projects', partial: 'settings/projects', path: settings_path(tab: :projects), label: :label_project_plural },- { name: 'notifications', partial: 'settings/notifications', path: settings_path(tab: :notifications), label: :label_mail_notification },- { name: 'mail_handler', partial: 'settings/mail_handler', path: settings_path(tab: :mail_handler), label: :label_incoming_emails },- { name: 'repositories', partial: 'settings/repositories', path: settings_path(tab: :repositories), label: :label_repository_plural }+ {+ name: 'general',+ partial: 'settings/general',+ path: settings_path,+ label: :label_general+ },+ {+ name: 'display',+ partial: 'settings/display',+ path: settings_path(tab: :display),+ label: :label_display+ },+ {+ name: 'projects',+ partial: 'settings/projects',+ path: settings_path(tab: :projects),+ label: :label_project_plural+ },+ {+ name: 'notifications',+ partial: 'settings/notifications',+ path: settings_path(tab: :notifications),+ label: :label_mail_notification+ },+ {+ name: 'mail_handler',+ partial: 'settings/mail_handler',+ path: settings_path(tab: :mail_handler),+ label: :label_incoming_emails+ },+ {+ name: 'repositories',+ partial: 'settings/repositories',+ path: settings_path(tab: :repositories),+ label: :label_repository_plural+ }]enddiff --git a/app/helpers/timelog_helper.rb b/app/helpers/timelog_helper.rbindex 0fa49e08b1f..13bd1812574 100644--- a/app/helpers/timelog_helper.rb+++ b/app/helpers/timelog_helper.rb@@ -30,6 +30,23 @@module TimelogHelperinclude ApplicationHelper+ def time_entry_tabs+ [+ {+ name: 'details',+ partial: 'timelog/time_entry_tab',+ path: polymorphic_time_entries_path(@issue || @project),+ label: :label_details+ },+ {+ name: 'report',+ partial: 'reports/show',+ path: polymorphic_time_entries_report_path(@issue || @project),+ label: :label_report+ }+ ]+ end+# Returns a collection of activities for a select field. time_entry# is optional and will be used to check if the selected TimeEntryActivity# is active.diff --git a/app/helpers/types_helper.rb b/app/helpers/types_helper.rbindex 28b121681b2..27239815929 100644--- a/app/helpers/types_helper.rb+++ b/app/helpers/types_helper.rb@@ -30,10 +30,25 @@module ::TypesHelperdef types_tabs[- { name: 'settings', partial: 'types/form/settings', path: edit_type_tab_path(id: @type.id, tab: :settings), label: 'types.edit.settings' },- { name: 'form_configuration', partial: 'types/form/form_configuration', path: edit_type_tab_path(id: @type.id, tab: :form_configuration), label: 'types.edit.form_configuration' },- { name: 'projects', partial: 'types/form/projects', path: edit_type_tab_path(id: @type.id, tab: :projects), label: 'types.edit.projects' }- ]+ {+ name: 'settings',+ partial: 'types/form/settings',+ path: edit_type_tab_path(id: @type.id, tab: :settings),+ label: 'types.edit.settings'+ },+ {+ name: 'form_configuration',+ partial: 'types/form/form_configuration',+ path: edit_type_tab_path(id: @type.id, tab: :form_configuration),+ label: 'types.edit.form_configuration'+ },+ {+ name: 'projects',+ partial: 'types/form/projects',+ path: edit_type_tab_path(id: @type.id, tab: :projects),+ label: 'types.edit.projects'+ }+ ]enddef icon_for_type(type)diff --git a/app/views/time_entries/reports/show.html.erb b/app/views/time_entries/reports/show.html.erbindex b127bbed436..03fc5689db8 100644--- a/app/views/time_entries/reports/show.html.erb+++ b/app/views/time_entries/reports/show.html.erb@@ -43,7 +43,8 @@ See docs/COPYRIGHT.rdoc for more details.<%= hidden_field_tag 'criterias[]', criteria, id: nil %><% end %><%= render partial: 'timelog/date_range' %>- <%= render 'timelog/time_entry_tabs' %>++ <%= render_tabs time_entry_tabs %><div class="timelog-report-selection small-6"><div class="grid-block">diff --git a/app/views/timelog/_time_entry_tab.html.erb b/app/views/timelog/_time_entry_tab.html.erbindex 9d1b4baf4fe..eadd4ccacb9 100644--- a/app/views/timelog/_time_entry_tab.html.erb+++ b/app/views/timelog/_time_entry_tab.html.erb@@ -26,9 +26,3 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.See docs/COPYRIGHT.rdoc for more details.++#%>-<li>- <%= link_to(tab_path, class: (tab_selected ? 'selected' : nil)) do %>- <%= tab_selected ? you_are_here_info : nil %>- <%= tab_title %>- <% end %>-</li>diff --git a/app/views/timelog/_time_entry_tabs.html.erb b/app/views/timelog/_time_entry_tabs.html.erbdeleted file mode 100644index 4af71227fb9..00000000000--- a/app/views/timelog/_time_entry_tabs.html.erb+++ /dev/null@@ -1,39 +0,0 @@-<%#-- copyright-OpenProject is an open source project management software.-Copyright (C) 2012-2020 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-2017 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 docs/COPYRIGHT.rdoc for more details.--++#%>--<div class="tabs">- <ul>- <%= render partial: 'timelog/time_entry_tab', locals: { tab_title: l(:label_details),- tab_path: polymorphic_time_entries_path(@issue || @project),- tab_selected: (request.path == polymorphic_time_entries_path(@issue || @project)) }%>- <%= render partial: 'timelog/time_entry_tab', locals: { tab_title: l(:label_report),- tab_path: polymorphic_time_entries_report_path(@issue || @project),- tab_selected: (request.path != polymorphic_time_entries_path(@issue || @project)) }%>- </ul>-</div>diff --git a/app/views/timelog/index.html.erb b/app/views/timelog/index.html.erbindex 891de7ab299..fb15aff7478 100644--- a/app/views/timelog/index.html.erb+++ b/app/views/timelog/index.html.erb@@ -42,7 +42,7 @@ See docs/COPYRIGHT.rdoc for more details.<%= render partial: 'date_range' %><% end %>-<%= render 'time_entry_tabs' %>+<%= render_tabs time_entry_tabs %><div class="notification-box -warning"><a title="close" class="notification-box--close icon-context icon-close"></a>@@ -55,4 +55,5 @@ See docs/COPYRIGHT.rdoc for more details.<%= f.link_to 'CSV', url: permitted_params.timelog.to_h %><% end %></div>+<% html_title l(:label_spent_time) %>diff --git a/config/locales/js-en.yml b/config/locales/js-en.ymlindex 14b93574c89..5a3d775b53c 100644--- a/config/locales/js-en.yml+++ b/config/locales/js-en.yml@@ -47,9 +47,6 @@ en:close_filter_title: "Close filter"close_form_title: "Close form"- backlogs:- backlog_settings: "Backlog Settings"-button_add_watcher: "Add watcher"button_back: "Back"button_back_to_list_view: "Back to list view"@@ -267,6 +264,7 @@ en:label_deactivate: "Deactivate"label_descending: "Descending"label_description: "Description"+ label_details: "Details"label_display: "Display"label_cancel_comment: "Cancel comment"label_closed_work_packages: "closed"@@ -314,7 +312,6 @@ en:label_menu_collapse: "collapse"label_menu_expand: "expand"label_more_than_ago: "more than days ago"- label_module_plural: "Modules"label_next: "Next"label_no_color: "No color"label_no_data: "No data to display"@@ -339,7 +336,7 @@ en:label_remove_column: "Remove column"label_remove_columns: "Remove selected columns"label_remove_row: "Remove row"- label_repository: "Repository"+ label_report: "Report"label_repository_plural: "Repositories"label_save_as: "Save as"label_select_watcher: "Select a watcher..."@@ -372,8 +369,6 @@ en:label_warning: "Warning"label_work_package: "Work package"label_work_package_plural: "Work packages"- label_work_package_category_plural: "Work package categories"- label_work_package_types: "Work package types"label_watch: "Watch"label_watch_work_package: "Watch work package"label_watcher_added_successfully: "Watcher successfully added!"@@ -386,7 +381,6 @@ en:label_starred_queries: "Favorite views"label_global_queries: "Public views"label_custom_queries: "Private views"- label_custom_field_plural: "Custom fields"label_columns: "Columns"label_attachments: Fileslabel_drop_files: Drop files herediff --git a/frontend/src/app/modules/common/tabs/scrollable-tabs.component.ts b/frontend/src/app/modules/common/tabs/scrollable-tabs.component.tsindex 602a063f335..cbcdfda6817 100644--- a/frontend/src/app/modules/common/tabs/scrollable-tabs.component.ts+++ b/frontend/src/app/modules/common/tabs/scrollable-tabs.component.ts@@ -1,4 +1,10 @@-import {AfterViewInit, Component, ElementRef, ViewChild} from "@angular/core";+import {+ AfterViewInit,+ Component,+ ElementRef,+ ViewChild,+ ChangeDetectionStrategy+} from "@angular/core";export interface Tab {id:string;@@ -7,7 +13,8 @@ export interface Tab {}@Component({- templateUrl: 'scrollable-tabs.component.html'+ templateUrl: 'scrollable-tabs.component.html',+ changeDetection: ChangeDetectionStrategy.OnPush})export class ScrollableTabsComponent implements AfterViewInit {diff --git a/frontend/src/app/modules/global_search/tabs/global-search-tabs.component.ts b/frontend/src/app/modules/global_search/tabs/global-search-tabs.component.tsindex a2d34686d53..441ca983574 100644--- a/frontend/src/app/modules/global_search/tabs/global-search-tabs.component.ts+++ b/frontend/src/app/modules/global_search/tabs/global-search-tabs.component.ts@@ -29,6 +29,7 @@import {Component,OnDestroy,+ ChangeDetectionStrategy} from '@angular/core';import {DynamicBootstrapper} from "core-app/globals/dynamic-bootstrapper";import {GlobalSearchService} from "core-app/modules/global_search/services/global-search.service";@@ -39,7 +40,8 @@ export const globalSearchTabsSelector = 'global-search-tabs';@Component({selector: globalSearchTabsSelector,- templateUrl: '/app/modules/common/tabs/scrollable-tabs.component.html'+ templateUrl: '/app/modules/common/tabs/scrollable-tabs.component.html',+ changeDetection: ChangeDetectionStrategy.OnPush})export class GlobalSearchTabsComponent extends ScrollableTabsComponent implements OnDestroy {