<commit_before>var app = angular.module('ideaBin.controllers', []);

app.controller("IdeaIndexCtrl", ['$scope', 'IdeaFactory', 'IdeasFactory', '$location',
	function($scope, IdeaFactory, IdeasFactory, $location) {
		$scope.ideas = IdeasFactory.query();
		
  	$scope.deleteIdea =  function(ideaId){
			IdeaFactory.delete({id: ideaId});
			$scope.ideas = IdeasFactory.query();
		}
		
		$scope.createNewIdea = function(){
			IdeasFactory.create();
			$location.path('/ideas');
		};
		
		$scope.editIdea = function (ideaId) {
			//IdeaFactory.show({id: ideaId});
			$location.path('/ideas/'+ideaId);
		}
		
		$scope.showIdea = function(){
			$location.path('/ideas/new');
		}
}]);

app.controller('IdeaDetailCtrl', ['$scope', '$routeParams', 'IdeaFactory', '$location',
	function($scope, $routeParams, IdeaFactory, $location){
		$scope.idea = IdeaFactory.show({id: $routeParams.id});
		
		$scope.updateIdea = function (){
			IdeaFactory.update($scope.idea);
			$location.path('/ideas/'+$scope.idea.id );
		}
		
		$scope.cancel = function(){
			$location.path('/ideas');
		}
	}
]);

app.controller('IdeaCreationCtrl', ['$scope', 'IdeasFactory', '$location',
	function($scope, IdeasFactory, $location ){
		//callback for ng-click 'createNewIdea'
		$scope.ideaForm = {};
		$scope.ideaForm.name = "NAME";
		$scope.ideaForm.description = "DESCRIPTION";
		$scope.createNewIdea = function(){
			console.log($scope.ideaForm)
			IdeasFactory.create($scope.ideaForm);
			$location.path('/ideas');
		}
	}
]);<commit_msg>changed update method in index controller<commit_after>var app = angular.module('ideaBin.controllers', []);

app.controller("IdeaIndexCtrl", ['$scope', 'IdeaFactory', 'IdeasFactory', '$location',
	function($scope, IdeaFactory, IdeasFactory, $location) {
		$scope.ideas = IdeasFactory.query();
		
  	$scope.deleteIdea =  function(ideaId){
			IdeaFactory.delete({id: ideaId});
			$scope.ideas = IdeasFactory.query();
		}
		
		$scope.createNewIdea = function(){
			IdeasFactory.create();
			$location.path('/ideas');
		};
		
		$scope.editIdea = function (ideaId) {
			//IdeaFactory.show({id: ideaId});
			$location.path('/ideas/'+ideaId);
		}
		
		$scope.showIdea = function(){
			$location.path('/ideas/new');
		}
}]);

app.controller('IdeaDetailCtrl', ['$scope', '$routeParams', 'IdeaFactory', '$location',
	function($scope, $routeParams, IdeaFactory, $location){
		$scope.idea = IdeaFactory.show({id: $routeParams.id});
		
		$scope.updateIdea = function (){
			IdeaFactory.update($scope.idea);
			$location.path('/ideas');
		}
		
		$scope.cancel = function(){
			$location.path('/ideas');
		}
	}
]);

app.controller('IdeaCreationCtrl', ['$scope', 'IdeasFactory', '$location',
	function($scope, IdeasFactory, $location ){
		//callback for ng-click 'createNewIdea'
		$scope.ideaForm = {};
		$scope.ideaForm.name = "NAME";
		$scope.ideaForm.description = "DESCRIPTION";
		$scope.createNewIdea = function(){
			console.log($scope.ideaForm)
			IdeasFactory.create($scope.ideaForm);
			$location.path('/ideas');
		}
	}
]);
{'fraction_non_alphanumeric': 0.1982787156570672, 'fraction_numerical': 0.0, 'mean_word_length': 4.638059701492537, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4765353', 'n_tokens_mistral': 1190, 'n_tokens_neox': 1018, 'n_words': 151}