test/dummy/tmp/cache/assets/test/sprockets/816bfd11725a6e3a206bfed45256be5a in lina-0.0.1 vs test/dummy/tmp/cache/assets/test/sprockets/816bfd11725a6e3a206bfed45256be5a in lina-0.0.2
- old
+ new
@@ -1,8 +1,8 @@
{I"
class:ETI"BundledAsset; FI"logical_path; TI"lina/application.js; TI"
pathname; TI"N/Users/yafeilee/workspace/lina/app/assets/javascripts/lina/application.js; FI"content_type; TI"application/javascript; TI"
-mtime; Tl+nTI"length; TiI"digest; TI"%cdc40167e41c52bd94e394718827df89; FI"source; TI"/*!
+mtime; Tl+TI"length; TiI"digest; TI"%54e3da705d5efbae20a9f1d7f2fc0b91; FI"source; TI"/*!
* jQuery JavaScript Library v1.11.2
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
@@ -42479,11 +42479,11 @@
for_each_branch(function(b, level) {
if (!b.uid) {
return b.uid = "" + Math.random();
}
});
- console.log('UIDs are set.');
+ //console.log('UIDs are set.');
for_each_branch(function(b) {
var child, _i, _len, _ref, _results;
if (angular.isArray(b.children)) {
_ref = b.children;
_results = [];
@@ -42580,11 +42580,11 @@
});
}
});
}
n = scope.treeData.length;
- console.log('num root branches = ' + n);
+ //console.log('num root branches = ' + n);
for_each_branch(function(b, level) {
b.level = level;
return b.expanded = b.level < expand_level;
});
if (scope.treeControl != null) {
@@ -42856,23 +42856,128 @@
$http.get($scope.dataURL).then( function(res){
$scope.my_data = res.data;
});
}
- $scope.isRequired = function(params, name){
- return params.required.indexOf(name) != -1;
- }
+}])
+;
+app.factory('RecursionHelper', ['$compile', function($compile){
+ return {
+ /**
+ * Manually compiles the element, fixing the recursion loop.
+ * @param element
+ * @param [link] A post-link function, or an object with function(s) registered via pre and post properties.
+ * @returns An object containing the linking functions.
+ */
+ compile: function(element, link){
+ // Normalize the link parameter
+ if(angular.isFunction(link)){
+ link = { post: link };
+ }
- $scope.moreInfo = function(properties) {
- properties = _.clone(properties);
- ['type', 'description'].forEach(function(e){
- delete properties[e];
- })
- var info = '';
- _.keys(properties).forEach( function(k) {
- info = info + k + ": " + properties[k] + "\n";
- })
- return info;
- }
+ // Break the recursion loop by removing the contents
+ var contents = element.contents().remove();
+ var compiledContents;
+ return {
+ pre: (link && link.pre) ? link.pre : null,
+/**
+ * Compiles and re-adds the contents
+ */
+ post: function(scope, element){
+ // Compile the contents
+ if(!compiledContents){
+ compiledContents = $compile(contents);
+ }
+ // Re-add the compiled contents to the element
+ compiledContents(scope, function(clone){
+ element.append(clone);
+ });
+
+ // Call the post-linking function, if any
+ if(link && link.post){
+ link.post.apply(null, arguments);
+ }
+ }
+ };
+ }
+ };
+}]);
+
+app.directive('jsonSchema', [ 'RecursionHelper', function(RecursionHelper){
+ return {
+ restrict: 'E',
+ scope: {
+ schema: '='
+ },
+ controller: ['$scope', function($scope){
+ $scope.isRequired = function(params, name){
+ return _.contains(params.required, name);
+ }
+
+ $scope.moreInfo = function(properties) {
+ properties = _.clone(properties);
+ ['type', 'description'].forEach(function(e){
+ delete properties[e];
+ })
+ var info = '';
+ _.keys(properties).forEach( function(k) {
+ info = info + k + ": " + properties[k] + "\n";
+ })
+ return info || '-';
+ }
+
+ $scope.isOneOf = function(){
+ return !! $scope.schema.oneOf;
+ }
+
+ $scope.isObject = function(){
+ return !! $scope.schema.properties;
+ }
+
+ $scope.isString = function(){
+ return $scope.schema.type == 'string';
+ }
+
+ $scope.isArray = function(){
+ return $scope.schema.type == 'array';
+ }
+
+ $scope.isNull = function(){
+ return $scope.schema.type == 'null';
+ }
+
+ $scope.isBoolean = function(){
+ return $scope.schema.type == 'boolean';
+ }
+
+ $scope.isEmpty = function(){
+ return _.isEmpty($scope.schema);
+ }
+
+ $scope.hasMoreInfo = function(value){
+ return value.type !== 'array'
+ }
+
+ // translate { '$ref': '#/definitions/xx' } to real hash
+ $scope.refInfo = function(ref_hash){
+ var ref = ref_hash['$ref'];
+ var refs = ref.split('/');
+ var res;
+ _.each(refs, function(ref){
+ if( ref === '#' ){
+ res = $scope.schema;
+ }else{
+ res = res[ref];
+ }
+ });
+ return res;
+ }
+ }],
+ compile: function(element){
+ return RecursionHelper.compile(element);
+ },
+ templateUrl: '/assets/templates/lina/schema.html'
+ };
+
}])
;
-; TI"required_assets_digest; TI"%2d85e8b80666b2661ba6d99eb0ab418b; FI"
_version; TI"%4bf7b15359fe8e0974f7f263e26e27f4; F
+; TI"required_assets_digest; TI"%ffd813ae4588de8b60ebab105b93c9f9; FI"
_version; TI"%4bf7b15359fe8e0974f7f263e26e27f4; F
\ No newline at end of file