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 63852895497e96511ebb1eb13b01e7c967fe0a03 Author: Yannick Martel <martel@©odelutin.com> Date: Thu Jan 8 18:31:43 2015 +0100 add question parents and children in ui --- .../coselmar/converter/BeanEntityConverter.java | 2 +- .../coselmar/services/v1/QuestionsWebService.java | 13 +++++++-- .../views/questions/viewRestrictedQuestion.html | 32 ++++++++++++++++++---- .../main/webapp/views/questions/viewquestion.html | 28 ++++++++++++++++--- 4 files changed, 63 insertions(+), 12 deletions(-) diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/converter/BeanEntityConverter.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/converter/BeanEntityConverter.java index 950ca54..3ae8e53 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/converter/BeanEntityConverter.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/converter/BeanEntityConverter.java @@ -189,7 +189,7 @@ public class BeanEntityConverter { Collection<Question> parents = question.getParents(); if (parents != null && !parents.isEmpty()) { for (Question parent : parents) { - QuestionBean questionBean = toBean(idFactory, parent); + QuestionBean questionBean = toLightBean(idFactory, parent); result.addParent(questionBean); } } diff --git a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/QuestionsWebService.java b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/QuestionsWebService.java index 1fa4241..b2614b0 100644 --- a/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/QuestionsWebService.java +++ b/coselmar-rest/src/main/java/fr/ifremer/coselmar/services/v1/QuestionsWebService.java @@ -373,7 +373,13 @@ public class QuestionsWebService extends CoselmarWebServiceSupport { } - QuestionBean result = BeanEntityConverter.toBean(getPersistenceContext().getTopiaIdFactory(), question);; + QuestionBean result = BeanEntityConverter.toBean(getPersistenceContext().getTopiaIdFactory(), question); + //manager child + List<Question> children = getQuestionDao().forParentsContains(question).findAll(); + for (Question child : children) { + QuestionBean childBean = BeanEntityConverter.toLightBean(getPersistenceContext().getTopiaIdFactory(), child); + result.addChild(childBean); + } // Client is not allowed to see documents if (CoselmarUserRole.CLIENT == currentUser.getRole() @@ -396,7 +402,10 @@ public class QuestionsWebService extends CoselmarWebServiceSupport { for (Question parent : question.getParents()) { result.addParent(BeanEntityConverter.toLightBean(getPersistenceContext().getTopiaIdFactory(), parent)); } - //TODO ymartel : manager children + for (Question child : children) { + QuestionBean childBean = BeanEntityConverter.toLightBean(getPersistenceContext().getTopiaIdFactory(), child); + result.addChild(childBean); + } } } diff --git a/coselmar-ui/src/main/webapp/views/questions/viewRestrictedQuestion.html b/coselmar-ui/src/main/webapp/views/questions/viewRestrictedQuestion.html index 1802bbe..a2e31cb 100644 --- a/coselmar-ui/src/main/webapp/views/questions/viewRestrictedQuestion.html +++ b/coselmar-ui/src/main/webapp/views/questions/viewRestrictedQuestion.html @@ -24,13 +24,35 @@ <div class=""> - Cette question n'est pas disponible à la consultation. + <div class="form-group col-md-12"> + <h4>Cette question n'est pas disponible à la consultation.</h4> + </div> - <!-- TODO ymartel 20141208 : manage parents and children <div class="form-group col-md-12"> - <div class="col-md-6">TODO Parents</div> - <div class="col-md-6">TODO Children</div> + <div class="col-md-6"> + <dl> + <dt>Produced or inspired by</dt> + <dd> + <ul> + <li ng-repeat="parent in question.parents"> + <a href="#/questions/{{parent.id}}" target="_blank">{{parent.title}}</a> + </li> + </ul> + </dd> + </dl> + </div> + <div class="col-md-6"> + <dl> + <dt>Has produced or inspired</dt> + <dd> + <ul> + <li ng-repeat="child in question.children"> + <a href="#/questions/{{child.id}}" target="_blank">{{child.title}}</a> + </li> + </ul> + </dd> + </dl> + </div> </div> - --> </div> \ No newline at end of file diff --git a/coselmar-ui/src/main/webapp/views/questions/viewquestion.html b/coselmar-ui/src/main/webapp/views/questions/viewquestion.html index 2962379..99dbcae 100644 --- a/coselmar-ui/src/main/webapp/views/questions/viewquestion.html +++ b/coselmar-ui/src/main/webapp/views/questions/viewquestion.html @@ -201,11 +201,31 @@ </div> - <!-- TODO ymartel 20141208 : manage parents and children <div class="form-group col-md-12"> - <div class="col-md-6">TODO Parents</div> - <div class="col-md-6">TODO Children</div> + <div class="col-md-6"> + <dl> + <dt>Produced or inspired by</dt> + <dd> + <ul> + <li ng-repeat="parent in question.parents"> + <a href="#/questions/{{parent.id}}" target="_blank">{{parent.title}}</a> + </li> + </ul> + </dd> + </dl> + </div> + <div class="col-md-6"> + <dl> + <dt>Has produced or inspired</dt> + <dd> + <ul> + <li ng-repeat="child in question.children"> + <a href="#/questions/{{child.id}}" target="_blank">{{child.title}}</a> + </li> + </ul> + </dd> + </dl> + </div> </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>.