Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: render proper visibility message on self-paced course type #1665

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/generic/configure-modal/ConfigureModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ const ConfigureModal = ({
category={category}
isSubsection={isSubsection}
showWarning={visibilityState === VisibilityTypes.STAFF_ONLY}
isSelfPaced={isSelfPaced}
/>
</Tab>
<Tab eventKey="advanced" title={intl.formatMessage(messages.advancedTabTitle)}>
Expand Down
18 changes: 16 additions & 2 deletions src/generic/configure-modal/VisibilityTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const VisibilityTab = ({
category,
showWarning,
isSubsection,
isSelfPaced,
}) => {
const intl = useIntl();
const visibilityTitle = COURSE_BLOCK_NAMES[category]?.name;
Expand Down Expand Up @@ -53,6 +54,13 @@ const VisibilityTab = ({
setFieldValue('showCorrectness', e.target.value);
};

const hideDueMessage = {
hideContentLabel: isSelfPaced ? messages.hideContentAfterEnd : messages.hideContentAfterDue,
hideContentDescription: (
isSelfPaced ? messages.hideContentAfterEndDescription : messages.hideContentAfterDueDescription
),
};

return (
<>
<h5 className="mt-4 text-gray-700">
Expand All @@ -72,9 +80,10 @@ const VisibilityTab = ({
</Form.Radio>
<Form.Text><FormattedMessage {...messages.showEntireSubsectionDescription} /></Form.Text>
<Form.Radio value="hideDue">
<FormattedMessage {...messages.hideContentAfterDue} />
<FormattedMessage {...hideDueMessage.hideContentLabel} />
</Form.Radio>
<Form.Text><FormattedMessage {...messages.hideContentAfterDueDescription} /></Form.Text>
<Form.Text><FormattedMessage {...hideDueMessage.hideContentDescription} />
</Form.Text>
<Form.Radio value="hide">
<FormattedMessage {...messages.hideEntireSubsection} />
</Form.Radio>
Expand Down Expand Up @@ -130,6 +139,11 @@ VisibilityTab.propTypes = {
category: PropTypes.string.isRequired,
showWarning: PropTypes.bool.isRequired,
isSubsection: PropTypes.bool.isRequired,
isSelfPaced: PropTypes.bool,
};

VisibilityTab.defaultProps = {
isSelfPaced: false,
};

export default injectIntl(VisibilityTab);
8 changes: 8 additions & 0 deletions src/generic/configure-modal/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,14 @@ const messages = defineMessages({
id: 'course-authoring.course-outline.configure-modal.visibility-tab.hide-content-after-due-description',
defaultMessage: 'After the subsection\'s due date has passed, learners can no longer access its content. The subsection is not included in grade calculations.',
},
hideContentAfterEnd: {
id: 'course-authoring.course-outline.configure-modal.visibility-tab.hide-content-after-end',
defaultMessage: 'Hide content after end date',
},
hideContentAfterEndDescription: {
id: 'course-authoring.course-outline.configure-modal.visibility-tab.hide-content-after-end-description',
defaultMessage: 'After the course\'s end date has passed, learners can no longer access its content. The subsection is not included in grade calculations.',
},
hideEntireSubsection: {
id: 'course-authoring.course-outline.configure-modal.visibility-tab.hide-entire-subsection',
defaultMessage: 'Hide entire subsection',
Expand Down