Basicaly, this is my seed colection
if (Student.find().count() == 0) {
// console.log(āImporting private/Students.json to dbā)
// var data = JSON.parse(Assets.getText(āstudents.jsonā));
var students = [
{
student:{
firstname:"Cinar",
lastname: "Can",
parent: "Canar",
teacher:["Gizem","Laurent"],
class: ["Mavi"."English"],
stu_id:"masal_01"
}
},
{
student:{
firstname:"alper",
lastname: "alpastan",
parent: "Tunar",
teacher:["Gizem","Laurent"],
class: ["Mavi"."English"],
stu_id:"masal_02"
}
},
{
student:{
firstname:"alper2",
lastname: "alpastan2",
parent: "Tunasta",
teacher:["Gizem","Laurent"],
class: ["Mavi"."English"],
stu_id:"masal_03"
}
},
{
student:{
firstname:"selin",
lastname: "selin",
parent: "Tunar",
teacher:["Gizem","Laurent"],
class: ["Mavi"."English"],
stu_id:"masal_04"
}
},
{
student:{
firstname:"alper",
lastname: "alpastan",
parent: "Mehmet",
teacher:["Gizem","Laurent"],
class: ["Mavi"."English"],
stu_id:"masal_05"
}
}
];
students.forEach(function (item) {
Student.insert({
student:item.student
});
});
};
And here is my publlish
Template.parent.helpers({
thisstudent: function(){
var this_student = Student.find({}, {fields: {āstudentā: true}});
// console.log(student.firstname);
return this_student;
},
this_student_id: function(){
var this_id = Template.parentData(1)._id;
var this_student = Student.findOne({_id: this_id});
// console.log(student.firstname);
return this_student;
},
student_image: function(){
return Images.find();
},
author: function(){
// console.log(hjsdn);
return Meteor.users.findOne({_id: this.metadata.owner});
}
});
And here is Template
<div class="parent-page ui-view main" key="parent">
{{#each thisstudent}}
{{#if isEqual currentUser.username student.parent}}
<h2>{{student.firstname}} <small>Class</small></h2>
{{#each student_image}}
{{#if this_student_id}}
{{#if isEqual this_student_id._id metadata.student}}
{{#if isEqual author.profile.class this_student_id.student.class}}
<button class="accordion fa fa-star">
Mavi Sinif
</button>
<div class="panel">
<img class="activator" id="stu_image" src="{{this.url store='images'}}" width="250" height="270">
<br>
</div>
{{else}}
<button class="accordion fa fa-star">
Mavi Sinif
</button>
<div class="panel">
No picture added Today. Please Contact the teacher for more informations
<br>
</div>
{{/if}}
{{/if}}
{{/if}}
{{else}}
<div>
<i style="margin-top: 30%; margin-left: 40%" class="fa fa-spinner fa-spin fa-3x fa-fw"></i>
{{/each}}
{{/if}}
{{/each}}
</div>
And i am trying to compare if the current Student has one of the Class.
@coagmano