Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rating stars #567

Merged
merged 10 commits into from
Jun 11, 2020
Merged

Rating stars #567

merged 10 commits into from
Jun 11, 2020

Conversation

WithoutPants
Copy link
Collaborator

Replaces the numeric rating display and selection to graphical stars in the Scene Details and Edit panels.

Example on the details panel:

image

This field is currently read-only, but I've considered perhaps allowing the user to click to edit the rating and saving immediately. Not sure if it would be a popular use case or not.

In the Edit panel:

image

Mousing over the stars fills in the number of stars that will be set to. If this is less than current, then the remaining stars are not filled:

image

To unset the rating, click on the same value as the current value. When moused over, this is shown as unfilling all the current stars:

image

In the Edit panel, setting the rating does not take effect until the save button is clicked, as per existing behaviour.

@WithoutPants WithoutPants added the improvement Something needed tweaking. label May 22, 2020
@ghost
Copy link

ghost commented May 22, 2020

Looks good. I do prefer not using mouseover events for styling stuff though since it can easily get stuck, and leads to a lot of code.

I've made a jsfiddle to demonstrate how we could do it in css. It's a bit of a hack since css doesn't have lookahead so we have to reverse the order of the html, but it works well enough.

https://jsfiddle.net/1kfvugd9/

@ghost
Copy link

ghost commented May 22, 2020

Oh, and it seems the difference between solid and regular fonts is basically just the font-weight, so if you go the css route it'll be a lot easier just to set .star { font-weight: 500 } .star.active { font-weight: 900 }. The only thing the component needs to do is set the active class on the current rating.

@WithoutPants
Copy link
Collaborator Author

I tried adding the font-weight changes, but it had no impact on display of the stars. It only makes sense to do the css stuff if we can get rid of the mouse events, but it doesn't look like I can implement the star outline behaviour using css only.

@ghost
Copy link

ghost commented May 24, 2020

My bad, that only applies if we used the fontawesome web font, but we use svgs. SVGs are more efficient since we only include the ones we use, but it sucks not being able to define them in css.

The other alternative is to render both types of stars and hide/show with css, but it's such a small component that I'm not sure it's worth the hassle.

@WithoutPants WithoutPants added this to the Version 0.3.0 milestone Jun 1, 2020
@WithoutPants WithoutPants merged commit a77fea5 into stashapp:develop Jun 11, 2020
Tweeticoats pushed a commit to Tweeticoats/stash that referenced this pull request Feb 1, 2021
* Add ratings stars control. Add to scene details
* Replace rating with stars on edit panel
* Add changelog entry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Something needed tweaking.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant