Skip to content

Commit

Permalink
Sorting bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
gregapompe committed Feb 18, 2015
1 parent 3cadd7e commit 3d4ab70
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
18 changes: 11 additions & 7 deletions lib/TableEdit/Routes/API.pm
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,12 @@ get '/menu' => require_login sub {
};


get '/:class/:column/image/:file' => require_login sub {
my $class_info = schema_info->class(param('class'));
my $column_info = $class_info->column(param('column'));
my $file = param('file');
get '/:class/:column/image/**' => require_login sub {
my ($splat) = splat;
my (undef, $class,$column, undef, @file) = @$splat;
my $class_info = schema_info->class($class);
my $column_info = $class_info->column($column);
my $file = join '/', @file;
my $path = $column_info->upload_dir;
return send_file($path.$file);
};
Expand Down Expand Up @@ -490,10 +492,12 @@ Returns sql order by parameter.
sub grid_sort {
my ($class_info, $get_params) = @_;
# Direction
($get_params->{descending} ? $class_info->sort_direction('DESC') : $class_info->sort_direction('')) if $get_params->{sort};
($get_params->{descending} ? $class_info->sort_direction('-desc') : $class_info->sort_direction('-asc')) if $get_params->{sort};
# Selected or Predefined sort
$class_info->sort_column($get_params->{sort}) if $get_params->{sort};
return $class_info->sort_column . " " . $class_info->sort_direction if $class_info->sort_column;
if( $get_params->{sort} and $class_info->column($get_params->{sort})){
$class_info->sort_column($get_params->{sort}) ;
}
return {$class_info->sort_direction => $class_info->sort_column} if $class_info->sort_column;
}


Expand Down
3 changes: 1 addition & 2 deletions public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ CrudApp.factory('AuthInterceptor',['$q','$location','$rootScope', function($q,$l
$rootScope.user = null;
console.log("Response Error 403",rejection);
}
$location.path('/login');
return $q.reject(rejection);
}
}
Expand Down Expand Up @@ -901,7 +900,7 @@ var ListCtrl = function ($scope, $rootScope, $routeParams, $location, Class, Cla
var from_page = (current_page - page_scope > 0) ? (current_page - page_scope) : 1;
var to_page = (current_page + page_scope < pages) ? (current_page + page_scope) : pages;
$scope.data.sort_column = data.sort_column;
$scope.sort_desc = data.sort_direction == 'DESC' ? true : false;
$scope.sort_desc = data.sort_direction == '-desc' ? true : false;

$scope.page_list = [];
for (var i = from_page; i <= to_page; i++) {
Expand Down

0 comments on commit 3d4ab70

Please sign in to comment.