- .directive('entityRating', ['Feedback', function(Feedback, Code) {
+ .controller('StarsCtrl', ['Feedback', '$scope', function(Feedback, $scope) {
+ $ctrl = this;
+
+ this.postStar = function(rating) {
+ Feedback.postEntityStarDimension($scope.mentity.full_name,
+ $scope.dimension, rating,
+ function(data) {
+ $scope.mean = data.mean;
+ $scope.list = data.ratings;
+ $scope.user = data.user;
+ $ctrl.loadEntityStars($scope);
+ }, function(err) {
+ $scope.err = err;
+ });
+ }
+
+ this.loadEntityStars = function($scope) {
+ Feedback.loadEntityStars($scope.mentity.full_name,
+ function(data) {
+ $scope.ratings = data;
+ }, function(message, status) {
+ $scope.error = {message: message, status: status};
+ });
+ };
+ }])
+
+ .directive('entityRating', ['Feedback', function(Feedback) {