Fix work package time entries sorting

pull/1166/head
Hagen Schink 11 years ago
parent 70c1e845bf
commit f0768b1dd1
  1. 2
      app/assets/javascripts/angular/controllers/time-entries-controllers.js
  2. 14
      app/assets/javascripts/angular/helpers/components/path-helper.js
  3. 1
      app/controllers/timelog_controller.rb

@ -40,7 +40,7 @@ angular.module('openproject.timeEntries.controllers')
$scope.loadTimeEntries = function() { $scope.loadTimeEntries = function() {
$scope.isLoading = true; $scope.isLoading = true;
$http.get(PathHelper.timeEntriesPath(gon.project_id), $http.get(PathHelper.timeEntriesPath(gon.project_id, gon.work_package_id),
{ {
params: { params: {
sort: SortService.getSortParam(), sort: SortService.getSortParam(),

@ -55,12 +55,16 @@ angular.module('openproject.helpers')
projectPath: function(projectIdentifier) { projectPath: function(projectIdentifier) {
return PathHelper.projectsPath() + '/' + projectIdentifier; return PathHelper.projectsPath() + '/' + projectIdentifier;
}, },
timeEntriesPath: function(projectIdentifier) { timeEntriesPath: function(projectIdentifier, workPackageIdentifier) {
if (projectIdentifier) { var path = '/time_entries/';
return PathHelper.projectPath(projectIdentifier) + '/time_entries/';
} else { if (workPackageIdentifier) {
return '/time_entries/'; return PathHelper.workPackagePath(workPackageIdentifier) + path;
} else if (projectIdentifier) {
return PathHelper.projectPath(projectIdentifier) + path;
} }
return path;
}, },
timeEntryPath: function(timeEntryIdentifier) { timeEntryPath: function(timeEntryIdentifier) {
return '/time_entries/' + timeEntryIdentifier; return '/time_entries/' + timeEntryIdentifier;

@ -72,6 +72,7 @@ class TimelogController < ApplicationController
gon.rabl "app/views/timelog/index.rabl" gon.rabl "app/views/timelog/index.rabl"
gon.project_id = @project.id if @project gon.project_id = @project.id if @project
gon.work_package_id = @issue.id if @issue
gon.sort_column = 'spent_on' gon.sort_column = 'spent_on'
gon.sort_direction = 'desc' gon.sort_direction = 'desc'
gon.total_count = total_entry_count(cond) gon.total_count = total_entry_count(cond)

Loading…
Cancel
Save