Skip to content

Commit

Permalink
feat: update tooltip. (#796)
Browse files Browse the repository at this point in the history
Co-authored-by: Yuchen Tu <[email protected]>
  • Loading branch information
zxcs001 and Yuchen Tu authored Nov 18, 2022
1 parent 085703d commit 909411b
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 3 deletions.
18 changes: 17 additions & 1 deletion src/components/EditCoursePage/AdditionalMetadataFields.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,23 @@ function AdditionalMetadataFields(props) {
<Field
name="additional_metadata.course_term_override"
component={RenderInputTextField}
label=<FieldLabel id="course_term_override.label" text="Override the course term" />
label={(
<FieldLabel
id="course_term_override.label"
text="Course Term Override"
helpText={(
<div>
<dl>
<dt>Course Term</dt>
<dd>
For example, in the UK universities use programme instead of course, so you can define which
term you want to use in course description to keep the consistency.
</dd>
</dl>
</div>
)}
/>
)}
disabled={disabled}
required={false}
/>
Expand Down
2 changes: 2 additions & 0 deletions src/components/EditCoursePage/EditCoursePage.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -924,8 +924,10 @@ describe('EditCoursePage', () => {
start_date: '2019-05-10T00:00:00Z',
registration_deadline: '2019-05-10T00:00:00Z',
variant_id: '00000000-0000-0000-0000-000000000000',
course_term_override: null,
},
draft: false,
enterprise_subscription_inclusion: undefined,
collaborators: undefined,
faq: '<p>Help?</p>',
full_description: '<p>Long</p>',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,21 @@ exports[`AdditionalMetadata Fields Display all fields 1`] = `
<FieldLabel
className=""
extraText=""
helpText=""
helpText={
<div>
<dl>
<dt>
Course Term
</dt>
<dd>
For example, in the UK universities use programme instead of course, so you can define which term you want to use in course description to keep the consistency.
</dd>
</dl>
</div>
}
id="course_term_override.label"
optional={false}
text="Override the course term"
text="Course Term Override"
/>
}
name="additional_metadata.course_term_override"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ exports[`EditCoursePage renders page correctly with courseInfo 1`] = `
},
"certificate_info_blurb": "blurb",
"certificate_info_heading": "heading",
"course_term_override": undefined,
"external_identifier": "2U_external_identifier",
"external_url": "https://www.external_url.com",
"facts_1_blurb": "facts_1_blurb",
Expand Down Expand Up @@ -1400,6 +1401,7 @@ exports[`EditCoursePage renders page correctly with courseInfo and courseOptions
},
"certificate_info_blurb": "blurb",
"certificate_info_heading": "heading",
"course_term_override": undefined,
"external_identifier": "2U_external_identifier",
"external_url": "https://www.external_url.com",
"facts_1_blurb": "facts_1_blurb",
Expand Down Expand Up @@ -2517,6 +2519,7 @@ exports[`EditCoursePage renders page correctly with courseInfo, courseOptions, a
},
"certificate_info_blurb": "blurb",
"certificate_info_heading": "heading",
"course_term_override": undefined,
"external_identifier": "2U_external_identifier",
"external_url": "https://www.external_url.com",
"facts_1_blurb": "facts_1_blurb",
Expand Down
3 changes: 3 additions & 0 deletions src/components/EditCoursePage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ class EditCoursePage extends React.Component {

formatAdditionalMetadataFields(courseData) {
const variantId = courseData.additional_metadata.variant_id || null;
const courseTerm = courseData.additional_metadata.course_term_override || null;
return {
external_url: courseData.additional_metadata.external_url,
external_identifier: courseData.additional_metadata.external_identifier,
Expand All @@ -222,6 +223,7 @@ class EditCoursePage extends React.Component {
start_date: courseData.additional_metadata.start_date,
registration_deadline: courseData.additional_metadata.registration_deadline,
variant_id: variantId,
course_term_override: courseTerm,
};
}

Expand Down Expand Up @@ -438,6 +440,7 @@ class EditCoursePage extends React.Component {
start_date: additional_metadata.start_date,
registration_deadline: additional_metadata.registration_deadline,
variant_id: additional_metadata.variant_id,
course_term_override: additional_metadata.course_term_override,
};
}
return {};
Expand Down

0 comments on commit 909411b

Please sign in to comment.