Task 5454 - Fixed pagination bugs and related features.

pull/1065/head
Richard 11 years ago
parent 536d48def9
commit 3b9a3b5f0b
  1. 4
      app/assets/javascripts/angular/controllers/work-packages-controller.js
  2. 24
      app/controllers/work_packages_controller.rb

@ -58,6 +58,10 @@ angular.module('openproject.workPackages.controllers')
if (!$scope.columns) $scope.columns = meta.columns;
if (!$scope.query) initQuery(meta.query);
PaginationService.setPerPageOptions(meta.per_page_options);
PaginationService.setPerPage(meta.per_page);
PaginationService.setPage(meta.page);
$scope.rows = WorkPackagesTableHelper.getRows(json.work_packages, $scope.query.group_by);
$scope.workPackageCountByGroup = meta.work_package_count_by_group;

@ -452,28 +452,4 @@ class WorkPackagesController < ApplicationController
private
# ------------------- Form JSON reponse for angular -------------------
# TODO implement in API rabl template
def get_column_includes(selected_columns=[])
selected_associations = {
assigned_to: { only: :id, methods: :name },
author: { only: :id, methods: :name },
category: { only: :name },
priority: { only: :name },
project: { only: [:name, :identifier] },
responsible: { only: :id, methods: :name },
status: { only: :name },
type: { only: :name },
parent: { only: :subject },
fixed_version: { only: [:name, :id] }
}.slice(*selected_columns.map(&:name))
selected_associations.merge!(custom_values: { only: [:custom_field_id, :value] }) if selected_columns.any? {|c| c.is_a? QueryCustomFieldColumn}
# TODO retrieve custom values in a single query like this and extend the work_packages inside the JSON:
# WorkPackage.includes(:custom_values).where(['work_packages.id in (?) AND custom_values.custom_field_id in (?)', @query.results.map(&:id), custom_field_columns.map(&:id)])
selected_associations
end
end

Loading…
Cancel
Save