You are here

README.txt in Rate 8.2

Same filename and directory in other branches
  1. 8 README.txt
  2. 6.2 README.txt
  3. 7 README.txt
INTRODUCTION
------------
This module provides flexible voting widgets for nodes and comments.
Administrators can add multiple widgets and define an unlimited number of
buttons.

Current functionality
 - Single rate widget on multiple entities possible
 - Multiple rate widgets on a single entity possible
 - Result functions per widget/entity combination 
   and entity summary (multiple widgets)
 - Up/down (number up/down, thumbs up/down, yes/no) voting
 - Fivestar voting
 - CSS, JS and result templates
 - Voting Results tab for nodes
 - Voting via AJAX only
 - Undo votes
 - Voting on comments and other entity types
 - Widget label, description and result summary
 - Position of label, description, result summary (relative to widget or hidden)
 - Disable widget (Read-only widget) based on permission, rollover, user setting
 - Vote rollover for registered and anonymous users
 - Voting deadline field in the voted entity
 - Rate widgets in views (selectable ID of entity,customizable display)

Not implemented yet:
 - Emotion rate widget (D7)
 - Slider widget (D7)
 - Different widget display types (obsolete - use display settings instead)
 - Migration from D7 version
 - Migration from 8.x-1.x version

Limitations:
 - No migration for switching from one widget type to another

CONTENTS
--------
1. Installation
2. Global configuration (bot detection)
3. Permissions
4. Widget configuration
4.1. Widget entity configuration
4.2. Options
5. Voting results
6. Views integration
7. Rate deadline (close voting on a specified date)
8. Hooks

1. Installation
--------------------------------------------------------------------------------
Before installing Rate, you need VotingAPI. If not already installed, download
the latest stable version at http://drupal.org/project/votingapi
Please follow the readme file provided by VotingAPI on how to install.

Use composer to install Rate - see the instructions on the Rate release download
page. Enable Rate afterwards (on admin/modules).

Required modules:
* Voting API (https://www.drupal.org/project/votingapi)
  Rate uses VotingAPI contributed module to store and retrieve rate votes.
* Comments (https://www.drupal.org/docs/8/core/modules/comment)
  The Comments core module is required if you intend to enable comments rating.
* Datetime (https://www.drupal.org/docs/8/core/modules/datetime)
  The Datetime core module is a requirement for the Rate deadline field.

Optional modules:
* Chart (https://www.drupal.org/project/charts)
  To view the charts in the vote results tab, you also need to install the
  "charts" module. Refer to the Charts documentation to set up result charts.

2. Global configuration (bot detection)
--------------------------------------------------------------------------------
After installation, the global rate settings configuration page will be 
available at /admin/config/search/votingapi/rate. 
This page displays the botdetection settings.

The Rate module is able to detect bots in three ways:

* Based on user agent string
* Using an threshold. The IP-address is blocked when there are more votes from
  the same IP within a given time than the threshold. There are thresholds for
  1 minute and 1 hour.
* Lookup the IP-address in the BotScout.com database. This requires you to
  obtain an API-key.

The thresholds and API-key can be configured at the settings form found on
admin/structure/rate/settings. The default thresholds are 25 and 250. They are
too high for many sites, but you should make sure that no real users get
blocked. On the other hand, lower thresholds will identify more bots and will
identify them faster. A value of 10 / 50 is a better setting for most sites.

Bad user agents cannot be configured via the admin at this moment. You can add
bad strings in the 'rate_bot_agent' table. Percent signs ("%") can be used as
wildcards. A string can be for example "%GoogleBot%" or just "%bot%". Patterns
are case insensitive. The id field is for identification and has no meaning.

3. Permissions
--------------------------------------------------------------------------------
You need to set permissions for the Rate module at /admin/people/permissions.

For administering Rate - creating, updating or deleting widgets, a user will
need the "Administer Rate options" permission. CAUTION: assign this permission 
to administrator roles only.

For each entity bundle, which has a rate widget attached, there will be a
separate record, such as "Can vote on ENTITY_TYPE of ENTITY_BUNDLE", for 
example "Can vote on node type of article". Set the permissions accordingly.

If you want users other than admin to access the voting results page, you need
to give them the "View rate result page" permission on admin/user/permissions.

4. Widget configuration
--------------------------------------------------------------------------------
Since Rate version 8.2. all rate widgets are stored separately in the database
as configuration entities. To configure the rate widgets, go to
/admin/structure/rate_widgets.

To add a new rate widget, click on the button "+Add rate widget".

A list of existing rate widgets is shown at /admin/structure/rate_widgets.
To modify an existing rate widget click on the button "Edit" next to the
table entry you want to modify.

4.1. Widget entity configuration
--------------------------------
The elements on the widget configuration form are explained in this paragraph.
Note that some elements may not be available depending on the widget type you
use, these are "Value type", "Options" and "Translate options".

* Name
  The title is only used in the admin section. Use a recognizable name.

* Machine name
  Name used for technical purposes. You may only contain alphanumeric characters
  and underscores (generated automatically).

* Template
  Select the type of widget to create. The following widget types are provided
  by the rate module:
  * Fivestar
  * Number Up / Down
  * Thumbs Up
  * Thumbs Up / Down
  * Yes / No
  This will impact the look of the widget.

* Value type
  This determines how vote results are totaled. VotingAPI supports three value
  types by default: 'Percentage' votes are averaged, 'Points' votes are summed
  up, and 'Options' votes get a count of votes cast for each specific option.
  Typical usages are:
  * Thumbs up / down: use points
  * Bad / mediocre / good: use percentage
  * Makes me funny / boring / mad / angry: use options

* Options (see §4.2 for more information).
  These are the options displayed to the user. Each option has a value, a label
  and a class.

* Entities
  Check the entity types on which a rate widget should be available. There are
  separate columns for nodes and comments in this table.

* Voting settings
  * Use a vote deadline
    Enables a deadline date field on the respective node. 
    If deadline is set and date passed, the widget will be shown as disabled.

  * Anonymous (Registered user) vote rollover
    The amount of time that must pass before two votes from the same computer 
    are considered unique. Set the rollover to a time period. Setting this to
    'Never' will allow only one vote. Setting this to 'Immediately' will allow
    the user to cast votes with every click. 'Votingapi setting' will inherit 
    the settings which are configured at /admin/config/search/votingapi. 

* Display settings
  Configures the content, position and class of a rate widget label and
  description filds. Here a widget can be set to be 'read-only'.

* Results
  Configures the content and position of the result summary.

  To customize the results summary template you need to copy the file
  rate\templates\rate-widgets-summary.html.twig to your subtheme and
  modify it accordingly.

4.2. Options
------------
Options are the "buttons" displayed in the widget. These can be visually
different, depending on the theming. Options are generated as radio form 
elements by default.

Each option has a value, a label and a class. Only the label is visible for the
user, but the value is what he actually votes for when clicking the button.

Values have to be configured according to the following rules:
* Values must be integers (may be negative). Thus '1', '2', '0', '-3' are all
  right, but '2.3' is wrong.
* Values must be unique across all options within the same widget.

Which value you should use depends on the value type setting. When using points,
these are the points which will be added when clicking that button. So "thumbs
up" must have the value '1', "thumbs down" the value '-1' and "neutral" '0'. For
'Percentage' you have to use whole numbers between 0 and 100. When using
'Options', you may use any number as long as they are unique. It doesn't have to
make sense as they are only used for storage.

To add an option, click on the button "Add another option". 
To delete an option - delete its values in the fields value, label and class and
save the rate widget.

5. Voting results
--------------------------------------------------------------------------------
Voting results are available on the voting results page. You can get there by
clicking the "Node votes" tab on the node page. Note that this tab is hidden
if the node does not have any rate widgets or if you do not have the
"view rate results" permission.

The voting results page is only available for nodes.
In order to enable the voting results for other entity types, e.g. users, groups
etc., you will need to create YOURMODULE.links.task.yml, YOURMODULE.routing.yml
and a custom controller in your custom module. See the node implementation in 
rate as a starting point (rate.node_results_page).

6. Views integration
--------------------------------------------------------------------------------
Add a field of the type "Rate widget" to your view. If your view has 
relationships defined, select the correct one to attach the field to.
In the field configuration form, you have the following possibilities:

* Which field column holds the entity ID?
  Select the ID of the entity you would like to vote on. This entity has to have
  the rate widget widget attached to it.
  You can attach the entity id to your and then hide teh field.
  Through this you can vote on any entity, as long as you can show it in your
  view.

* Some entities have multiple widgets attached...
  If the entity has multiple widgets attached - select the one to be shown in
  this field.
  If you want several widgets to be shown - add another Rate widget field to
  your view.

* Show widget
  * Full - will show it as configured.
  * Summary - will show only the widget summary (enable it in the configuration)
  * Read only - show the widget as configured, but block the user from voting.

* Override rate widget display options
  With this setting you can hide the label, description and/or the result
  summary.
  
CAUTION: filtering or sorting based on the Rate widget field is not possible.
In order to filter or sort on the voting results, add a relation to the
Voting API results and sort/filter on them.

7. Rate deadline (close voting on a specified date)
--------------------------------------------------------------------------------
This option allows you to close voting on a specified date. 
When adding or editing a rate widget, checking 'Use vote deadline' in 'Voting 
settings' will add a date field to each entity this rate widget is attached to.

The deadline can be then set on each entity individually (e.g. Article 1 and 
Article 2). To do so, open the entity in question, go to its edit form and set
the deaedline. By default, the deadline field is not showing on the view display
of the entity, but you can change this.

If the deadline is set for an entity and the date is already passed, the rate
widget will be disabled. Additional variables - disabled and deadline_disabled
are passed to rate-widgets-summary.html.twig, so you can customize the result
summary accordingly.

8. Hooks
--------------------------------------------------------------------------------
Hooks for modules are documented in rate.api.php.

Currently there is one hook available - hook_rate_widget_options_alter.
With its help you can override the options (value, label, class) of a rate 
widget. It is called before the rate widget is being rendered.

File

README.txt
View source
  1. INTRODUCTION
  2. ------------
  3. This module provides flexible voting widgets for nodes and comments.
  4. Administrators can add multiple widgets and define an unlimited number of
  5. buttons.
  6. Current functionality
  7. - Single rate widget on multiple entities possible
  8. - Multiple rate widgets on a single entity possible
  9. - Result functions per widget/entity combination
  10. and entity summary (multiple widgets)
  11. - Up/down (number up/down, thumbs up/down, yes/no) voting
  12. - Fivestar voting
  13. - CSS, JS and result templates
  14. - Voting Results tab for nodes
  15. - Voting via AJAX only
  16. - Undo votes
  17. - Voting on comments and other entity types
  18. - Widget label, description and result summary
  19. - Position of label, description, result summary (relative to widget or hidden)
  20. - Disable widget (Read-only widget) based on permission, rollover, user setting
  21. - Vote rollover for registered and anonymous users
  22. - Voting deadline field in the voted entity
  23. - Rate widgets in views (selectable ID of entity,customizable display)
  24. Not implemented yet:
  25. - Emotion rate widget (D7)
  26. - Slider widget (D7)
  27. - Different widget display types (obsolete - use display settings instead)
  28. - Migration from D7 version
  29. - Migration from 8.x-1.x version
  30. Limitations:
  31. - No migration for switching from one widget type to another
  32. CONTENTS
  33. --------
  34. 1. Installation
  35. 2. Global configuration (bot detection)
  36. 3. Permissions
  37. 4. Widget configuration
  38. 4.1. Widget entity configuration
  39. 4.2. Options
  40. 5. Voting results
  41. 6. Views integration
  42. 7. Rate deadline (close voting on a specified date)
  43. 8. Hooks
  44. 1. Installation
  45. --------------------------------------------------------------------------------
  46. Before installing Rate, you need VotingAPI. If not already installed, download
  47. the latest stable version at http://drupal.org/project/votingapi
  48. Please follow the readme file provided by VotingAPI on how to install.
  49. Use composer to install Rate - see the instructions on the Rate release download
  50. page. Enable Rate afterwards (on admin/modules).
  51. Required modules:
  52. * Voting API (https://www.drupal.org/project/votingapi)
  53. Rate uses VotingAPI contributed module to store and retrieve rate votes.
  54. * Comments (https://www.drupal.org/docs/8/core/modules/comment)
  55. The Comments core module is required if you intend to enable comments rating.
  56. * Datetime (https://www.drupal.org/docs/8/core/modules/datetime)
  57. The Datetime core module is a requirement for the Rate deadline field.
  58. Optional modules:
  59. * Chart (https://www.drupal.org/project/charts)
  60. To view the charts in the vote results tab, you also need to install the
  61. "charts" module. Refer to the Charts documentation to set up result charts.
  62. 2. Global configuration (bot detection)
  63. --------------------------------------------------------------------------------
  64. After installation, the global rate settings configuration page will be
  65. available at /admin/config/search/votingapi/rate.
  66. This page displays the botdetection settings.
  67. The Rate module is able to detect bots in three ways:
  68. * Based on user agent string
  69. * Using an threshold. The IP-address is blocked when there are more votes from
  70. the same IP within a given time than the threshold. There are thresholds for
  71. 1 minute and 1 hour.
  72. * Lookup the IP-address in the BotScout.com database. This requires you to
  73. obtain an API-key.
  74. The thresholds and API-key can be configured at the settings form found on
  75. admin/structure/rate/settings. The default thresholds are 25 and 250. They are
  76. too high for many sites, but you should make sure that no real users get
  77. blocked. On the other hand, lower thresholds will identify more bots and will
  78. identify them faster. A value of 10 / 50 is a better setting for most sites.
  79. Bad user agents cannot be configured via the admin at this moment. You can add
  80. bad strings in the 'rate_bot_agent' table. Percent signs ("%") can be used as
  81. wildcards. A string can be for example "%GoogleBot%" or just "%bot%". Patterns
  82. are case insensitive. The id field is for identification and has no meaning.
  83. 3. Permissions
  84. --------------------------------------------------------------------------------
  85. You need to set permissions for the Rate module at /admin/people/permissions.
  86. For administering Rate - creating, updating or deleting widgets, a user will
  87. need the "Administer Rate options" permission. CAUTION: assign this permission
  88. to administrator roles only.
  89. For each entity bundle, which has a rate widget attached, there will be a
  90. separate record, such as "Can vote on ENTITY_TYPE of ENTITY_BUNDLE", for
  91. example "Can vote on node type of article". Set the permissions accordingly.
  92. If you want users other than admin to access the voting results page, you need
  93. to give them the "View rate result page" permission on admin/user/permissions.
  94. 4. Widget configuration
  95. --------------------------------------------------------------------------------
  96. Since Rate version 8.2. all rate widgets are stored separately in the database
  97. as configuration entities. To configure the rate widgets, go to
  98. /admin/structure/rate_widgets.
  99. To add a new rate widget, click on the button "+Add rate widget".
  100. A list of existing rate widgets is shown at /admin/structure/rate_widgets.
  101. To modify an existing rate widget click on the button "Edit" next to the
  102. table entry you want to modify.
  103. 4.1. Widget entity configuration
  104. --------------------------------
  105. The elements on the widget configuration form are explained in this paragraph.
  106. Note that some elements may not be available depending on the widget type you
  107. use, these are "Value type", "Options" and "Translate options".
  108. * Name
  109. The title is only used in the admin section. Use a recognizable name.
  110. * Machine name
  111. Name used for technical purposes. You may only contain alphanumeric characters
  112. and underscores (generated automatically).
  113. * Template
  114. Select the type of widget to create. The following widget types are provided
  115. by the rate module:
  116. * Fivestar
  117. * Number Up / Down
  118. * Thumbs Up
  119. * Thumbs Up / Down
  120. * Yes / No
  121. This will impact the look of the widget.
  122. * Value type
  123. This determines how vote results are totaled. VotingAPI supports three value
  124. types by default: 'Percentage' votes are averaged, 'Points' votes are summed
  125. up, and 'Options' votes get a count of votes cast for each specific option.
  126. Typical usages are:
  127. * Thumbs up / down: use points
  128. * Bad / mediocre / good: use percentage
  129. * Makes me funny / boring / mad / angry: use options
  130. * Options (see §4.2 for more information).
  131. These are the options displayed to the user. Each option has a value, a label
  132. and a class.
  133. * Entities
  134. Check the entity types on which a rate widget should be available. There are
  135. separate columns for nodes and comments in this table.
  136. * Voting settings
  137. * Use a vote deadline
  138. Enables a deadline date field on the respective node.
  139. If deadline is set and date passed, the widget will be shown as disabled.
  140. * Anonymous (Registered user) vote rollover
  141. The amount of time that must pass before two votes from the same computer
  142. are considered unique. Set the rollover to a time period. Setting this to
  143. 'Never' will allow only one vote. Setting this to 'Immediately' will allow
  144. the user to cast votes with every click. 'Votingapi setting' will inherit
  145. the settings which are configured at /admin/config/search/votingapi.
  146. * Display settings
  147. Configures the content, position and class of a rate widget label and
  148. description filds. Here a widget can be set to be 'read-only'.
  149. * Results
  150. Configures the content and position of the result summary.
  151. To customize the results summary template you need to copy the file
  152. rate\templates\rate-widgets-summary.html.twig to your subtheme and
  153. modify it accordingly.
  154. 4.2. Options
  155. ------------
  156. Options are the "buttons" displayed in the widget. These can be visually
  157. different, depending on the theming. Options are generated as radio form
  158. elements by default.
  159. Each option has a value, a label and a class. Only the label is visible for the
  160. user, but the value is what he actually votes for when clicking the button.
  161. Values have to be configured according to the following rules:
  162. * Values must be integers (may be negative). Thus '1', '2', '0', '-3' are all
  163. right, but '2.3' is wrong.
  164. * Values must be unique across all options within the same widget.
  165. Which value you should use depends on the value type setting. When using points,
  166. these are the points which will be added when clicking that button. So "thumbs
  167. up" must have the value '1', "thumbs down" the value '-1' and "neutral" '0'. For
  168. 'Percentage' you have to use whole numbers between 0 and 100. When using
  169. 'Options', you may use any number as long as they are unique. It doesn't have to
  170. make sense as they are only used for storage.
  171. To add an option, click on the button "Add another option".
  172. To delete an option - delete its values in the fields value, label and class and
  173. save the rate widget.
  174. 5. Voting results
  175. --------------------------------------------------------------------------------
  176. Voting results are available on the voting results page. You can get there by
  177. clicking the "Node votes" tab on the node page. Note that this tab is hidden
  178. if the node does not have any rate widgets or if you do not have the
  179. "view rate results" permission.
  180. The voting results page is only available for nodes.
  181. In order to enable the voting results for other entity types, e.g. users, groups
  182. etc., you will need to create YOURMODULE.links.task.yml, YOURMODULE.routing.yml
  183. and a custom controller in your custom module. See the node implementation in
  184. rate as a starting point (rate.node_results_page).
  185. 6. Views integration
  186. --------------------------------------------------------------------------------
  187. Add a field of the type "Rate widget" to your view. If your view has
  188. relationships defined, select the correct one to attach the field to.
  189. In the field configuration form, you have the following possibilities:
  190. * Which field column holds the entity ID?
  191. Select the ID of the entity you would like to vote on. This entity has to have
  192. the rate widget widget attached to it.
  193. You can attach the entity id to your and then hide teh field.
  194. Through this you can vote on any entity, as long as you can show it in your
  195. view.
  196. * Some entities have multiple widgets attached...
  197. If the entity has multiple widgets attached - select the one to be shown in
  198. this field.
  199. If you want several widgets to be shown - add another Rate widget field to
  200. your view.
  201. * Show widget
  202. * Full - will show it as configured.
  203. * Summary - will show only the widget summary (enable it in the configuration)
  204. * Read only - show the widget as configured, but block the user from voting.
  205. * Override rate widget display options
  206. With this setting you can hide the label, description and/or the result
  207. summary.
  208. CAUTION: filtering or sorting based on the Rate widget field is not possible.
  209. In order to filter or sort on the voting results, add a relation to the
  210. Voting API results and sort/filter on them.
  211. 7. Rate deadline (close voting on a specified date)
  212. --------------------------------------------------------------------------------
  213. This option allows you to close voting on a specified date.
  214. When adding or editing a rate widget, checking 'Use vote deadline' in 'Voting
  215. settings' will add a date field to each entity this rate widget is attached to.
  216. The deadline can be then set on each entity individually (e.g. Article 1 and
  217. Article 2). To do so, open the entity in question, go to its edit form and set
  218. the deaedline. By default, the deadline field is not showing on the view display
  219. of the entity, but you can change this.
  220. If the deadline is set for an entity and the date is already passed, the rate
  221. widget will be disabled. Additional variables - disabled and deadline_disabled
  222. are passed to rate-widgets-summary.html.twig, so you can customize the result
  223. summary accordingly.
  224. 8. Hooks
  225. --------------------------------------------------------------------------------
  226. Hooks for modules are documented in rate.api.php.
  227. Currently there is one hook available - hook_rate_widget_options_alter.
  228. With its help you can override the options (value, label, class) of a rate
  229. widget. It is called before the rate widget is being rendered.