Skip to content

Commit

Permalink
Improved ngCheckout app
Browse files Browse the repository at this point in the history
  • Loading branch information
disc5 committed May 31, 2016
1 parent 8ebc4a0 commit 35f6891
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,14 @@ body {

.navbar-default-x {
border-bottom: 1px solid #ccc;
}
}

#descriptionBox {
padding-left: 10px;
padding-right: 60px;
padding-top: 20px;
}

.dropdown-menu-right {
width: 95vw;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
}

Expand All @@ -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){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ <h3 class="panel-title">{{'REST Query' | translate}}</h3>
</ul>
</div>
</div>

<div id="descriptionBox">
{{description}}
</div>
<div id="paramBox">
<div class="form-group">
<label for="requestParameters">Parameters (JSON)</label>
Expand Down

0 comments on commit 35f6891

Please sign in to comment.