Sha256: be0782fdeb05acd94e57998c7d8179edd2b8edd5680ba0a0b287a9eca4d580b4

Contents?: true

Size: 1.53 KB

Versions: 15

Compression:

Stored size: 1.53 KB

Contents

app.controller('ActionCtrl', function($scope, $stateParams, Documentation, normalizeAttributes, PageInfo) {
  $scope.controllerName = $stateParams.controller;
  $scope.actionName = $stateParams.action;
  $scope.apiVersion = $stateParams.version;

  Documentation.controller($stateParams.version, $stateParams.controller).then(function(response) {

    $scope.controller = response;
    PageInfo.title = $scope.controller.display_name + ' ยป ' + $scope.actionName;
    $scope.action = _.find(response.actions, function(action) { return action.name === $scope.actionName; });
    if (!$scope.action) {
      $scope.error = true;
      return;
    }
    // Extract the example and attach it to each attribute
    _.forEach(['headers', 'params', 'payload'], function(n) {
      var set = $scope.action[n];
      if (set) {
        normalizeAttributes(set, set.type.attributes);
      }
    });

    $scope.responses = [];
    _.forEach($scope.action.responses, function(response, name) {
      response.name = name;
      response.options = {
        headers: response.headers
      };

      response.numExamples = _.keys(_.get(response, 'payload.examples')).length;

      $scope.responses.push(response);

      if(response.parts_like) {
        response.parts_like.isMultipart = true;
        response.parts_like.options = {
          headers: response.parts_like.headers
        };
        $scope.responses.push(response.parts_like);
      }
    });
  });

  $scope.hasResponses = function() {
    return $scope.action ? _.any($scope.action.responses) : false;
  };
});

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
praxis-2.0.pre.9 lib/api_browser/app/js/controllers/action.js
praxis-2.0.pre.8 lib/api_browser/app/js/controllers/action.js
praxis-2.0.pre.7 lib/api_browser/app/js/controllers/action.js
praxis-2.0.pre.6 lib/api_browser/app/js/controllers/action.js
praxis-2.0.pre.5 lib/api_browser/app/js/controllers/action.js
praxis-2.0.pre.4 lib/api_browser/app/js/controllers/action.js
praxis-2.0.pre.3 lib/api_browser/app/js/controllers/action.js
praxis-2.0.pre.2 lib/api_browser/app/js/controllers/action.js
praxis-2.0.pre.1 lib/api_browser/app/js/controllers/action.js
praxis-0.22.pre.2 lib/api_browser/app/js/controllers/action.js
praxis-0.22.pre.1 lib/api_browser/app/js/controllers/action.js
praxis-0.21 lib/api_browser/app/js/controllers/action.js
praxis-0.20.1 lib/api_browser/app/js/controllers/action.js
praxis-0.20.0 lib/api_browser/app/js/controllers/action.js
praxis-0.19.0 lib/api_browser/app/js/controllers/action.js