Skip to content

Commit 9fba4d2

Browse files
authored
Sponsorship benefits ux fixes (#1687)
* Install jqueryui * Quickly displays elements titles * Update to all areas that states 'packages' to 'sponsor packages' * Highlight package only benefits
1 parent 3abcbe8 commit 9fba4d2

File tree

9 files changed

+47
-8
lines changed

9 files changed

+47
-8
lines changed

sponsors/forms.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@ def _clean_benefits(self, cleaned_data):
110110
if not package:
111111
raise forms.ValidationError(
112112
_(
113-
"The application has 1 or more package only benefits and no package."
113+
"The application has 1 or more package only benefits and no sponsor package."
114114
)
115115
)
116116
elif not benefit.packages.filter(id=package.id).exists():
117117
raise forms.ValidationError(
118118
_(
119-
"The application has 1 or more package only benefits but wrong package."
119+
"The application has 1 or more package only benefits but wrong sponsor package."
120120
)
121121
)
122122

sponsors/models.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Meta(OrderedModel.Meta):
3232

3333
def has_user_customization(self, benefits):
3434
"""
35-
Given a list of benefits this method checks if it exclusively matches the package benefits
35+
Given a list of benefits this method checks if it exclusively matches the sponsor package benefits
3636
"""
3737
pkg_benefits_with_conflicts = set(self.benefits.with_conflicts())
3838

@@ -113,7 +113,7 @@ class SponsorshipBenefit(OrderedModel):
113113
)
114114
package_only = models.BooleanField(
115115
default=False,
116-
verbose_name="Package Only Benefit",
116+
verbose_name="Sponsor Package Only Benefit",
117117
help_text="If a benefit is only available via a sponsorship package, select this option.",
118118
)
119119
new = models.BooleanField(
@@ -158,7 +158,7 @@ class SponsorshipBenefit(OrderedModel):
158158
)
159159

160160
NEW_MESSAGE = "New benefit this year!"
161-
PACKAGE_ONLY_MESSAGE = "This benefit is only available with packages"
161+
PACKAGE_ONLY_MESSAGE = "Benefit only available as part of a sponsor package"
162162
NO_CAPACITY_MESSAGE = "This benefit is currently at capacity"
163163

164164
@property

sponsors/tests/test_forms.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def test_package_only_benefit_without_package_should_not_validate(self):
101101
form = SponsorshiptBenefitsForm(data=data)
102102
self.assertFalse(form.is_valid())
103103
self.assertIn(
104-
"The application has 1 or more package only benefits and no package.",
104+
"The application has 1 or more package only benefits and no sponsor package.",
105105
form.errors["__all__"],
106106
)
107107

@@ -118,7 +118,7 @@ def test_package_only_benefit_with_wrong_package_should_not_validate(self):
118118
form = SponsorshiptBenefitsForm(data=data)
119119
self.assertFalse(form.is_valid())
120120
self.assertIn(
121-
"The application has 1 or more package only benefits but wrong package.",
121+
"The application has 1 or more package only benefits but wrong sponsor package.",
122122
form.errors["__all__"],
123123
)
124124

static/js/libs/jquery-ui-1.12.1.min.js

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/js/sponsors/applicationForm.js

+5
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,9 @@ $(document).ready(function(){
6565
}
6666
});
6767
});
68+
69+
$(document).tooltip({
70+
show: { effect: "blind", duration: 0 },
71+
hide: false
72+
});
6873
});

static/sass/style.css

+5
Original file line numberDiff line numberDiff line change
@@ -3618,13 +3618,18 @@ span.highlighted {
36183618
font-style: italic; }
36193619

36203620
/* ! ===== SPONSORSHIP APP ===== */
3621+
.ui-tooltip-content {
3622+
font-size: 75%; }
3623+
36213624
#sponsorship_application_container {
36223625
display: block;
36233626
text-align: center;
36243627
display: block;
36253628
text-align: center; }
36263629
#sponsorship_application_container form {
36273630
margin-bottom: 0; }
3631+
#sponsorship_application_container form .package_only_label {
3632+
color: #666666; }
36283633
#sponsorship_application_container #package_selection {
36293634
display: inline-block; }
36303635
#sponsorship_application_container #package_selection li {

static/sass/style.scss

+9
Original file line numberDiff line numberDiff line change
@@ -2395,12 +2395,21 @@ span.highlighted {
23952395
@import "fonts";
23962396

23972397
/* ! ===== SPONSORSHIP APP ===== */
2398+
.ui-tooltip-content {
2399+
font-size: 75%;
2400+
}
2401+
23982402
#sponsorship_application_container {
2403+
23992404
display: block;
24002405
text-align: center;
24012406

24022407
form {
24032408
margin-bottom: 0;
2409+
2410+
.package_only_label {
2411+
color: $grey;
2412+
}
24042413
}
24052414

24062415
#package_selection {

templates/base.html

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<meta http-equiv="X-UA-Compatible" content="IE=edge">
1010

1111
<link rel="prefetch" href="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js">
12+
<link rel="prefetch" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js">
1213

1314
<meta name="application-name" content="{{ SITE_INFO.site_name }}">
1415
<meta name="msapplication-tooltip" content="{{ SITE_INFO.site_descript }}">
@@ -37,6 +38,7 @@
3738
{# equivalent to: #}
3839
{#<link rel="stylesheet" href="{{ STATIC_URL }}stylesheets/no-mq.css" media="screen">#}
3940
<![endif]-->
41+
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
4042

4143
{# Place icon files in the root if possible (let browsers look for them where they expect them to be) #}
4244
<link rel="icon" type="image/x-icon" href="{{ STATIC_URL }}favicon.ico">
@@ -327,6 +329,8 @@ <h1 class="site-headline">
327329
{% block javascript %}
328330
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
329331
<script>window.jQuery || document.write('<script src="{{ STATIC_URL }}js/libs/jquery-1.8.2.min.js"><\/script>')</script>
332+
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
333+
<script>window.jQuery || document.write('<script src="{{ STATIC_URL }}js/libs/jquery-ui-1.12.1.min.js"><\/script>')</script>
330334

331335
<script src="{{ STATIC_URL }}js/libs/masonry.pkgd.min.js"></script>
332336
<script src="{{ STATIC_URL }}js/libs/html-includes.js"></script>

templates/sponsors/sponsorship_benefits_form.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
<div>
4242
<span><i class="fa fa-cubes"></i> {{ benefit_model.PACKAGE_ONLY_MESSAGE }}</span>
4343
{% if capacities_met %}<span><i class="fa fa-close"></i> {{ benefit_model.NO_CAPACITY_MESSAGE }}</span>{% endif %}
44+
<br/>
45+
<span><i class="fa fa-info"></i> Hover over benefit for details</span>
4446
</div>
4547
</div>
4648

@@ -53,7 +55,8 @@ <h3 class="title">{{ field.label }}</h3>
5355
<li class="{% cycle '' 'highlight' %}">
5456
<label for="id_{{field.name}}_{{ forloop.counter0 }}" benefit_id="{{ benefit.id }}">
5557
<input id="id_{{field.name}}_{{ forloop.counter0 }}" name="{{ field.name }}" type="checkbox" value="{{ benefit.id }}" {% if benefit.unavailability_message %}disabled{% endif %} {% if benefit.id in field.initial %}checked{% endif %} {% if benefit.package_only %}package_only='true'{% endif %}>
56-
<span {% if benefit.description %}title="{{ benefit.description }}"{% endif %}>{{ benefit.name }}</span>
58+
<span {% if benefit.package_only %} class='package_only_label'{% endif %}>{{ benefit.name }}</span>
59+
{% if benefit.description %}<i class="fa fa-info" title="{{ benefit.description }}"></i>{% endif %}
5760
{% if benefit.package_only %}<i class="fa fa-cubes" title="{{ benefit_model.PACKAGE_ONLY_MESSAGE }}"></i>{% endif %}
5861
{% if not benefit.has_capacity %}<i class="fa fa-close" title="{{ benefit_model.NO_CAPACITY_MESSAGE }}"></i>{% endif %}
5962
</label>

0 commit comments

Comments
 (0)