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
Admin User tabs
Inga Mai32079589a065
diff --git a/app/controllers/time_entries/reports_controller.rb b/app/controllers/time_entries/reports_controller.rbindex d81882fc8a9..86b1b918ed4 100644--- a/app/controllers/time_entries/reports_controller.rb+++ b/app/controllers/time_entries/reports_controller.rb@@ -41,6 +41,9 @@ class TimeEntries::ReportsController < ApplicationControllermenu_item :time_entriesdef show+ # add to params to render correct tab+ params[:tab] = params[:tab] || 'report'+@criterias = params[:criterias] || []@criterias = @criterias.select { |criteria| @available_criterias.has_key? criteria }@criterias.uniq!diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rbindex 392d637713a..286c2ffac00 100644--- a/app/controllers/timelog_controller.rb+++ b/app/controllers/timelog_controller.rb@@ -46,6 +46,9 @@ class TimelogController < ApplicationControllermenu_item :time_entriesdef index+ # add to params to render correct tab+ params[:tab] = params[:tab] || 'details'+sort_init 'spent_on', 'desc'sort_update 'spent_on' => 'spent_on','user' => 'user_id',diff --git a/app/helpers/tabs_helper.rb b/app/helpers/tabs_helper.rbindex 0d063a9b4f4..b3f1b22e978 100644--- a/app/helpers/tabs_helper.rb+++ b/app/helpers/tabs_helper.rb@@ -39,8 +39,11 @@ module TabsHelperend# Render tabs from the ui/extensible tabs manager- def render_extensible_tabs(key)- tabs = ::OpenProject::Ui::ExtensibleTabs.enabled_tabs(key)+ def render_extensible_tabs(key, params = {})+ tabs = ::OpenProject::Ui::ExtensibleTabs.enabled_tabs(key).map do |tab|+ path = tab[:path].respond_to?(:call) ? instance_exec(params, &tab[:path]) : tab[:path]+ tab.dup.merge path: path+ endrender_tabs(tabs)endenddiff --git a/app/helpers/timelog_helper.rb b/app/helpers/timelog_helper.rbindex 13bd1812574..fe528bed465 100644--- a/app/helpers/timelog_helper.rb+++ b/app/helpers/timelog_helper.rb@@ -40,7 +40,7 @@ module TimelogHelper},{name: 'report',- partial: 'reports/show',+ partial: 'time_entries/reports/reports_tab',path: polymorphic_time_entries_report_path(@issue || @project),label: :label_report}diff --git a/app/views/common/_tabs.html.erb b/app/views/common/_tabs.html.erbindex 962fe0a512d..c2ffc2c1678 100644--- a/app/views/common/_tabs.html.erb+++ b/app/views/common/_tabs.html.erb@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.See docs/COPYRIGHT.rdoc for more details.++#%>-<% gon.content_tabs = { tabs: tabs.to_json.html_safe, selected: selected_tab.to_json.html_safe } %>+<% gon.contentTabs = { tabs: tabs.to_json.html_safe, selected: selected_tab.to_json.html_safe } %><%= nonced_javascript_tag do %><%= include_gon(need_tag: false) -%><% end %>diff --git a/app/views/time_entries/reports/_reports_tab.html.erb b/app/views/time_entries/reports/_reports_tab.html.erbnew file mode 100644index 00000000000..8ddfba68f78--- /dev/null+++ b/app/views/time_entries/reports/_reports_tab.html.erb@@ -0,0 +1,140 @@+<%#-- 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.++++#%>++<%= styled_form_tag(polymorphic_time_entries_report_path(@issue || @project), method: :get, id: 'query_form', class: '-vertical') do %>+ <% @criterias.each do |criteria| %>+ <%= hidden_field_tag 'criterias[]', criteria, id: nil %>+ <% end %>++ <div class="timelog-report-selection small-6">+ <div class="grid-block">++ <div class="form--field">+ <%= styled_label_tag :columns, "#{t(:label_details)}:" %>+ <%= styled_select_tag 'columns', options_for_select([[l(:label_year), 'year'],+ [l(:label_month), 'month'],+ [l(:label_week), 'week'],+ [l(:label_day_plural).titleize, 'day']], @columns),+ container_class: '-slim' %>+ </div>++ <div class="form--field">+ <%= styled_label_tag :criterias, "#{t(:button_add)}:" %>+ <% available_criterias = [[]] + (@available_criterias.keys - @criterias).collect{ |k|+ [l_or_humanize(@available_criterias[k][:label]), k]+ }+ %>+ <%= styled_select_tag('criterias[]', options_for_select(available_criterias),+ id: "criterias",+ disabled: (@criterias.length >= 3),+ container_class: '-slim') %>+ </div>+ </div>+ <div class="grid-block">+ <%= submit_tag t(:button_apply), class: 'button -highlight' %>+ <%= link_to t(:button_clear), {project_id: @project, issue_id: @issue, period_type: params[:period_type], period: params[:period], from: @from, to: @to, columns: @columns}, class: 'button' %>+ </div>+ </div>+<% end %>+<% unless @criterias.empty? %>+ <div class="total-hours">+ <p><%= t(:label_total) %>: <%= html_hours(l_hours(@total_hours)) %></p>+ </div>++ <% unless @hours.empty? %>+ <div class="generic-table--container">+ <div class="generic-table--results-container">+ <table class="generic-table" id="time-report">+ <colgroup>+ <% @criterias.each do |criteria| %>+ <col highlight-col>+ <% end %>+ <% @periods.each do |period| %>+ <col highlight-col>+ <% end %>+ <col highlight-col>+ </colgroup>+ <thead>+ <tr>+ <% @criterias.each do |criteria| %>+ <th>+ <div class="generic-table--sort-header-outer">+ <div class="generic-table--sort-header">+ <span>+ <%= l_or_humanize(@available_criterias[criteria][:label]) %>+ </span>+ </div>+ </div>+ </th>+ <% end %>+ <% @periods.each do |period| %>+ <th class="period">+ <div class="generic-table--sort-header-outer">+ <div class="generic-table--sort-header">+ <span>+ <%= period %>+ </span>+ </div>+ </div>+ </th>+ <% end %>+ <th class="total">+ <div class="generic-table--sort-header-outer">+ <div class="generic-table--sort-header">+ <span>+ <%= t(:label_total) %>+ </span>+ </div>+ </div>+ </th>+ </tr>+ </thead>+ <tbody>+ <%= render partial: 'report_criteria', locals: {criterias: @criterias, hours: @hours, level: 0} %>+ <tr class="total">+ <td><%= t(:label_total) %></td>+ <%= ('<td></td>' * (@criterias.size - 1)).html_safe %>+ <% total = 0 -%>+ <% @periods.each do |period| -%>+ <% sum = sum_hours(select_hours(@hours, @columns, period.to_s)); total += sum -%>+ <td class="hours"><%= html_hours("%.2f" % sum) if sum > 0 %></td>+ <% end -%>+ <td class="hours"><%= html_hours("%.2f" % total) if total > 0 %></td>+ </tr>+ </tbody>+ </table>++ </div>+ </div>++ <%= other_formats_links do |f| %>+ <%= f.link_to 'CSV', url: permitted_params.timelog.to_h %>+ <% end %>+ <% end %>+<% end %>diff --git a/app/views/time_entries/reports/show.html.erb b/app/views/time_entries/reports/show.html.erbindex 03fc5689db8..26a0410b78b 100644--- a/app/views/time_entries/reports/show.html.erb+++ b/app/views/time_entries/reports/show.html.erb@@ -38,119 +38,8 @@ See docs/COPYRIGHT.rdoc for more details.<% end %><% end %>-<%= styled_form_tag(polymorphic_time_entries_report_path(@issue || @project), method: :get, id: 'query_form', class: '-vertical') do %>- <% @criterias.each do |criteria| %>- <%= hidden_field_tag 'criterias[]', criteria, id: nil %>- <% end %>- <%= render partial: 'timelog/date_range' %>-- <%= render_tabs time_entry_tabs %>-- <div class="timelog-report-selection small-6">- <div class="grid-block">-- <div class="form--field">- <%= styled_label_tag :columns, "#{t(:label_details)}:" %>- <%= styled_select_tag 'columns', options_for_select([[l(:label_year), 'year'],- [l(:label_month), 'month'],- [l(:label_week), 'week'],- [l(:label_day_plural).titleize, 'day']], @columns),- container_class: '-slim' %>- </div>-- <div class="form--field">- <%= styled_label_tag :criterias, "#{t(:button_add)}:" %>- <% available_criterias = [[]] + (@available_criterias.keys - @criterias).collect{ |k|- [l_or_humanize(@available_criterias[k][:label]), k]- }- %>- <%= styled_select_tag('criterias[]', options_for_select(available_criterias),- id: "criterias",- disabled: (@criterias.length >= 3),- container_class: '-slim') %>- </div>- </div>- <div class="grid-block">- <%= submit_tag t(:button_apply), class: 'button -highlight' %>- <%= link_to t(:button_clear), {project_id: @project, issue_id: @issue, period_type: params[:period_type], period: params[:period], from: @from, to: @to, columns: @columns}, class: 'button' %>- </div>- </div>-<% end %>-<% unless @criterias.empty? %>- <div class="total-hours">- <p><%= t(:label_total) %>: <%= html_hours(l_hours(@total_hours)) %></p>- </div>-- <% unless @hours.empty? %>- <div class="generic-table--container">- <div class="generic-table--results-container">- <table class="generic-table" id="time-report">- <colgroup>- <% @criterias.each do |criteria| %>- <col highlight-col>- <% end %>- <% @periods.each do |period| %>- <col highlight-col>- <% end %>- <col highlight-col>- </colgroup>- <thead>- <tr>- <% @criterias.each do |criteria| %>- <th>- <div class="generic-table--sort-header-outer">- <div class="generic-table--sort-header">- <span>- <%= l_or_humanize(@available_criterias[criteria][:label]) %>- </span>- </div>- </div>- </th>- <% end %>- <% @periods.each do |period| %>- <th class="period">- <div class="generic-table--sort-header-outer">- <div class="generic-table--sort-header">- <span>- <%= period %>- </span>- </div>- </div>- </th>- <% end %>- <th class="total">- <div class="generic-table--sort-header-outer">- <div class="generic-table--sort-header">- <span>- <%= t(:label_total) %>- </span>- </div>- </div>- </th>- </tr>- </thead>- <tbody>- <%= render partial: 'report_criteria', locals: {criterias: @criterias, hours: @hours, level: 0} %>- <tr class="total">- <td><%= t(:label_total) %></td>- <%= ('<td></td>' * (@criterias.size - 1)).html_safe %>- <% total = 0 -%>- <% @periods.each do |period| -%>- <% sum = sum_hours(select_hours(@hours, @columns, period.to_s)); total += sum -%>- <td class="hours"><%= html_hours("%.2f" % sum) if sum > 0 %></td>- <% end -%>- <td class="hours"><%= html_hours("%.2f" % total) if total > 0 %></td>- </tr>- </tbody>- </table>-- </div>- </div>+<%= render partial: 'timelog/date_range' %>- <%= other_formats_links do |f| %>- <%= f.link_to 'CSV', url: permitted_params.timelog.to_h %>- <% end %>- <% end %>-<% end %>+<%= render_tabs time_entry_tabs %><% html_title t(:label_spent_time), t(:label_report) %>diff --git a/app/views/timelog/_time_entry_tab.html.erb b/app/views/timelog/_time_entry_tab.html.erbindex eadd4ccacb9..61afead2d35 100644--- a/app/views/timelog/_time_entry_tab.html.erb+++ b/app/views/timelog/_time_entry_tab.html.erb@@ -26,3 +26,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.See docs/COPYRIGHT.rdoc for more details.++#%>++<div class="notification-box -warning">+ <a title="close" class="notification-box--close icon-context icon-close"></a>+ <div class="notification-box--content">+ <%= t('deprecations.time_entries') %>+ </div>+</div>+<div>+ <%= other_formats_links do |f| %>+ <%= f.link_to 'CSV', url: permitted_params.timelog.to_h %>+ <% end %>+</div>diff --git a/app/views/timelog/index.html.erb b/app/views/timelog/index.html.erbindex fb15aff7478..a054f3e5648 100644--- a/app/views/timelog/index.html.erb+++ b/app/views/timelog/index.html.erb@@ -44,16 +44,4 @@ See docs/COPYRIGHT.rdoc for more details.<%= render_tabs time_entry_tabs %>-<div class="notification-box -warning">- <a title="close" class="notification-box--close icon-context icon-close"></a>- <div class="notification-box--content">- <%= t('deprecations.time_entries') %>- </div>-</div>-<div>- <%= other_formats_links do |f| %>- <%= f.link_to 'CSV', url: permitted_params.timelog.to_h %>- <% end %>-</div>-<% html_title l(:label_spent_time) %>diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erbindex 6b9306e97e1..282675bc65d 100644--- a/app/views/users/edit.html.erb+++ b/app/views/users/edit.html.erb@@ -33,4 +33,4 @@ See docs/COPYRIGHT.rdoc for more details.<% local_assigns[:additional_breadcrumb] = @user.name %><%= render partial: 'toolbar', locals: { new_user: false } %>-<%= render_extensible_tabs :user %>+<%= render_extensible_tabs :user, user: @user %>diff --git a/config/locales/js-en.yml b/config/locales/js-en.ymlindex 5a3d775b53c..4c1255360c0 100644--- a/config/locales/js-en.yml+++ b/config/locales/js-en.yml@@ -94,6 +94,8 @@ en:entire_card_by: 'Entire card by'remove_from_list: 'Remove card from list'+ caption_rate_history: "Rate history"+clipboard:browser_error: "Your browser doesn't support copying to clipboard. Please copy the selected text manually."copied_successful: "Sucessfully copied to clipboard!"@@ -214,6 +216,7 @@ en:general_text_yes: "yes"general_text_No: "No"general_text_Yes: "Yes"+ global_roles: Global Roleshal:error:@@ -251,6 +254,7 @@ en:label_and: "and"label_ascending: "Ascending"label_author: "Author: %{user}"+ label_avatar: "Avatar"label_between: "between"label_board: "Board"label_board_locked: "Locked"@@ -503,6 +507,9 @@ en:comment: 'Comment'hours: 'Hours'+ two_factor_authentication:+ label_two_factor_authentication: 'Two-factor authentication'+watchers:label_loading: loading watchers...label_error_loading: An error occurred while loading the watchersdiff --git a/frontend/src/app/modules/admin/tabs/content-tabs.component.ts b/frontend/src/app/modules/admin/tabs/content-tabs.component.tsindex 6d00e877a3b..99c5d235357 100644--- a/frontend/src/app/modules/admin/tabs/content-tabs.component.ts+++ b/frontend/src/app/modules/admin/tabs/content-tabs.component.ts@@ -67,8 +67,8 @@ export class ContentTabsComponent extends ScrollableTabsComponent {readonly I18n:I18nService) {super();- this.gonTabs = JSON.parse((this.gon.get('content_tabs') as any).tabs);- this.currentTab = JSON.parse((this.gon.get('content_tabs') as any).selected);+ this.gonTabs = JSON.parse((this.gon.get('contentTabs') as any).tabs);+ this.currentTab = JSON.parse((this.gon.get('contentTabs') as any).selected);// parse tabs from backend and map them to scrollable tabs structurethis.tabs = this.gonTabs.map((tab:GonTab) => {diff --git a/frontend/src/app/modules/common/tabs/scrollable-tabs.component.ts b/frontend/src/app/modules/common/tabs/scrollable-tabs.component.tsindex cbcdfda6817..602a063f335 100644--- a/frontend/src/app/modules/common/tabs/scrollable-tabs.component.ts+++ b/frontend/src/app/modules/common/tabs/scrollable-tabs.component.ts@@ -1,10 +1,4 @@-import {- AfterViewInit,- Component,- ElementRef,- ViewChild,- ChangeDetectionStrategy-} from "@angular/core";+import {AfterViewInit, Component, ElementRef, ViewChild} from "@angular/core";export interface Tab {id:string;@@ -13,8 +7,7 @@ export interface Tab {}@Component({- templateUrl: 'scrollable-tabs.component.html',- changeDetection: ChangeDetectionStrategy.OnPush+ templateUrl: 'scrollable-tabs.component.html'})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 441ca983574..2e80ab9b9d6 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@@ -26,11 +26,7 @@// See docs/COPYRIGHT.rdoc for more details.// ++-import {- Component,- OnDestroy,- ChangeDetectionStrategy-} from '@angular/core';+import {Component, OnDestroy} from '@angular/core';import {DynamicBootstrapper} from "core-app/globals/dynamic-bootstrapper";import {GlobalSearchService} from "core-app/modules/global_search/services/global-search.service";import {Subscription} from "rxjs";@@ -40,8 +36,7 @@ export const globalSearchTabsSelector = 'global-search-tabs';@Component({selector: globalSearchTabsSelector,- templateUrl: '/app/modules/common/tabs/scrollable-tabs.component.html',- changeDetection: ChangeDetectionStrategy.OnPush+ templateUrl: '/app/modules/common/tabs/scrollable-tabs.component.html'})export class GlobalSearchTabsComponent extends ScrollableTabsComponent implements OnDestroy {diff --git a/lib/open_project/plugins/acts_as_op_engine.rb b/lib/open_project/plugins/acts_as_op_engine.rbindex d2db6124a6b..5dbae38a845 100644--- a/lib/open_project/plugins/acts_as_op_engine.rb+++ b/lib/open_project/plugins/acts_as_op_engine.rb@@ -206,8 +206,8 @@ module OpenProject::Plugins### Add a tab entry to an extensible tab- def add_tab_entry(key, name:, partial:, label:, only_if: nil)- ::OpenProject::Ui::ExtensibleTabs.add(key, name: name, partial: partial, label: label, only_if: only_if)+ def add_tab_entry(key, name:, partial:, path:, label:, only_if: nil)+ ::OpenProject::Ui::ExtensibleTabs.add(key, name: name, partial: partial, path: path, label: label, only_if: only_if)enddef add_api_path(path_name, &block)diff --git a/lib/open_project/ui/extensible_tabs.rb b/lib/open_project/ui/extensible_tabs.rbindex 6b6ee7eafc7..edac0cbe5cb 100644--- a/lib/open_project/ui/extensible_tabs.rb+++ b/lib/open_project/ui/extensible_tabs.rb@@ -55,9 +55,24 @@ module OpenProjectdef core_user_tabs[- { name: 'general', partial: 'users/general', label: :label_general },- { name: 'memberships', partial: 'users/memberships', label: :label_project_plural },- { name: 'groups', partial: 'users/groups', label: :label_group_plural, if: ->(*) { Group.all.any? } }+ {+ name: 'general',+ partial: 'users/general',+ path: -> (params) { tab_edit_user_path(params[:user], tab: :general) },+ label: :label_general+ },+ {+ name: 'memberships',+ partial: 'users/memberships',+ path: -> (params) { tab_edit_user_path(params[:user], tab: :memberships) },+ label: :label_project_plural+ },+ {+ name: 'groups',+ partial: 'users/groups',+ path: -> (params) { tab_edit_user_path(params[:user], tab: :groups) },+ label: :label_group_plural, if: ->(*) { Group.all.any? }+ }]endenddiff --git a/modules/avatars/lib/open_project/avatars/engine.rb b/modules/avatars/lib/open_project/avatars/engine.rbindex c14cc124f2b..e05565f5ec4 100644--- a/modules/avatars/lib/open_project/avatars/engine.rb+++ b/modules/avatars/lib/open_project/avatars/engine.rb@@ -53,6 +53,7 @@ module OpenProject::Avatarsadd_tab_entry :user,name: 'avatar',partial: 'avatars/users/avatar_tab',+ path: -> (params) { tab_edit_user_path(params[:user], tab: :avatar) },label: :label_avatar,only_if: ->(*) { ::OpenProject::Avatars::AvatarManager.avatars_enabled? }diff --git a/modules/costs/lib/open_project/costs/engine.rb b/modules/costs/lib/open_project/costs/engine.rbindex 2f2a775ef1d..ecaa0eda265 100644--- a/modules/costs/lib/open_project/costs/engine.rb+++ b/modules/costs/lib/open_project/costs/engine.rb@@ -103,6 +103,7 @@ module OpenProject::Costsadd_tab_entry :user,name: 'rates',partial: 'users/rates',+ path: -> (params) { tab_edit_user_path(params[:user], tab: :rates) },label: :caption_rate_historyadd_api_attribute on: :work_package, ar_name: :cost_object_iddiff --git a/modules/global_roles/lib/open_project/global_roles/engine.rb b/modules/global_roles/lib/open_project/global_roles/engine.rbindex fa5146a5fa5..d4c45fdd5f6 100644--- a/modules/global_roles/lib/open_project/global_roles/engine.rb+++ b/modules/global_roles/lib/open_project/global_roles/engine.rb@@ -49,6 +49,7 @@ module OpenProject::GlobalRolesadd_tab_entry :user,name: 'global_roles',partial: 'users/global_roles',+ path: -> (params) { tab_edit_user_path(params[:user], tab: :global_roles) },label: :global_rolesinitializer 'patch helper' dodiff --git a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/engine.rb b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/engine.rbindex 3ab964a829b..544b37d6345 100644--- a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/engine.rb+++ b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/engine.rb@@ -53,6 +53,7 @@ module OpenProject::TwoFactorAuthenticationadd_tab_entry :user,name: 'two_factor_authentication',partial: 'users/two_factor_authentication',+ path: -> (params) { tab_edit_user_path(params[:user], tab: :two_factor_authentication) },label: 'two_factor_authentication.label_two_factor_authentication',only_if: ->(*) { OpenProject::TwoFactorAuthentication::TokenStrategyManager.enabled? }