barbatus / stars-rating

Stars rating control for Meteor
MIT License
21 stars 11 forks source link

Some of the stars for rating are not showing up. #7

Closed Lidofernandez closed 8 years ago

Lidofernandez commented 8 years ago

Hi,

Thanks for the package by the way. I've found it very usefull.

The problem I'm having is that some starts are showing up and others aren't. But, they are still working because if I press in the part that the starts are supposed to appeare it works. I attache a picture as well.

screen shot 2015-11-22 at 18 23 45
Lidofernandez commented 8 years ago

I give more information:

This is the code I use for the star rating:

'click .js-stars-photo': function(event){ var rating = $(event.currentTarget).data('userrating'); var photo_id = this.id; Photos.update({_id: photo_id}, {$set: {rating: rating}}); },

Here you have another photo from the console:

screen shot 2015-11-22 at 18 48 55
barbatus commented 8 years ago

There is no enough information to conclude what is the reason. It's likes because of styles. I will be able to help only if you either create a repo with an example or put here styles you are using for the control.

Lidofernandez commented 8 years ago

I've created a repo https://github.com/Lidofernandez/Sharing-Photos-application-with-Meteor.git There is not too much code because I've just started but I would really apreciate your help :) .

Thanks!

wuworkshop commented 8 years ago

@Lidofernandez I'm guessing you're taking the Coursera Meteor.js course. There's actually a solution to the problem posted in the Course Forums over here:

https://www.coursera.org/learn/meteor-development/discussions/oM1TuoxuEeWZfg6Bj_UArQ

barbatus commented 8 years ago

@Lidofernandez hey, the problem seems to be in Mongo IDs. Some of them start from a digit and browsers don't recognize them as valid element IDs. So if you add a helper to the photos template that add a prefix to each id, say:

return 'star_' + this._id

it will fix the issue.

Lidofernandez commented 8 years ago

and it works like magic!! thank you all!