Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ||USER || OPTIONs ||
- ||User1 || Opt1 || Opt2 ||
- ||User2 || Opt1 || Opt2 ||
- <template name="patients">
- <table>
- <tr>
- <th>Patient</th>
- <th>Options</th>
- </tr>
- </table>
- {{#each Users}}
- <table>
- <tr>
- <th>
- <label><input type="radio" class="selected" name="patient" value="{{this._id}}">{{this.profile.lastName}} {{this.profile.firstName}}</label>
- </th>
- <td>
- <div class="patinf">
- <label><input type="checkbox" class="infos" name="{{this._id}}" id="showInfos"><span>OPT1</span></label>
- <label><input type="checkbox" class="answers" name="{{this._id}}" id="showAnswers"><span>OPT2</i></span></label>
- </div>
- </td>
- </tr>
- </table>
- {{/each}}
- {{>display}}
- </template>
- <template name="display">
- {{#if isInfosClicked}}
- <div name="showInfos">
- <h4>Infos for {{data.profile.lastName}} {{data.profile.firstName}}</h4>
- </div>
- {{/if}}
- {{#if isAnswersClicked}}
- <div name="showAnswers">
- <h4>Answers for {{data.profile.lastName}} {{data.profile.firstName}}</h4>
- </div>
- {{/if}}
- </template>
- Template.patients.helpers({
- Users: function() {
- return Meteor.users.find({});
- },
- });
- Template.patients.events({
- 'click .selected': function (){
- var selPat = $('input[name="patient"]:checked').val();
- Session.set("selPat",selPat);
- }
- });
- Template.patients.events({
- 'click .infos': function(){
- Session.set("infosClicked", true);
- },
- 'click .answers': function(){
- Session.set("answersClicked", true);
- },
- });
- Template.display.helpers({
- isInfosClicked: function(){
- return Session.get("infosClicked");
- },
- isAnswersClicked: function(){
- return Session.get("answersClicked");
- },
- data: function(){
- var PAT= Meteor.users.findOne({ _id: Session.get("selPat")});
- return PAT;
- }
- });
Add Comment
Please, Sign In to add comment