Skip to content

Commit

Permalink
Merge pull request #11 from ekomi-ltd/IT-15901-link-search-fix
Browse files Browse the repository at this point in the history
IT-15901 : Changing query for user links
  • Loading branch information
amanmukhtar authored May 16, 2024
2 parents 467e360 + 37c8be8 commit ddc19a8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## [2.4.7] Date : 16-05-2024
- IT-15901 : Link searching is not working

## [2.4.6] Date : 30-11-2021

- IT-15080 : Integrate bugsnag in Polr

## [2.4.5] Date : 24-11-2021

- IT-15031 : Change docker base image to fix php version
- IT-15027 : Add support for . and @ in Polr URL shortener
3 changes: 2 additions & 1 deletion app/Http/Controllers/AdminPaginationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ public function paginateUserLinks(Request $request) {

$username = session('username');
$user_links = Link::where('creator', $username)
->select(['id', 'short_url', 'long_url', 'clicks', 'created_at']);
->select(['id', 'short_url', 'long_url', 'clicks', 'created_at'])
->orderBy('id', 'desc');

return Datatables::of($user_links)
->editColumn('clicks', [$this, 'renderClicksCell'])
Expand Down
31 changes: 21 additions & 10 deletions public/js/AdminCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,27 @@ polr.controller('AdminCtrl', function($scope, $compile, $timeout) {
}, datatables_config));
}

$scope.datatables['user_links_table'] = $('#user_links_table').DataTable($.extend({
"ajax": BASE_API_PATH + 'admin/get_user_links',

"columns": [
{className: 'wrap-text', data: 'short_url', name: 'short_url'},
{className: 'wrap-text', data: 'long_url', name: 'long_url'},
{data: 'clicks', name: 'clicks'},
{data: 'created_at', name: 'created_at'}
]
}, datatables_config));
$scope.datatables['user_links_table'] = $('#user_links_table').DataTable( {
ajax: BASE_API_PATH + 'admin/get_user_links',
serverSide: true,
processing: true,
autoWidth: false,
deferRender: true,
searchDelay:3000,
search: {
return: true
},
columns: [
{className: 'wrap-text', data: 'short_url', name: 'short_url', orderable: false},
{className: 'wrap-text', data: 'long_url', name: 'long_url', orderable: false},
{data: 'clicks', name: 'clicks', searchable: false},
{data: 'created_at', name: 'created_at', searchable: false},
],
drawCallback: function () {
// Compile Angular bindings on each draw
$compile($(this))($scope);
}
});
};

$scope.reloadLinkTables = function () {
Expand Down

0 comments on commit ddc19a8

Please sign in to comment.