Guest User

Untitled

a guest
Dec 12th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. ||USER || OPTIONs ||
  2. ||User1 || Opt1 || Opt2 ||
  3. ||User2 || Opt1 || Opt2 ||
  4.  
  5. <template name="patients">
  6. <table>
  7. <tr>
  8. <th>Patient</th>
  9. <th>Options</th>
  10. </tr>
  11. </table>
  12. {{#each Users}}
  13. <table>
  14. <tr>
  15. <th>
  16. <label><input type="radio" class="selected" name="patient" value="{{this._id}}">{{this.profile.lastName}} {{this.profile.firstName}}</label>
  17. </th>
  18. <td>
  19. <div class="patinf">
  20. <label><input type="checkbox" class="infos" name="{{this._id}}" id="showInfos"><span>OPT1</span></label>
  21. <label><input type="checkbox" class="answers" name="{{this._id}}" id="showAnswers"><span>OPT2</i></span></label>
  22. </div>
  23. </td>
  24. </tr>
  25. </table>
  26. {{/each}}
  27. {{>display}}
  28. </template>
  29.  
  30.  
  31. <template name="display">
  32. {{#if isInfosClicked}}
  33. <div name="showInfos">
  34. <h4>Infos for {{data.profile.lastName}} {{data.profile.firstName}}</h4>
  35.  
  36. </div>
  37. {{/if}}
  38. {{#if isAnswersClicked}}
  39. <div name="showAnswers">
  40. <h4>Answers for {{data.profile.lastName}} {{data.profile.firstName}}</h4>
  41. </div>
  42. {{/if}}
  43. </template>
  44.  
  45. Template.patients.helpers({
  46. Users: function() {
  47. return Meteor.users.find({});
  48. },
  49. });
  50.  
  51. Template.patients.events({
  52. 'click .selected': function (){
  53. var selPat = $('input[name="patient"]:checked').val();
  54. Session.set("selPat",selPat);
  55. }
  56. });
  57.  
  58.  
  59. Template.patients.events({
  60. 'click .infos': function(){
  61. Session.set("infosClicked", true);
  62. },
  63. 'click .answers': function(){
  64. Session.set("answersClicked", true);
  65. },
  66. });
  67.  
  68. Template.display.helpers({
  69. isInfosClicked: function(){
  70. return Session.get("infosClicked");
  71. },
  72. isAnswersClicked: function(){
  73. return Session.get("answersClicked");
  74. },
  75. data: function(){
  76. var PAT= Meteor.users.findOne({ _id: Session.get("selPat")});
  77. return PAT;
  78. }
  79. });
Add Comment
Please, Sign In to add comment