apachano / minetestdb

Database for minetest content
2 stars 1 forks source link

Star button #3

Open apachano opened 7 years ago

apachano commented 7 years ago

I need to figure out how to implement function to the star button on pages. Function should be -Toggle starred on click -Filled in if user has starred and outline otherwise (I believe this works properly) -Display number of stars

M3TIOR commented 6 years ago

So just to be clear, by stared, do you mean rated, or favorited?

both are pretty simple, just one involves a little more code.

apachano commented 6 years ago

Favorited, similar to how you would star a project on github.

M3TIOR commented 6 years ago

We could probably just have the particular server model store an interger representing how many users have starred it. Have it incremented every time a user stars, and decremented every time a user unstars. On the user side of things, we could have the User model store a many to many which refs each of the servers they've stored, and just for efficiency if it has bearing later, an interger on the user model representing how many servers they've starred.

apachano commented 6 years ago

Yea I was thinking of linking them with the many to many field, I think there is a start in the code but I am not 100% sure. I cant remember where I got stuck so maybe I will start working on that again . . .