ProductVoter - Voting service Print

  • 0

In-class Shop. Voting support on products.

Parameters in JS

Because the class is assigned to the Shop, all of the parameters must be given prior to the event or at the latest domready function conditional Shop.productVoter.condition(). all parameters have their default values​​, for normal operation sub-class,         you do not need any changes.

parameters Shop.productVoter.options :

  • class0 (string) - class of „emptiness” asterisk, the default star0
  • class05 (string) - class of „half” asterisk, the default star0-5
  • class1 (string) - class of „full” asterisk, the default star1
  • selector (string) - selector object DOM in which there are „star”, default span.votestars
  • starsselector (string) - selector objects DOM transmit classes „stars”, default span.votestars img
  • votecountselector (string) - object selector DOM storing the number of votes cast as text by default votecountselector
  • url (string) - address to vote, contains strings {prodid} and {score} to properly ID of the product and the value of vote [1 - 5], the default product/vote/prod/{prodid}/vote/{score}

phrases:

  • Shop.lang.common.product_vote_alert - message during a botched vote

action

selected starsselector receive two events. onMouseenter, for a temporary change of voice and onClick, which sends a request to url. After receiving the answers correct their votes, the events are removed, the voice permanently fixed, and the amount invotecountselector increased by one.

The value is assigned by the appropriate manipulation of the classes class0class05 and class1 on starsselector.

Product ID is taken from the ID of the object under selector. All non-numeric characters are removed, the default application uses nomenclature votestars_ID, for example. votestars_12.


Was this answer helpful?

« Back