<commit_before>// TODO : 
//
// 1 ) reassign symbols from AAA -> on 
// 2 ) make filter with direct substitution

angular.module('niomApp')
.controller('PiecesListCtrl', function($scope, $http, $resource, $location, Pieces, Categories )
{
	console.log("Closing Drawer");
	document.getElementById('mainscaffold').closeDrawer();

	$scope.pieces = Pieces.query( );	
	$scope.edit 		= function( item ){ $location.path( '/pieces/' + item.id ); };
	$scope.delete 		= function( item )	{ item.$delete( function() { $scope.pieces = Pieces.query( ); $location.path( '/pieces' ); }); };
	$scope.new 			= function( ){ $location.path( '/pieces/new' ); };

})

.controller('PiecesNewCtrl', function($scope, $http, $resource, $location, Pieces, Categories )
{
	document.getElementById('mainscaffold').closeDrawer();

	$scope.current_piece = new Pieces();
	$scope.current_piece.legend  = {};
	$scope.current_piece.content  = "";
	$scope.current_piece.language = "fr";

	$scope.add = function( ){ 
		console.log("Saving !");
		$scope.current_piece.legend = JSON.stringify($scope.current_piece.legend);
		$scope.current_piece.$save( function() { console.log("SAVED"); $location.path( '/pieces' ); } );
	};
	
})
.controller('PiecesDetailCtrl', function($scope, $http, $routeParams, $resource, $location, Pieces, Categories )
{
	document.getElementById('mainscaffold').closeDrawer();

	$scope.current_piece = Pieces.get( {uuid : $routeParams.pieceId }, function () {
		console.log("Arrived ! appending."); 
		$scope.current_piece.legend = angular.fromJson($scope.current_piece.legend);
	});

	$scope.add = function( ){ 
		console.log("Saving !");
		$scope.current_piece.legend = JSON.stringify($scope.current_piece.legend);
		$scope.current_piece.$update( {uuid:$scope.current_piece.id}, function(){ console.log("Updated !"); $location.path( '/pieces' );} );
	};
	
});<commit_msg>Pieces default<commit_after>// TODO : 
//
// 1 ) reassign symbols from AAA -> on 
// 2 ) make filter with direct substitution

angular.module('niomApp')
.controller('PiecesListCtrl', function($scope, $http, $resource, $location, Pieces, Categories )
{
	console.log("Closing Drawer");
	document.getElementById('mainscaffold').closeDrawer();

	$scope.pieces = Pieces.query( );	
	$scope.edit 		= function( item ){ $location.path( '/pieces/' + item.id ); };
	$scope.delete 		= function( item )	{ item.$delete( function() { $scope.pieces = Pieces.query( ); $location.path( '/pieces' ); }); };
	$scope.new 			= function( ){ $location.path( '/pieces/new' ); };

})

.controller('PiecesNewCtrl', function($scope, $http, $resource, $location, Pieces, Categories )
{
	document.getElementById('mainscaffold').closeDrawer();

	$scope.current_piece = new Pieces();
	$scope.current_piece.legend  = {};
	$scope.current_piece.content  = "";
	$scope.current_piece.tags  = "";
	$scope.current_piece.language = "fr";

	$scope.add = function( ){ 
		console.log("Saving !");
		$scope.current_piece.legend = JSON.stringify($scope.current_piece.legend);
		$scope.current_piece.$save( function() { console.log("SAVED"); $location.path( '/pieces' ); } );
	};
	
})
.controller('PiecesDetailCtrl', function($scope, $http, $routeParams, $resource, $location, Pieces, Categories )
{
	document.getElementById('mainscaffold').closeDrawer();

	$scope.current_piece = Pieces.get( {uuid : $routeParams.pieceId }, function () {
		console.log("Arrived ! appending."); 
		$scope.current_piece.legend = angular.fromJson($scope.current_piece.legend);
	});

	$scope.add = function( ){ 
		console.log("Saving !");
		$scope.current_piece.legend = JSON.stringify($scope.current_piece.legend);
		$scope.current_piece.$update( {uuid:$scope.current_piece.id}, function(){ console.log("Updated !"); $location.path( '/pieces' );} );
	};
	
});
{'fraction_non_alphanumeric': 0.19477751132427393, 'fraction_numerical': 0.0010658140154543032, 'mean_word_length': 5.025682182985554, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7308870', 'n_tokens_mistral': 1317, 'n_tokens_neox': 1224, 'n_words': 202}