Sketch summation rows in angular work packages table

pull/913/head
Till Breuer 11 years ago
parent 07050f1f63
commit 345437a136
  1. 4
      app/assets/javascripts/angular/directives/components/work-package-column-directive.js
  2. 5
      app/assets/javascripts/angular/directives/work_packages/work-packages-table-directive.js
  3. 2
      app/controllers/work_packages_controller.rb
  4. 1
      app/views/work_packages/_list.html.erb
  5. 1
      config/locales/de.yml
  6. 1
      config/locales/en.yml
  7. 21
      public/templates/work_packages/work_packages_table.html

@ -12,9 +12,11 @@ angular.module('openproject.uiComponents')
templateUrl: '/templates/components/work_package_column.html',
link: function(scope, element, attributes) {
var defaultText = '';
var defaultType = 'text';
// Set text to be displayed
scope.displayText = WorkPackagesHelper.getRowObjectContent(scope.workPackage, scope.column.name) || defaultText;
scope.displayType = 'text';
scope.displayType = defaultType;
// TODO RS: Manually set all the column display types. We will need:

@ -11,7 +11,8 @@ angular.module('openproject.workPackages.directives')
rows: '=',
currentSortation: '=',
countByGroup: '=',
groupBy: '='
groupBy: '=',
displaySums: '='
},
link: function(scope, element, attributes) {
scope.I18n = I18n;
@ -25,6 +26,8 @@ angular.module('openproject.workPackages.directives')
scope.groupByColumn = scope.columns[groupByColumnIndex];
scope.grouped = scope.groupByColumn !== undefined;
scope.groupExpanded = {};
scope.displaySums = scope.displaySums && scope.grouped; // only display sums when rows are grouped
}
};
}]);

@ -451,7 +451,7 @@ class WorkPackagesController < ApplicationController
def push_table_data_via_gon(results)
gon.project_identifier = @project.to_param
gon.query = @query.as_json only: :group_by
gon.query = @query.as_json only: [:group_by, :display_sums]
gon.columns = @query.columns.map do |column|
{ name: column.name, title: column.caption, sortable: column.sortable, groupable: column.groupable }

@ -38,6 +38,7 @@ See doc/COPYRIGHT.rdoc for more details.
current-sortation="currentSortation"
group-by="query.group_by"
count-by-group="workPackageCountByGroup"
display-sums="query.display_sums"
class="list issues">
</work-packages-table>

@ -561,6 +561,7 @@ de:
label_expand: "Aufklappen"
label_expand_all: "Alle aufklappen"
label_sort_by: "Sortiert nach"
label_sum_for: "Summe für"
label_work_package: "Arbeitspaket"
logoff: "Sie wurden ausgeloggt."
redirect_login: "Wollen Sie auf die Login-Seite weitergeleitet werden?"

@ -558,6 +558,7 @@ en:
label_expand_all: "Expand all"
label_no_data: "No data to display"
label_sort_by: "Sort by"
label_sum_for: "Sum for"
label_work_package: "Work package"
logoff: You have been logged off
redirect_login: Do you want to be redirected to the login page?

@ -68,8 +68,7 @@
</td>
</tr>
<tr ng-repeat-end
id="work-package-{{ row.object.id }}"
<tr id="work-package-{{ row.object.id }}"
ng-class="[
'hascontextmenu',
'issue',
@ -100,5 +99,23 @@
<span work-package-column work-package="row.object" column="column"/>
</td>
</tr>
<tr ng-repeat-end
ng-if="displaySums &&
($last || (row.object | columnContent:groupBy) !== (rows[$index+1].object | columnContent:groupBy))"
ng-class="[
$even && 'even' || '',
$odd && 'odd' || '',
'sum',
'grouped',
'issue',
'work_package'
]">
<td colspan="2">{{ I18n.t('js.label_sum_for')}} {{ row.object | columnContent:groupBy }}</td>
<td colspan="{{ columns.length }}"/>
</tr>
</tbody>
</table>

Loading…
Cancel
Save