diff --git a/apps/info_blocks/constants.py b/apps/info_blocks/constants.py index 679c80bc2..c3e134e07 100644 --- a/apps/info_blocks/constants.py +++ b/apps/info_blocks/constants.py @@ -4,6 +4,7 @@ class CurrentInfoBlockTags: Need to be kept in sync with actual DB values, will be removed in favor of tabs in the new design. """ USEFUL = "hint" + TEACHERS_USEFUL = "teachers-hint" HONOR_CODE = "honor-code" INTERNSHIP = "internship" PROGRAMS = "programs" diff --git a/apps/learning/teaching/urls.py b/apps/learning/teaching/urls.py index 893475731..f7fef9d6c 100644 --- a/apps/learning/teaching/urls.py +++ b/apps/learning/teaching/urls.py @@ -9,7 +9,7 @@ ) from learning.teaching.views import ( CalendarFullView, CalendarPersonalView, CourseListView, CourseStudentProgressView, - GradeBookListView + GradeBookListView, TeachingUsefulListView ) from learning.teaching.views import TimetableView as TeacherTimetable from learning.teaching.views.assignments import ( @@ -53,6 +53,7 @@ path('', RedirectView.as_view(pattern_name='teaching:assignments_check_queue', permanent=False), name='base'), path('timetable/', TeacherTimetable.as_view(), name='timetable'), path('calendar/', CalendarPersonalView.as_view(), name='calendar'), + path('useful/', TeachingUsefulListView.as_view(), name='teaching_useful'), path('full-calendar/', CalendarFullView.as_view(), name='calendar_full'), path('courses/', include([ path('', CourseListView.as_view(), name='course_list'), diff --git a/apps/learning/teaching/views/__init__.py b/apps/learning/teaching/views/__init__.py index 63505a401..bd5bd363f 100644 --- a/apps/learning/teaching/views/__init__.py +++ b/apps/learning/teaching/views/__init__.py @@ -19,6 +19,8 @@ from courses.utils import MonthPeriod, extended_month_date_range, get_current_term_pair from courses.views.calendar import MonthEventsCalendarView from courses.views.mixins import CourseURLParamsMixin +from info_blocks.constants import CurrentInfoBlockTags +from info_blocks.models import InfoBlock from learning.calendar import get_all_calendar_events, get_teacher_calendar_events from learning.gradebook.views import GradeBookListBaseView from learning.models import Enrollment, StudentAssignment @@ -159,3 +161,14 @@ def get_context_data(self, **kwargs: Any) -> Dict[str, Any]: "student_assignments": student_assignments } return context + +class TeachingUsefulListView(PermissionRequiredMixin, generic.ListView): + context_object_name = "faq" + template_name = "learning/study/useful.html" + permission_required = "teaching.view_faq" + + def get_queryset(self): + return (InfoBlock.objects + .for_site(self.request.site) + .with_tag(CurrentInfoBlockTags.TEACHERS_USEFUL) + .order_by("sort")) diff --git a/apps/templates/learning/study/honor_code.html b/apps/templates/learning/study/honor_code.html index ad2a99b42..1515cc52b 100644 --- a/apps/templates/learning/study/honor_code.html +++ b/apps/templates/learning/study/honor_code.html @@ -12,7 +12,7 @@