feat: rating question type - #3637
Open
global-prog wants to merge 1 commit into
Open
Conversation
Implements nextcloud#356: a compact star rating, with hearts and thumbs as alternatives. A linear scale already covers 1..N, but as a row of radio buttons. A rating is the control people expect for "how would you rate this", takes far less width, and reads at a glance in the results. Built from real radio inputs rather than clickable icons, so it stays keyboard navigable and every option is announced with the value it selects. The hit area is a full clickable-area square while the icon itself stays small, since an icon-sized target is awkward to hit on a phone. The hover animation is dropped under prefers-reduced-motion. Configurable from 2 to 10 icons, defaulting to 5. The answer is stored as the plain number, so results and CSV export need no special handling. Validated server-side as a whole number within the configured maximum rather than trusting the client. Rating carries no options, so it is checked on its own rather than as a predefined-option type. No schema change. FormsQuestionType is left alone, matching how linearscale, ranking and color are already handled, so openapi.json is unaffected. Signed-off-by: global-prog <raqeeb@uosamarra.edu.iq>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #356.
Summary
A compact rating question, with stars, hearts or thumbs up, configurable from 2 to 10 icons (default 5).
A linear scale already covers 1..N, but renders as a row of radio buttons. A rating is the control people expect for "how would you rate this", takes far less width, and reads at a glance in the results.
Accessibility
Built from real radio inputs rather than clickable icons, so:
3 of 5) rather than as an unnamed radio--default-clickable-areasquare while the icon itself stays small — an icon-sized target is awkward to hit on a phoneprefers-reduced-motionStorage and validation
The answer is stored as the plain number, so results and CSV export need no special handling.
It is validated server-side as a whole number within the configured maximum rather than trusting the client. A rating carries no options, so it is checked on its own rather than as a predefined-option type.
Scope
maxRatingandratingIconlive in the existingextraSettingsFormsQuestionTypeis deliberately left alone, matching howlinearscale,rankingandcolorare already handled, soopenapi.jsonis unaffectedTesting
npm run lint,npm run stylelintandphp -lcleanmainwith no errorsHappy to adjust the default icon count, the icon set, or drop the hearts/thumbs options if you would rather keep it to stars.