DjangoCMS Help rating.
Project description
DjangoCMS Help Rating
A project for simple evaluation of DjangoCMS website content.
Install
pip install djangocms-help-rating
Add into settings.py:
INSTALLED_APPS = [
...
"help_rating",
]
Add into site urls.py:
urlpatterns = [
...
path('help-rating/', include(('help_rating.urls', "help_rating"))),
]
If you define a namespace other than help_rating in the urls.py, you must redefine it in settings with the value HELP_RATING_PATH_NAMESPACE.
Default of HELP_RATING_PATH_NAMESPACE is "help_rating".
Customize appearance and functionality
You set the appearance with the HELP_RATING_RATINGS parameter in settings. For example:
from help_rating.constants import ScoreItem, ScoreType
HELP_RATING_RATINGS = [
ScoreItem(ScoreType.NOT_AT_ALL.value, "no", "img/thumb-down.svg", _("No")),
ScoreItem(ScoreType.YES.value, "yes", "img/thumb-up.svg", _("Yes")),
]
The standard question can be redefined with the HELP_RATING_MSG_QUESTION parameter in settings:
HELP_RATING_MSG_QUESTION = "Did this help you?"
The standard response can be redefined with the HELP_RATING_MSG_THANK_YOU parameter in settings:
HELP_RATING_MSG_THANK_YOU = "Thank you for the feedback!"
The Javascript function that is called when the form is successfully submitted is set by the HELP_RATING_SCRIPT_SUCCESS parameter in settings. For example:
HELP_RATING_SCRIPT_SUCCESS = "help_rating_success"
The function accepts one parameter, which is a <div class="answer"> element. For example:
window.help_rating_success = (node) => {
const frame = node.closest('.help-rating-frame')
...
}
A function with the same parameter can be defined in the HELP_RATING_SCRIPT_FAILURE parameter even in case the form submission fails.
License
BSD License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file djangocms_help_rating-1.2.0.tar.gz.
File metadata
- Download URL: djangocms_help_rating-1.2.0.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e692068c2464e19b0f7bfb698a1d684d9c329d3dcfc84585c62ff17de9aa9bfe
|
|
| MD5 |
948a8e33d5c6b331551c1b4c438d4cce
|
|
| BLAKE2b-256 |
a0733ee86c1b10dd993fb77bba32348e444d5a45eb677ab8ea498f62286874e6
|
File details
Details for the file djangocms_help_rating-1.2.0-py3-none-any.whl.
File metadata
- Download URL: djangocms_help_rating-1.2.0-py3-none-any.whl
- Upload date:
- Size: 20.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f95d1d21aff1ae1d3a688afe09a27a7a4425f2c7db9d9824d60253b7a172830
|
|
| MD5 |
f35ffe7e5cf7a4594edb44e8d03c7c6c
|
|
| BLAKE2b-256 |
229e5cf09a7b4533db62e11618eac61adcdb8c2bab144864b7ef3678bc8d04b2
|