Skip to content

Commit bd908da

Browse files
committed
MDL-84577 badges: Improve badge creation form
To improve usability, the UX team proposed the following changes: - Remove most tooltips - Add information directly to the page - Simplify several text strings
1 parent 77a7d81 commit bd908da

File tree

5 files changed

+41
-35
lines changed

5 files changed

+41
-35
lines changed

badges/classes/form/badge.php

+5-7
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,14 @@ public function definition() {
6262

6363
$mform->addElement('text', 'version', get_string('version', 'badges'), ['size' => '70']);
6464
$mform->setType('version', PARAM_TEXT);
65-
$mform->addHelpButton('version', 'version', 'badges');
6665

6766
$languages = get_string_manager()->get_list_of_languages();
6867
$mform->addElement('select', 'language', get_string('language'), $languages);
69-
$mform->addHelpButton('language', 'language', 'badges');
7068

7169
$mform->addElement('textarea', 'description', get_string('description', 'badges'), 'wrap="virtual" rows="8" cols="70"');
7270
$mform->setType('description', PARAM_NOTAGS);
7371
$mform->addRule('description', null, 'required');
72+
$mform->addElement('static', 'descriptioninfo', null, get_string('descriptioninfo', 'badges'));
7473

7574
$str = $action == 'new' ? get_string('badgeimage', 'badges') : get_string('newimage', 'badges');
7675
$imageoptions = ['maxbytes' => 262144, 'accepted_types' => ['optimised_image']];
@@ -82,10 +81,11 @@ public function definition() {
8281
$currentimage = $mform->createElement('static', 'currentimage', get_string('currentimage', 'badges'));
8382
$mform->insertElementBefore($currentimage, 'image');
8483
}
85-
$mform->addHelpButton('image', 'badgeimage', 'badges');
84+
$mform->addElement('static', 'imageinfo', null, get_string('badgeimageinfo', 'badges'));
85+
8686
$mform->addElement('text', 'imagecaption', get_string('imagecaption', 'badges'), ['size' => '70']);
8787
$mform->setType('imagecaption', PARAM_TEXT);
88-
$mform->addHelpButton('imagecaption', 'imagecaption', 'badges');
88+
8989
$mform->addElement('tags', 'tags', get_string('tags', 'badges'), ['itemtype' => 'badge', 'component' => 'core_badges']);
9090

9191
$mform->addElement('header', 'issuerdetails', get_string('issuerdetails', 'badges'));
@@ -96,15 +96,14 @@ public function definition() {
9696
$site = get_site();
9797
$issuername = $CFG->badges_defaultissuername ?: $site->fullname;
9898
$mform->setDefault('issuername', $issuername);
99-
$mform->addHelpButton('issuername', 'issuername', 'badges');
10099

101100
$mform->addElement('text', 'issuercontact', get_string('contact', 'badges'), ['size' => '70']);
102101
if (isset($CFG->badges_defaultissuercontact)) {
103102
$mform->setDefault('issuercontact', $CFG->badges_defaultissuercontact);
104103
}
105104
$mform->setType('issuercontact', PARAM_RAW);
106105
$mform->addRule('issuercontact', null, 'email');
107-
$mform->addHelpButton('issuercontact', 'contact', 'badges');
106+
108107
// Set issuer URL.
109108
// Have to parse URL because badge issuer origin cannot be a subfolder in wwwroot.
110109
$url = parse_url($CFG->wwwroot);
@@ -124,7 +123,6 @@ public function definition() {
124123
$issuancedetails[] = $mform->createElement('static', 'expiryperiods_break', null, get_string('after', 'badges'));
125124

126125
$mform->addGroup($issuancedetails, 'expirydategr', get_string('expirydate', 'badges'), [' '], false);
127-
$mform->addHelpButton('expirydategr', 'expirydate', 'badges');
128126
$mform->setDefault('expiry', 0);
129127
$mform->setDefault('expiredate', strtotime('+1 year'));
130128
$mform->disabledIf('expiredate[day]', 'expiry', 'neq', 1);

badges/tests/behat/add_badge.feature

+12-12
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ Feature: Add badges to the system
2525
| badges_defaultissuername | Test Badge Site |
2626
| badges_defaultissuercontact | testuser@example.com |
2727
And I navigate to "Badges > Add a new badge" in site administration
28-
And the field "Issuer name" matches value "Test Badge Site"
29-
And the field "Issuer contact" matches value "testuser@example.com"
28+
And the field "issuername" matches value "Test Badge Site"
29+
And the field "Email" matches value "testuser@example.com"
3030
And I set the following fields to these values:
3131
| Name | Test badge with 'apostrophe' and other friends (<>&@#) |
3232
| Version | v1 |
3333
| Language | English |
3434
| Description | Test badge description |
3535
| Image caption | Test caption image |
3636
| Tags | Math, Physics |
37-
| Issuer contact | issuer@example.com |
37+
| Email | issuer@example.com |
3838
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
3939
When I press "Create badge"
4040
Then I should see "Edit details"
@@ -100,11 +100,11 @@ Feature: Add badges to the system
100100
And I should see "Endorsement"
101101
And I select "Endorsement" from the "jump" singleselect
102102
And I set the following fields to these values:
103-
| Endorser name | Endorser |
104-
| Email | endorsement@example.com |
105-
| Issuer URL | http://example.com |
106-
| Claim URL | http://claimurl.example.com |
107-
| Endorsement comment | Test Endorsement comment |
103+
| Endorser name | Endorser |
104+
| Email | endorsement@example.com |
105+
| URL | http://example.com |
106+
| Claim URL | http://claimurl.example.com |
107+
| Endorsement comment | Test Endorsement comment |
108108
And I press "Save changes"
109109
Then I should see "Changes saved"
110110

@@ -182,15 +182,15 @@ Feature: Add badges to the system
182182
And I navigate to "Badges > Manage badges" in site administration
183183
When I press "Edit" action in the "Testing site badge" report row
184184
And I should see "Testing site badge"
185-
And the field "Issuer contact" matches value "testuser@example.com"
185+
And the field "Email" matches value "testuser@example.com"
186186
And I set the following fields to these values:
187187
| Name | Test badge with 'apostrophe' and other friends (<>&@#) |
188188
| Version | secondversion |
189189
| Language | English |
190190
| Description | Modified test badge description |
191191
| Image caption | Test caption image |
192192
| Tags | Math, History |
193-
| Issuer contact | issuer@invalid.cat |
193+
| Email | issuer@invalid.cat |
194194
And I press "Save changes"
195195
And I select "Overview" from the "jump" singleselect
196196
And I expand all fieldsets
@@ -205,8 +205,8 @@ Feature: Add badges to the system
205205

206206
Scenario: Default value for issuer name
207207
When I navigate to "Badges > Add a new badge" in site administration
208-
Then the field "Issuer name" matches value "Acceptance test site"
208+
Then the field "issuername" matches value "Acceptance test site"
209209
But the following config values are set as admin:
210210
| badges_defaultissuername | Test Badge Site |
211211
And I navigate to "Badges > Add a new badge" in site administration
212-
And the field "Issuer name" matches value "Test Badge Site"
212+
And the field "issuername" matches value "Test Badge Site"

badges/tests/behat/view_badge.feature

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Feature: Display badges
100100
# Set expired date to badge (future date).
101101
Given I press "Edit" action in the "Testing system badge" report row
102102
And I expand all fieldsets
103-
When I click on "Relative date" "radio"
103+
When I click on "Relative date: this badge expires after a period of time:" "radio"
104104
And I set the field "expireperiod[number]" to "1"
105105
And I press "Save changes"
106106
And I should see "Changes saved"
@@ -124,7 +124,7 @@ Feature: Display badges
124124
# Set expired date to badge (relative date 1 seconds after the date of issue it).
125125
Given I press "Edit" action in the "Testing system badge" report row
126126
And I expand all fieldsets
127-
When I click on "Relative date" "radio"
127+
When I click on "Relative date: this badge expires after a period of time:" "radio"
128128
And I set the field "expireperiod[timeunit]" to "1"
129129
And I set the field "expireperiod[number]" to "1"
130130
And I press "Save changes"

lang/en/badges.php

+15-14
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
$string['badges'] = 'Badges';
147147
$string['badgedetails'] = 'Badge details';
148148
$string['badgeimage'] = 'Image';
149-
$string['badgeimage_help'] = 'The image should be at least 300 x 300 pixels in size. It will be displayed as 300 x 300 pixels on the badge page and 100 x 100 pixels on the user\'s profile page.';
149+
$string['badgeimageinfo'] = 'For best results, upload a square image with a minimum size of 300 x 300 pixels.';
150150
$string['badgeissued'] = 'Badge issued';
151151
$string['badgeprivacysetting'] = 'Badge privacy settings';
152152
$string['badgeprivacysetting_help'] = 'Badges you earn can be displayed on your account profile page. This setting allows you to automatically set the visibility of the newly earned badges.
@@ -179,7 +179,6 @@
179179
$string['balignment'] = 'Alignments ({$a})';
180180
$string['bydate'] = ' complete by';
181181
$string['imagecaption'] = 'Image caption';
182-
$string['imagecaption_help'] = 'If specified, an image caption is displayed on the badge page.';
183182
$string['claim'] = 'Claim';
184183
$string['claimcomment'] = 'Endorsement comment';
185184
$string['claimid'] = 'Claim URL';
@@ -191,8 +190,7 @@
191190
$string['connect'] = 'Connect';
192191
$string['connected'] = 'Connected';
193192
$string['connecting'] = 'Connecting...';
194-
$string['contact'] = 'Issuer contact';
195-
$string['contact_help'] = 'An email address associated with the badge issuer.';
193+
$string['contact'] = 'Email';
196194
$string['copy'] = 'Copy';
197195
$string['copyof'] = 'Copy of {$a}';
198196
$string['course'] = 'Course: {$a}';
@@ -288,6 +286,7 @@
288286
$string['delcritconfirm'] = 'Are you sure that you want to delete this criterion?';
289287
$string['delparamconfirm'] = 'Are you sure that you want to delete this parameter?';
290288
$string['description'] = 'Description';
289+
$string['descriptioninfo'] = 'What does this badge represent?';
291290
$string['disconnect'] = 'Disconnect';
292291
$string['donotaward'] = 'Currently, this badge is not active, so it cannot be awarded to users. If you would like to award this badge, please set its status to active.';
293292
$string['enablebadges'] = 'Enable badges';
@@ -310,7 +309,6 @@
310309
$string['error:noactivities'] = 'There are no activities with completion criteria enabled in this course.';
311310
$string['error:nobadges'] = 'There are currently no badges with access enabled to be added as criteria. A site badge can only have other site badges as criteria. A course badge can have other course badges or site badges as criteria.';
312311
$string['error:invalidparamcohort'] = 'Cohort does not exist. ';
313-
$string['error:noactivities'] = 'There are no activities with completion criteria enabled in this course.';
314312
$string['error:nocohorts'] = 'No cohorts';
315313
$string['error:nocourses'] = 'Course completion is not enabled for any of the courses in this site, so none can be displayed. Course completion may be enabled in the course settings.';
316314
$string['error:nogroupssummary'] = '<p>There are no public collections of badges available in your backpack. </p>';
@@ -355,14 +353,13 @@
355353
$string['expireperiodm'] = 'This badge expires {$a} minute(s) after being issued.';
356354
$string['expireperiods'] = 'This badge expires {$a} second(s) after being issued.';
357355
$string['expirydate'] = 'Expiry date';
358-
$string['expirydate_help'] = 'Optionally, badges can expire on a specific date, or the date can be calculated based on the date when the badge was issued to a user. ';
359356
$string['existsinbackpack'] = 'Badge already exists in backpack';
360357
$string['externalconnectto'] = 'To display external badges you need to <a href="{$a}">connect to a backpack</a>.';
361358
$string['externalbackpack_required'] = 'Backpack provider can\'t be blank';
362359
$string['externalbadges'] = 'My badges from other web sites';
363360
$string['externalbadgesp'] = 'Badges from other web sites:';
364361
$string['externalbadges_help'] = 'This area displays badges from your external backpack.';
365-
$string['fixed'] = 'Fixed date';
362+
$string['fixed'] = 'Fixed date: this badge expires on the following date:';
366363
$string['hidden'] = 'Hidden';
367364
$string['hiddenbadge'] = 'Unfortunately, the badge owner has not made this information available.';
368365
$string['hostedurl'] = 'External URL';
@@ -375,14 +372,12 @@
375372
$string['issuerdetails'] = 'Issuer details';
376373
$string['issueremail'] = 'Email';
377374
$string['issueremail_help'] = 'A contact email address of the organisation issuing the endorsement.';
378-
$string['issuername'] = 'Issuer name';
379-
$string['issuername_help'] = 'Name of the issuing agent or authority.';
375+
$string['issuername'] = 'Name';
380376
$string['issuername_endorsement'] = 'Endorser name';
381377
$string['issuername_endorsement_help'] = 'The name of the endorser.';
382-
$string['issuerurl'] = 'Issuer URL';
378+
$string['issuerurl'] = 'URL';
383379
$string['issuerurl_help'] = 'The website of the organisation issuing the endorsement. The URL should have a prefix http:// or https://.';
384380
$string['language'] = 'Language';
385-
$string['language_help'] = 'The language used on the badge page.';
386381
$string['listbackpacks'] = 'List of backpacks';
387382
$string['localconnectto'] = 'To share these badges outside this web site you need to <a href="{$a}">connect to a backpack</a>.';
388383
$string['localbadges'] = 'My badges from {$a} web site';
@@ -410,7 +405,7 @@
410405
$string['mybadges'] = 'My badges';
411406
$string['mybackpack'] = 'My backpack settings';
412407
$string['namewithlink'] = 'Name with link';
413-
$string['never'] = 'Never';
408+
$string['never'] = 'Never: this badge does not expire.';
414409
$string['newbackpack'] = 'Add a new backpack';
415410
$string['newbadge'] = 'Add a new badge';
416411
$string['newbadgedeprecated'] = 'You have been redirected from badges/newbadge.php. Please note that badges/newbadge.php will be removed in the near future.
@@ -504,7 +499,7 @@
504499
$string['recipient'] = 'Badge recipient';
505500
$string['recipients'] = 'Badge recipients';
506501
$string['recipientvalidationproblem'] = 'This user cannot be verified as a recipient of this badge.';
507-
$string['relative'] = 'Relative date';
502+
$string['relative'] = 'Relative date: this badge expires after a period of time:';
508503
$string['relatedbages'] = 'Related badges';
509504
$string['revoke'] = 'Revoke badge';
510505
$string['requiredcohort'] = 'At least one cohort should be added to the cohort criterion.';
@@ -582,7 +577,6 @@
582577
$string['viewbadge'] = 'View issued badge';
583578
$string['visible'] = 'Visible';
584579
$string['version'] = 'Version';
585-
$string['version_help'] = 'The version field may be used to keep track of the badge\'s development. If specified, the version is displayed on the badge page.';
586580
$string['warnexpired'] = ' (This badge has expired!)';
587581
$string['year'] = 'Year(s)';
588582
$string['includeauthdetails'] = "Include authentication details with the backpack";
@@ -597,9 +591,16 @@
597591
$string['reviewbadge'] = 'Changes in badge access';
598592

599593
// Deprecated since Moodle 5.0.
594+
$string['badgeimage_help'] = 'The image should be at least 300 x 300 pixels in size. It will be displayed as 300 x 300 pixels on the badge page and 100 x 100 pixels on the user\'s profile page.';
595+
$string['contact_help'] = 'An email address associated with the badge issuer.';
596+
$string['expirydate_help'] = 'Optionally, badges can expire on a specific date, or the date can be calculated based on the date when the badge was issued to a user. ';
600597
$string['imageauthoremail'] = 'Image author\'s email';
601598
$string['imageauthoremail_help'] = 'If specified, the email address of the badge image author is displayed on the badge page.';
602599
$string['imageauthorname'] = 'Image author\'s name';
603600
$string['imageauthorname_help'] = 'If specified, the name of the badge image author is displayed on the badge page.';
604601
$string['imageauthorurl'] = 'Image author\'s URL';
605602
$string['imageauthorurl_help'] = 'If specified, a link to the badge image author\'s website is displayed on the badge page. The URL should have a prefix http:// or https://.';
603+
$string['imagecaption_help'] = 'If specified, an image caption is displayed on the badge page.';
604+
$string['issuername_help'] = 'Name of the issuing agent or authority.';
605+
$string['language_help'] = 'The language used on the badge page.';
606+
$string['version_help'] = 'The version field may be used to keep track of the badge\'s development. If specified, the version is displayed on the badge page.';

lang/en/deprecated.txt

+7
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,10 @@ imageauthorname,core_badges
156156
imageauthorname_help,core_badges
157157
imageauthorurl,core_badges
158158
imageauthorurl_help,core_badges
159+
version_help,core_badges
160+
language_help,core_badges
161+
badgeimage_help,core_badges
162+
imagecaption_help,core_badges
163+
issuername_help,core_badges
164+
contact_help,core_badges
165+
expirydate_help,core_badges

0 commit comments

Comments
 (0)