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 3363548872e4b6e443b09abcdc0ed9e762c7fbbc Author: Yannick Martel <martel@©odelutin.com> Date: Mon Jan 5 16:03:04 2015 +0100 add way to add parents with questions creation --- .../src/main/webapp/js/coselmar-controllers.js | 61 +++++++++++++++++++++- .../main/webapp/views/questions/editquestion.html | 37 +++++++++++++ .../views/questions/modalQuestionSearch.html | 47 +++++++++++++++++ 3 files changed, 144 insertions(+), 1 deletion(-) diff --git a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js index 2e82b34..7cff4f0 100644 --- a/coselmar-ui/src/main/webapp/js/coselmar-controllers.js +++ b/coselmar-ui/src/main/webapp/js/coselmar-controllers.js @@ -707,7 +707,40 @@ coselmarControllers.controller("QuestionCtrl", ['$scope', '$route', '$routeParam if (document && position != -1) { documentList.splice(position, 1); } - } + }; + + // Modals part for parent questions + $scope.modalSearchParents = function () { + + var modalInstance = $modal.open({ + templateUrl: 'views/questions/modalQuestionSearch.html', + controller: 'ModalSearchQuestionsCtrl', + size: 'lg' + }); + + modalInstance.result.then(function (selectedQuestion) { + var already = false; + if (! $scope.question.parents) { + $scope.question.parents = []; + } else { + for (var i = 0; i < $scope.question.parents.length; i++) { + if ($scope.question.parents[i].id == selectedQuestion.id) { + already = true; + } + } + } + if (!already) { + $scope.question.parents.push(selectedQuestion); + } + }); + }; + + $scope.removeParent = function(parent) { + var position = $scope.question.parents.indexOf(parent); + if (parent && position != -1) { + $scope.question.parents.splice(position, 1); + } + }; $scope.isClient = function() { var isClient = false; @@ -743,6 +776,32 @@ coselmarControllers.controller('ModalSearchDocumentsCtrl', function ($scope, $mo }); +coselmarControllers.controller('ModalSearchQuestionsCtrl', function ($scope, $modalInstance, questionsService) { + + $scope.searchKeywords = []; + + questionsService.getQuestions(function(questions) { + $scope.questions = questions; + }); + + $scope.searchQuestions = function(searchKeywords) { + $scope.searchKeywords = searchKeywords; + questionsService.getQuestions(function(questions) { + $scope.questions = questions; + }); + + } + + $scope.select = function (question) { + $modalInstance.close(question); + }; + + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; + +}); + coselmarControllers.controller('ModalCreateDocumentsCtrl', function ($scope, $modalInstance, documentService) { $scope.document = {'privacy': 'PUBLIC', 'keywords' : []}; diff --git a/coselmar-ui/src/main/webapp/views/questions/editquestion.html b/coselmar-ui/src/main/webapp/views/questions/editquestion.html index b0e79c1..9a82637 100644 --- a/coselmar-ui/src/main/webapp/views/questions/editquestion.html +++ b/coselmar-ui/src/main/webapp/views/questions/editquestion.html @@ -251,6 +251,43 @@ <div class="form-group" > + <label class="col-md-2 control-label">Parent Questions</label> + + <div class="col-md-10"> + <table class="table table-bordered table-condensed"> + <tr> + <th>Title</th> + <th>Submission Date</th> + <th>Themes</th> + <th>Status</th> + <th> + <a class="btn fa fa-search" title="Search parent question" + ng-click="modalSearchParents()" /> + </th> + </tr> + <tr ng-repeat="parent in question.parents"> + <td tooltip-placement="bottom" tooltip-html-unsafe="{{parent.summary}}"> + {{parent.title}} + </td> + <td>{{parent.submissionDate | date:'mediumDate'}}</td> + <td><span ng-repeat="theme in parent.themes">{{theme}}, </span></td> + <td>{{parent.status}}</td> + <td><a class="btn fa fa-minus" title="Remove parent question" + ng-click="removeParent(parent)" + ng-if="currentUser.role == 'SUPERVISOR'"/></td> + </tr> + </table> + </div> + + </div> + + <!-- End Line with Related Document --> + + <!-- Line with Related Document --> + + <div class="form-group" > + + <label class="col-md-2 control-label">Related Documents</label> <div class="col-md-10"> diff --git a/coselmar-ui/src/main/webapp/views/questions/modalQuestionSearch.html b/coselmar-ui/src/main/webapp/views/questions/modalQuestionSearch.html new file mode 100644 index 0000000..6753413 --- /dev/null +++ b/coselmar-ui/src/main/webapp/views/questions/modalQuestionSearch.html @@ -0,0 +1,47 @@ +<div style="padding: 0px 0px 0px 30px"> + <div class="page-header"> + <h1> + <!-- Heading goes here --> + Assign Parent Question + </h1> + </div> + + <div> + <!--<div>--> + <!--<form class="form-inline pull-right" role="questionOptions" ng-submit="searchQuestions(searchKeywords)">--> + <!--<div class="form-group">--> + <!--<input type="search" class="form-control" placeholder="word1,word2,..." ng-model="searchKeywords" ng-list />--> + <!--</div>--> + <!--<div class="form-group">--> + <!--<button type="submit" class="btn btn-default fa fa-search"></button>--> + <!--</div>--> + <!--</form>--> + <!--</div>--> + <br/> + <table class="table"> + <tr> + <th>Title</th> + <th>Submission Date</th> + <th>Theme</th> + <th>Status</th> + <th></th> + </tr> + <tr ng-repeat="question in questions"> + <td> + <a href="#/questions/{{question.id}}" target="_blank" + tooltip-placement="bottom" tooltip-html-unsafe="{{question.summary}}"> + {{question.title}} + </a> + </td> + <td>{{question.submissionDate | date:'mediumDate'}}</td> + <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> + </tr> + </table> + </div> + <div class="modal-footer"> + <button class="btn btn-warning" ng-click="cancel()">Cancel</button> + </div> +</div> \ No newline at end of file -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.