diff --git a/app/Http/Controllers/AdminPaginationController.php b/app/Http/Controllers/AdminPaginationController.php index 3fc24c0..4276c92 100644 --- a/app/Http/Controllers/AdminPaginationController.php +++ b/app/Http/Controllers/AdminPaginationController.php @@ -22,7 +22,7 @@ class AdminPaginationController extends Controller { ->addColumn('api_action', function ($user) { // Add "API Info" action button return ' + ng-click="openAPIModal($event, \'' . $user->username . '\', \'' . $user->id . '\')" id="api_info_btn_' . $user->id . '" data-api-active="' . $user->api_active . '" data-api-key="' . $user->api_key . '" data-api-quota="' . $user->api_quota . '"> API info '; }) diff --git a/public/js/AdminCtrl.js b/public/js/AdminCtrl.js index 9e4e4e1..bf6aef5 100644 --- a/public/js/AdminCtrl.js +++ b/public/js/AdminCtrl.js @@ -221,6 +221,7 @@ polr.controller('AdminCtrl', function($scope, $compile) { } else { status_display_elem.text(new_status); } + $('a#api_info_btn_' + user_id).attr('data-api-key', new_status); }); }; @@ -268,15 +269,18 @@ polr.controller('AdminCtrl', function($scope, $compile) { 'user_id': user_id, 'new_quota': parseInt(new_quota) }, function(next_action) { + $('a#api_info_btn_' + user_id).attr('data-api-quota', new_quota); toastr.success("Quota successfully changed.", "Success"); }); }; // Open user API settings menu - $scope.openAPIModal = function($event, username, api_key, api_active, api_quota, user_id) { + $scope.openAPIModal = function($event, username, user_id) { var el = $($event.target); api_active = $('a#api_info_btn_' + user_id).attr('data-api-active'); + api_key = $('a#api_info_btn_' + user_id).attr('data-api-key'); + api_quota = $('a#api_info_btn_' + user_id).attr('data-api-quota'); var markup = $('#api-modal-template').html();