Skip to content

Commit

Permalink
[req-changes] Updated README and made requested changes to the UI
Browse files Browse the repository at this point in the history
  • Loading branch information
pandafy committed Apr 17, 2024
1 parent 5d1dca1 commit cd6c684
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 5 deletions.
5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1706,8 +1706,9 @@ means to make data-driven decisions while respecting our users' rights and trust
We have taken great care to ensure no
sensitive or personal data is being tracked.

The collection of this data can be disabled at any time by removing
the ``openwisp_utils.measurements`` app from ``INSTALLED_APPS``.
You can opt-out from sharing this data any time from the "System Info" page.
Alternatively, you can also remove the ``openwisp_utils.measurements`` app
from ``INSTALLED_APPS``.

Quality Assurance Checks
------------------------
Expand Down
11 changes: 11 additions & 0 deletions openwisp_utils/admin_theme/static/admin/css/openwisp-info.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#id_user_consented {
float: left;
margin-right: 8px;
vertical-align: top;
margin-bottom: 0px;
}
#id_metric_collection_consent_form > span.helptext{
display: block;
margin-top: 8px;

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{% extends "admin/base_site.html" %}
{% load i18n static %}

{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/openwisp-info.css' %}" />
{% endblock extrastyle %}

{% block content %}
{% if openwisp_version %}
<h2>{% trans "OpenWISP Version" %}: {{ openwisp_version }}</h2>
Expand All @@ -18,7 +23,7 @@ <h2>{% trans "OS Information" %}</h2>

{% block metric_collect_consent %}
{% if metric_collection_installed %}
<h2>Metric collection</h2>
<h2>Metric collection</h2>
<form method="POST" id="id_metric_collection_consent_form">
{% csrf_token %}
{{ metric_consent_form }}
Expand Down
32 changes: 32 additions & 0 deletions openwisp_utils/measurements/admin.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,41 @@
from django import forms
from django.forms.utils import ErrorList

from .models import MetricCollectionConsent


class MetricCollectionConsentForm(forms.ModelForm):
# This required to override the default label_suffix.
# Otherwise, it will show a trailing colon (:) which we
# don't want here due to formatting of the form.
def __init__(
self,
data=None,
files=None,
auto_id="id_%s",
prefix=None,
initial=None,
error_class=ErrorList,
label_suffix='',
empty_permitted=False,
instance=None,
use_required_attribute=None,
renderer=None,
):
super().__init__(
data,
files,
auto_id,
prefix,
initial,
error_class,
label_suffix,
empty_permitted,
instance,
use_required_attribute,
renderer,
)

class Meta:
model = MetricCollectionConsent
widgets = {'user_consented': forms.CheckboxInput(attrs={'class': 'bold'})}
Expand Down
4 changes: 2 additions & 2 deletions openwisp_utils/measurements/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class MetricCollectionConsent(TimeStampedEditableModel):
help_text=_(
'Allow OpenWISP to collect and share anonymous usage metrics to improve'
' the software. Before opting-out kindly consider reading'
' <a href="https://github.com/openwisp/openwisp-utils?tab=readme-ov-file'
'#collection-of-usage-metrics" target="_blank">why we collect metrics</a>.'
' <a href="https://openwisp.io/docs/user/usage-metric-collection.html"'
' target="_blank">why we collect metrics</a>.'
),
)

0 comments on commit cd6c684

Please sign in to comment.