From 35f6891f2d7115df4c4b823f372678f2da01e104 Mon Sep 17 00:00:00 2001 From: disc5 Date: Tue, 31 May 2016 11:50:33 +0200 Subject: [PATCH] Improved ngCheckout app --- .../extensions/docs_v1/routes/DocRoutes.php | 4 ++-- .../REST/apps/checkout/css/app.css | 12 +++++++++++- .../REST/apps/checkout/js/controllers.js | 13 ++++++++++++- .../REST/apps/checkout/partials/checkout.html | 4 +++- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/RESTController/extensions/docs_v1/routes/DocRoutes.php b/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/RESTController/extensions/docs_v1/routes/DocRoutes.php index bcffd02e..9cda6641 100644 --- a/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/RESTController/extensions/docs_v1/routes/DocRoutes.php +++ b/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/RESTController/extensions/docs_v1/routes/DocRoutes.php @@ -25,7 +25,7 @@ $model = new DocumentationModel(); $result = $model->getDocumentation($route, $verb); - $resp = array('results ' => $result); + $resp = array('results' => $result); $app->success($resp); } catch (Libs\RESTException $e) { @@ -40,7 +40,7 @@ $app->get('/routes', function () use ($app) { $model = new DocumentationModel(); $result = $model->getCompleteApiDocumentation(); - $resp = array('results ' => $result); + $resp = array('results' => $result); $app->success($resp); }); diff --git a/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/checkout/css/app.css b/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/checkout/css/app.css index 64bbc1cc..9a8d20b9 100644 --- a/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/checkout/css/app.css +++ b/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/checkout/css/app.css @@ -122,4 +122,14 @@ body { .navbar-default-x { border-bottom: 1px solid #ccc; -} \ No newline at end of file +} + +#descriptionBox { + padding-left: 10px; + padding-right: 60px; + padding-top: 20px; +} + +.dropdown-menu-right { + width: 95vw; +} diff --git a/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/checkout/js/controllers.js b/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/checkout/js/controllers.js index 6755659e..69fa6c2a 100644 --- a/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/checkout/js/controllers.js +++ b/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/checkout/js/controllers.js @@ -86,6 +86,7 @@ ctrl.controller("CheckoutCtrl", function($sce, $scope, $location, $filter, $reso $scope.inputVerbIndicator = "GET"; //$scope.requestParameters = ""; $scope.setParameterTemplate(); + $scope.description = ""; }; $scope.setParameterTemplate = function() { @@ -145,6 +146,7 @@ ctrl.controller("CheckoutCtrl", function($sce, $scope, $location, $filter, $reso $scope.inputVerbIndicator = route.verb; $scope.inputRestEndpoint = route.pattern; // Call API for auxiliary information about the route. + $scope.description = ""; $scope.callDocAPI(route); } @@ -157,7 +159,16 @@ ctrl.controller("CheckoutCtrl", function($sce, $scope, $location, $filter, $reso Res.query( JSON.parse(params), // Success function (response) { - $scope.result = jsonPrettyPrint.prettyPrint(response); + try { + if (response['results'][0]!=null) { + //$scope.result = jsonPrettyPrint.prettyPrint(response); + $scope.description = response['results'][0]['description']; + $scope.requestParameters = response['results'][0]['parameters']; + } + + } catch (err) { + console.log(err); + } }, // Failure function (response){ diff --git a/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/checkout/partials/checkout.html b/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/checkout/partials/checkout.html index 8bb0d4db..6d50bdee 100644 --- a/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/checkout/partials/checkout.html +++ b/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/checkout/partials/checkout.html @@ -35,7 +35,9 @@

{{'REST Query' | translate}}

- +
+ {{description}} +