Sha256: ddc3a85f0fde790795177774f88169852586e7fed0282458b65ed55b41c4fa37

Contents?: true

Size: 1.9 KB

Versions: 2

Compression:

Stored size: 1.9 KB

Contents

o: ActiveSupport::Cache::Entry	:@compressedF:@expires_in0:@created_atf1373900105.409687:@value"3{I"
class:EFI"ProcessedAsset;FI"logical_path;FI"Bcollection_json_browser/angular/controllers/api_controller.js;TI"
pathname;FI"ƒ/Users/weilu/workspace/collection-json-browser/app/assets/javascripts/collection_json_browser/angular/controllers/api_controller.js;TI"content_type;FI"application/javascript;FI"
mtime;FI"2013-07-15T22:55:04+08:00;FI"length;FiQI"digest;F"%33a689ae81c1fc2783e2010054f8bbe4I"source;FI"Q'use strict';

function ApiController($scope, $http, $location) {
  $scope.goTo = function(path) {
    $location.path(path)
  }

  $scope.post = function() {
    var formData = {};
    $scope.collection.template.data.forEach(function(f){ formData[f.name] = f.value })
    $http.post($scope.collection.href, formData).success(successHandler)
  }

  $scope.$watch(function() {
    return $location.path()
  }, function(path, oldPath) {
    if(path !== oldPath) get(path)
  });

  get('/api')

  // helpers

  function get(path) {
    $http.get(path).success(successHandler)
  }

  function successHandler(data, status) {
    $scope.collection = data.collection;
    $scope.raw = JSON.stringify(data, undefined, 2)
    $scope.status = status

    $location.path($scope.collection.href)
  }
}


ApiController.$inject = ['$scope', '$http', '$location'];
;FI"dependency_digest;F"%aad615edf2d99327d1e5f76d5b29b683I"required_paths;F[I"ƒ/Users/weilu/workspace/collection-json-browser/app/assets/javascripts/collection_json_browser/angular/controllers/api_controller.js;TI"dependency_paths;F[{I"	path;FI"ƒ/Users/weilu/workspace/collection-json-browser/app/assets/javascripts/collection_json_browser/angular/controllers/api_controller.js;TI"
mtime;FI"2013-07-15T22:55:04+08:00;FI"digest;F"%33a689ae81c1fc2783e2010054f8bbe4I"
_version;F"%6776f581a4329e299531e1d52aa59832

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
collection-json-browser-0.0.2 test/dummy/tmp/cache/assets/D01/390/sprockets%2F152365a6c64bdbf13d80c22762c0f48b
collection-json-browser-0.0.1 test/dummy/tmp/cache/assets/D01/390/sprockets%2F152365a6c64bdbf13d80c22762c0f48b