This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository coselmar. See http://git.codelutin.com/coselmar.git commit f663f640569e86d88df89ceb2e9148cd304edc25 Author: Yannick Martel <martel@©odelutin.com> Date: Mon Jan 5 16:42:50 2015 +0100 cannot set a question as parent of itself --- coselmar-ui/src/main/webapp/js/coselmar-controllers.js | 13 +++++++++++-- .../main/webapp/views/questions/modalQuestionSearch.html | 3 ++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js index 7cff4f0..1e8572e 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js @@ -715,11 +715,19 @@ coselmarControllers.controller("QuestionCtrl", ['$scope', '$route', '$routeParam var modalInstance = $modal.open({ templateUrl: 'views/questions/modalQuestionSearch.html', controller: 'ModalSearchQuestionsCtrl', - size: 'lg' + size: 'lg', + resolve : { + currentQuestionId : function() { + return $scope.question.id; + } + } }); modalInstance.result.then(function (selectedQuestion) { var already = false; + if ($scope.question.id && $scope.question.id == selectedQuestion.id) { + already = true; + } if (! $scope.question.parents) { $scope.question.parents = []; } else { @@ -776,9 +784,10 @@ coselmarControllers.controller('ModalSearchDocumentsCtrl', function ($scope, $mo }); -coselmarControllers.controller('ModalSearchQuestionsCtrl', function ($scope, $modalInstance, questionsService) { +coselmarControllers.controller('ModalSearchQuestionsCtrl', function ($scope, $modalInstance, currentQuestionId, questionsService) { $scope.searchKeywords = []; + $scope.currentQuestionId = currentQuestionId; questionsService.getQuestions(function(questions) { $scope.questions = questions; diff --git a/coselmar-ui/src/main/webapp/views/questions/modalQuestionSearch.html b/coselmar-ui/src/main/webapp/views/questions/modalQuestionSearch.html index 6753413..3b86fad 100644 --- a/coselmar-ui/src/main/webapp/views/questions/modalQuestionSearch.html +++ b/coselmar-ui/src/main/webapp/views/questions/modalQuestionSearch.html @@ -37,7 +37,8 @@ <td><span ng-repeat="theme in question.themes">{{theme}} ,</span></td> <td>{{document.status}}</td> <td> - <a class="btn fa fa-plus" title="Add question as parent" ng-click="select(question)"/></td> + <a class="btn fa fa-plus" title="Add question as parent" + ng-click="select(question)" ng-if="currentQuestionId != question.id"/></td> </tr> </table> </div> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.