Skip to content

Commit

Permalink
DOC-458 ResultRating documentation revision. (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
fbeaudoincoveo authored and olamothe committed Feb 9, 2017
1 parent c588c20 commit 231aa63
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions src/ui/ResultRating/ResultRating.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,22 @@ export enum RatingValues { Undefined, Lowest, Low, Average, Good, Best };
export interface IResultRatingOptions {
}
/**
* Component used to render document rating. Allows search users to rate a result with a 5-star representation.
* Interactive rating is possible if collaborative rating is enabled.
* The ResultRating component renders a 5-star rating widget. Interactive rating is possible if
* {@link SearchInterface.options.enableCollaborativeRating} is `true`.
*
* This component is a result template component (see [Result Templates](https://developers.coveo.com/x/aIGfAQ)).
*/
export class ResultRating extends Component {
static ID = 'ResultRating';

/**
* Creates a new ResultRating component.
* @param element The HTMLElement on which to instantiate the component.
* @param options The options for the ResultRating component.
* @param bindings The bindings that the component requires to function normally. If not set, these will be
* automatically resolved (with a slower execution time).
* @param result The result to associate the component with.
*/
constructor(public element: HTMLElement, public options?: IResultRatingOptions, public bindings?: IComponentBindings, public result?: IQueryResult) {
super(element, ResultRating.ID, bindings);
this.options = ComponentOptions.initComponentOptions(element, ResultRating, options);
Expand Down Expand Up @@ -72,9 +82,17 @@ export class ResultRating extends Component {
}

/**
* Rates a document with the specified rating value.
* @param rating The rating assigned to the document. Specified using the enum RatingValues.
* Possible values are: Undefined, Lowest, Low, Average, Good and Best.
* Rates a document using the the specified `rating` value.
* @param rating The rating to assign to the document.
*
* The possible values are:
*
* - `0`: renders no star.
* - `1`: renders 1 star.
* - `2`: renders 2 stars.
* - `3`: renders 3 stars.
* - `4`: renders 4 stars.
* - `5`: renders 5 stars.
*/
public rateDocument(rating: RatingValues) {
let request: IRatingRequest = {
Expand Down

0 comments on commit 231aa63

Please sign in to comment.