Metadata-Version: 2.4
Name: djangocms-help-rating
Version: 1.2.0
Summary: DjangoCMS Help rating.
Author-email: Zdeněk Böhm <zdenek.bohm@nic.cz>
License: BSD License
Project-URL: Homepage, https://gitlab.nic.cz/djangocms-apps/djangocms-help-rating
Project-URL: Repository, https://gitlab.nic.cz/djangocms-apps/djangocms-help-rating.git
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Framework :: Django CMS
Classifier: Framework :: Django CMS :: 3.4
Classifier: Framework :: Django CMS :: 4.1
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: django-cms
Provides-Extra: quality
Provides-Extra: test
Provides-Extra: types

# DjangoCMS Help Rating

A project for simple evaluation of [DjangoCMS](https://www.django-cms.org/) website content.

### Install

`pip install djangocms-help-rating`


Add into settings.py:

```python
INSTALLED_APPS = [
    ...
    "help_rating",
]
```

Add into site urls.py:

```python
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:

```python
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:

```python
HELP_RATING_MSG_QUESTION = "Did this help you?"
```

The standard response can be redefined with the ``HELP_RATING_MSG_THANK_YOU`` parameter in settings:

```python
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:

```python
HELP_RATING_SCRIPT_SUCCESS = "help_rating_success"
```

The function accepts one parameter, which is a ``<div class="answer">`` element. For example:

```javascript
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
