great-components 2.7.3__py3-none-any.whl → 2.8.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- great_components/forms/fields.py +11 -1
- great_components/mixins.py +29 -17
- {great_components-2.7.3.dist-info → great_components-2.8.0.dist-info}/METADATA +1 -1
- {great_components-2.7.3.dist-info → great_components-2.8.0.dist-info}/RECORD +7 -7
- {great_components-2.7.3.dist-info → great_components-2.8.0.dist-info}/LICENSE +0 -0
- {great_components-2.7.3.dist-info → great_components-2.8.0.dist-info}/WHEEL +0 -0
- {great_components-2.7.3.dist-info → great_components-2.8.0.dist-info}/top_level.txt +0 -0
great_components/forms/fields.py
CHANGED
@@ -87,7 +87,17 @@ class DirectoryComponentsFieldMixin:
|
|
87
87
|
|
88
88
|
@property
|
89
89
|
def widget_css_classes(self):
|
90
|
-
|
90
|
+
try:
|
91
|
+
return self.widget.attrs['class']
|
92
|
+
except (KeyError, AttributeError):
|
93
|
+
return ''
|
94
|
+
|
95
|
+
@property
|
96
|
+
def label_css_classes(self):
|
97
|
+
try:
|
98
|
+
return self.widget.attrs['label-class']
|
99
|
+
except (KeyError, AttributeError):
|
100
|
+
return ''
|
91
101
|
|
92
102
|
def get_bound_field(self, form, field_name):
|
93
103
|
return DirectoryComponentsBoundField(form, self, field_name)
|
great_components/mixins.py
CHANGED
@@ -31,7 +31,7 @@ class EnableTranslationsMixin:
|
|
31
31
|
|
32
32
|
context['language_switcher'] = {
|
33
33
|
'show': True,
|
34
|
-
'form': self.language_form_class(**language_form_kwargs)
|
34
|
+
'form': self.language_form_class(**language_form_kwargs),
|
35
35
|
}
|
36
36
|
return context
|
37
37
|
|
@@ -51,12 +51,11 @@ class CMSLanguageSwitcherMixin:
|
|
51
51
|
def get_context_data(self, *args, **kwargs):
|
52
52
|
form = forms.LanguageForm(
|
53
53
|
initial={'lang': translation.get_language()},
|
54
|
-
language_choices=self.page['meta']['languages']
|
55
|
-
)
|
56
|
-
show_language_switcher = (
|
57
|
-
len(self.page['meta']['languages']) > 1 and
|
58
|
-
form.is_language_available(translation.get_language())
|
54
|
+
language_choices=self.page['meta']['languages'],
|
59
55
|
)
|
56
|
+
show_language_switcher = len(
|
57
|
+
self.page['meta']['languages']
|
58
|
+
) > 1 and form.is_language_available(translation.get_language())
|
60
59
|
return super().get_context_data(
|
61
60
|
language_switcher={'form': form, 'show': show_language_switcher},
|
62
61
|
*args,
|
@@ -69,7 +68,14 @@ class GA360Mixin:
|
|
69
68
|
self.ga360_payload = {}
|
70
69
|
super().__init__(*args, **kwargs)
|
71
70
|
|
72
|
-
def set_ga360_payload(
|
71
|
+
def set_ga360_payload(
|
72
|
+
self,
|
73
|
+
page_id,
|
74
|
+
business_unit,
|
75
|
+
site_section,
|
76
|
+
site_subsection=None,
|
77
|
+
referer_url=None,
|
78
|
+
):
|
73
79
|
self.ga360_payload['page_id'] = page_id
|
74
80
|
self.ga360_payload['business_unit'] = business_unit
|
75
81
|
self.ga360_payload['site_section'] = site_section
|
@@ -88,16 +94,20 @@ class GA360Mixin:
|
|
88
94
|
},
|
89
95
|
json={
|
90
96
|
'client_id': str(uuid.uuid4()),
|
91
|
-
'events': [
|
92
|
-
|
93
|
-
|
94
|
-
'
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
97
|
+
'events': [
|
98
|
+
{
|
99
|
+
'name': 'page_view',
|
100
|
+
'params': {
|
101
|
+
'page_id': self.ga360_payload.get('page_id'),
|
102
|
+
'business_unit': self.ga360_payload.get('business_unit'),
|
103
|
+
'site_section': self.ga360_payload.get('site_section'),
|
104
|
+
'site_subsection': self.ga360_payload.get(
|
105
|
+
'site_subsection'
|
106
|
+
),
|
107
|
+
'site_language': self.ga360_payload.get('site_language'),
|
108
|
+
},
|
99
109
|
}
|
100
|
-
|
110
|
+
],
|
101
111
|
},
|
102
112
|
)
|
103
113
|
logger.info('Request status code %s', req.status_code)
|
@@ -106,7 +116,9 @@ class GA360Mixin:
|
|
106
116
|
user = helpers.get_user(self.request)
|
107
117
|
is_logged_in = helpers.get_is_authenticated(self.request)
|
108
118
|
self.ga360_payload['login_status'] = is_logged_in
|
109
|
-
self.ga360_payload['user_id'] =
|
119
|
+
self.ga360_payload['user_id'] = (
|
120
|
+
user.hashed_uuid if (is_logged_in and not user.is_superuser) else ''
|
121
|
+
) # requested in GREATUK-2568
|
110
122
|
self.ga360_payload['site_language'] = translation.get_language()
|
111
123
|
self.__send_to_ga4()
|
112
124
|
return super().get_context_data(ga360=self.ga360_payload, *args, **kwargs)
|
@@ -7,10 +7,10 @@ great_components/context_processors.py,sha256=YkJPBLrrYnDYUHCpQP1shHommdj5NhgL-a
|
|
7
7
|
great_components/decorators.py,sha256=dgT0IxSN0uTlCSzsAdGU9NsR9hqouk0YPkNNzefRKtE,311
|
8
8
|
great_components/helpers.py,sha256=kOQqv4v2DSY5iKyseWnrMLawoa381GPRMgC7oHN3uCM,6908
|
9
9
|
great_components/middleware.py,sha256=9dVTTbMlTBnwcmDB3CDi6DGQrxiecOwY-Dg7lEOC_OQ,7361
|
10
|
-
great_components/mixins.py,sha256
|
10
|
+
great_components/mixins.py,sha256=-8oh-xcCBEUMv1QPJSEYyaR56wp32JBkuiKHx5bmwJM,4457
|
11
11
|
great_components/views.py,sha256=N2F6kvJUMmW9OQCIPcH16KMLlNhD_nrOTz_m0bnExZo,544
|
12
12
|
great_components/forms/__init__.py,sha256=hKKA3w8GBglzmszrK3-z3n8DSRBKcBe9_TLrC52YbLI,153
|
13
|
-
great_components/forms/fields.py,sha256=
|
13
|
+
great_components/forms/fields.py,sha256=QZjU3ierwb05CDESUMKCEly5w6wJpLHCa4B--hcmQ7Q,6395
|
14
14
|
great_components/forms/forms.py,sha256=vWfSuI4li0Wnw1KBmc2JEEMuQE7qZb9PXr0fJTK985w,1462
|
15
15
|
great_components/forms/widgets.py,sha256=U0oDJ3O6YvMK7d_PDXKNuYNxKHH2ehWF91yvL2P-yjs,4339
|
16
16
|
great_components/janitor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -634,8 +634,8 @@ great_components/templates/great_components/header_footer/search.html,sha256=SVU
|
|
634
634
|
great_components/templates/great_components/header_footer/sso_login.html,sha256=IasiMYwuaTDbwpwYa2gLJcEQRIqZcZHGCpeh7Awvw9M,463
|
635
635
|
great_components/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
636
636
|
great_components/templatetags/great_components.py,sha256=O_zVpOvZMHwhCpyq4JmmYu_iGwvaFsIP6lDn_ihtOVs,12173
|
637
|
-
great_components-2.
|
638
|
-
great_components-2.
|
639
|
-
great_components-2.
|
640
|
-
great_components-2.
|
641
|
-
great_components-2.
|
637
|
+
great_components-2.8.0.dist-info/LICENSE,sha256=q4QjlbTN37umB_xq3DRmS0qvT2tMO_5_-u0WWzYcDQE,1091
|
638
|
+
great_components-2.8.0.dist-info/METADATA,sha256=Jdj-nvqWCp8GGDsGDna54i7sAnAY7tza8Q-U2DFC2QU,10545
|
639
|
+
great_components-2.8.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
640
|
+
great_components-2.8.0.dist-info/top_level.txt,sha256=aI2xcjZzpL8o3QuUGQB5YkqHOknVkFwQOSZQiaNqRHU,22
|
641
|
+
great_components-2.8.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|