Skip to content
Closed
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
8 changes: 8 additions & 0 deletions cms/djangoapps/contentstore/views/course.py
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,13 @@ def settings_handler(request, course_key_string): # lint-amnesty, pylint: disab
verified_mode = CourseMode.verified_mode_for_course(course_key, include_expired=True)
upgrade_deadline = (verified_mode and verified_mode.expiration_datetime and
verified_mode.expiration_datetime.isoformat())

date_placeholder_format = configuration_helpers.get_value_for_org(
course_module.location.org,
'SCHEDULE_DETAIL_FORMAT',
settings.SCHEDULE_DETAIL_FORMAT
).upper()
Comment on lines +1160 to +1164

@mariajgrimaldi mariajgrimaldi Jun 23, 2022

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I asked around what we should do about using site configurations since it's set to be deprecated. The initial response is not to add more technical debt given this will need to be removed once site config it's no longer used.

But I see you used the default to Django settings, so using site configurations is not obligatory. Great!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: there's a new note in the OEP-51 specifying what to consider before using a soon-to-be a deprecated feature:https://open-edx-proposals.readthedocs.io/en/latest/processes/oep-0021-proc-deprecation.html#accepted


settings_context = {
'context_course': course_module,
'course_locator': course_key,
Expand All @@ -1180,6 +1187,7 @@ def settings_handler(request, course_key_string): # lint-amnesty, pylint: disab
'enable_extended_course_details': enable_extended_course_details,
'upgrade_deadline': upgrade_deadline,
'mfe_proctored_exam_settings_url': get_proctored_exam_settings_url(course_module.id),
'date_placeholder_format': date_placeholder_format,
}
if is_prerequisite_courses_enabled():
courses, in_process_course_actions = get_courses_accessible_to_user(request)
Expand Down
6 changes: 6 additions & 0 deletions cms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@
# templates.
STUDIO_NAME = _("Your Platform Studio")
STUDIO_SHORT_NAME = _("Studio")

# .. setting_name: SCHEDULE_DETAIL_FORMAT
# .. setting_default: MM/DD/YYYY'
# .. setting_description: Settings to configure the date format in Schedule & Details page
SCHEDULE_DETAIL_FORMAT = 'MM/DD/YYYY'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we specify that this is configured globally?

FEATURES = {
'GITHUB_PUSH': False,

Expand Down Expand Up @@ -516,6 +521,7 @@
# in the LMS and CMS.
# .. toggle_tickets: 'https://github.com/open-craft/edx-platform/pull/429'
'DISABLE_UNENROLLMENT': False,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this change is not needed?

}

# .. toggle_name: ENABLE_COPPA_COMPLIANCE
Expand Down
7 changes: 6 additions & 1 deletion cms/static/js/utils/date_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ function($, date, TriggerChangeEventOnEnter) {

// instrument as date and time pickers
timefield.timepicker({timeFormat: 'H:i'});
datefield.datepicker();
var placeholder = datefield.attr('placeholder');
if (placeholder == 'DD/MM/YYYY') {
datefield.datepicker({dateFormat: 'dd/mm/yy'});
Comment on lines +101 to +102

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this specific case?

} else {
datefield.datepicker();
}

// Using the change event causes setfield to be triggered twice, but it is necessary
// to pick up when the date is typed directly in the field.
Expand Down
13 changes: 7 additions & 6 deletions cms/templates/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ <h2 class="title-2">${_('Course Schedule')}</h2>
<li class="field-group field-group-course-start" id="course-start">
<div class="field date" id="field-course-start-date">
<label for="course-start-date">${_("Course Start Date")}</label>
<input type="text" class="start-date date start datepicker" id="course-start-date" placeholder="MM/DD/YYYY" autocomplete="off" />
<input type="text" class="start-date date start datepicker" id="course-start-date" placeholder="${date_placeholder_format}" autocomplete="off" />
<span class="icon icon-inline fa fa-calendar-check-o datepicker-icon" aria-hidden="true"></span>
<span class="tip tip-stacked">${_("First day the course begins")}</span>
</div>
Expand All @@ -238,7 +238,7 @@ <h2 class="title-2">${_('Course Schedule')}</h2>
<li class="field-group field-group-course-end" id="course-end">
<div class="field date" id="field-course-end-date">
<label for="course-end-date">${_("Course End Date")}</label>
<input type="text" class="end-date date end" id="course-end-date" placeholder="MM/DD/YYYY" autocomplete="off" />
<input type="text" class="end-date date end" id="course-end-date" placeholder="${date_placeholder_format}" autocomplete="off" />
<span class="icon icon-inline fa fa-calendar-check-o datepicker-icon" aria-hidden="true"></span>
<span class="tip tip-stacked">${_("Last day your course is active")}</span>
</div>
Expand Down Expand Up @@ -304,8 +304,9 @@ <h2 class="title-2">${_('Course Schedule')}</h2>
<div class="field date" id="field-certificate-available-date" >
% endif
<label for="certificate-available-date">${_("Certificates Available Date")}</label>
<input type="text" class="certificate-available-date date start datepicker" id="certificate-available-date" placeholder="MM/DD/YYYY" autocomplete="off" />
<input type="text" class="certificate-available-date date start datepicker" id="certificate-available-date" placeholder="${date_placeholder_format}" autocomplete="off" />
<span class="icon icon-inline fa fa-calendar-check-o datepicker-icon" aria-hidden="true"></span>
<span class="tip tip-stacked">${_("By default, 48 hours after course end date")}</span>
</div>
</li>
</ol>
Expand All @@ -315,7 +316,7 @@ <h2 class="title-2">${_('Course Schedule')}</h2>
<li class="field-group field-group-enrollment-start" id="enrollment-start">
<div class="field date" id="field-enrollment-start-date">
<label for="course-enrollment-start-date">${_("Enrollment Start Date")}</label>
<input type="text" class="start-date date start" id="course-enrollment-start-date" placeholder="MM/DD/YYYY" autocomplete="off" />
<input type="text" class="start-date date start" id="course-enrollment-start-date" placeholder="${date_placeholder_format}" autocomplete="off" />
<span class="icon icon-inline fa fa-calendar-check-o datepicker-icon" aria-hidden="true"></span>
<span class="tip tip-stacked">${_("First day students can enroll")}</span>
</div>
Expand All @@ -333,7 +334,7 @@ <h2 class="title-2">${_('Course Schedule')}</h2>
<li class="field-group field-group-enrollment-end" id="enrollment-end">
<div class="field date ${enrollment_end_editable_class}" id="field-enrollment-end-date">
<label for="course-enrollment-end-date">${_("Enrollment End Date")}</label>
<input type="text" class="end-date date end" id="course-enrollment-end-date" placeholder="MM/DD/YYYY" autocomplete="off" ${enrollment_end_readonly} />
<input type="text" class="end-date date end" id="course-enrollment-end-date" placeholder="${date_placeholder_format}" autocomplete="off" ${enrollment_end_readonly} />
<span class="icon icon-inline fa fa-calendar-check-o datepicker-icon" aria-hidden="true"></span>
<span class="tip tip-stacked">
${_("Last day students can enroll.")}
Expand All @@ -356,7 +357,7 @@ <h2 class="title-2">${_('Course Schedule')}</h2>
<li class="field-group field-group-upgrade-deadline" id="upgrade-deadline">
<div class="field date is-not-editable" id="field-upgrade-deadline-date">
<label for="course-upgrade-deadline-date">${_("Upgrade Deadline Date")}</label>
<input type="text" class="date upgrade-deadline" id="course-upgrade-deadline-date" placeholder="MM/DD/YYYY" autocomplete="off" readonly aria-readonly="true" />
<input type="text" class="date upgrade-deadline" id="course-upgrade-deadline-date" placeholder="${date_placeholder_format}" autocomplete="off" readonly aria-readonly="true" />
<span class="tip tip-stacked">
${_("Last day students can upgrade to a verified enrollment.")}
${_("Contact your {platform_name} partner manager to update these settings.").format(platform_name=settings.PLATFORM_NAME)}
Expand Down