Sha256: 25af9dbe84983c4ecf622b9564bc43accc3408e44ee0f9a7c61021f59daa927e

Contents?: true

Size: 1.9 KB

Versions: 2

Compression:

Stored size: 1.9 KB

Contents

o: ActiveSupport::Cache::Entry	:@compressedF:@expires_in0:@created_atf1373900105.4103098:@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/CC8/CC0/sprockets%2F77ac1342b1ae62c0123f399257a703aa
collection-json-browser-0.0.1 test/dummy/tmp/cache/assets/CC8/CC0/sprockets%2F77ac1342b1ae62c0123f399257a703aa