From d20eb077220e9e38eb6873c5f521eb38338437d5 Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Mon, 16 Jul 2012 11:25:58 -0400 Subject: [PATCH 1/5] Allow UTF-8 chars in about sections. --- common/lib/xmodule/xmodule/course_module.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/lib/xmodule/xmodule/course_module.py b/common/lib/xmodule/xmodule/course_module.py index 8435cfca9e..ff0302a26f 100644 --- a/common/lib/xmodule/xmodule/course_module.py +++ b/common/lib/xmodule/xmodule/course_module.py @@ -62,7 +62,7 @@ class CourseDescriptor(SequenceDescriptor): 'requirements', 'syllabus', 'textbook', 'faq', 'more_info', 'number', 'instructors']: try: with self.system.resources_fs.open(path("about") / section_key + ".html") as htmlFile: - return htmlFile.read() + return htmlFile.read().decode('utf-8') except ResourceNotFoundError: log.exception("Missing about section {key} in course {url}".format(key=section_key, url=self.location.url())) return "! About section missing !" @@ -91,7 +91,7 @@ class CourseDescriptor(SequenceDescriptor): if section_key in ['handouts', 'guest_handouts', 'updates', 'guest_updates']: try: with self.system.resources_fs.open(path("info") / section_key + ".html") as htmlFile: - return htmlFile.read() + return htmlFile.read().decode('utf-8') except ResourceNotFoundError: log.exception("Missing info section {key} in course {url}".format(key=section_key, url=self.location.url())) return "! Info section missing !" From e8516c5a3e9e85ecdd4bde70c69e29d529de77cd Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Mon, 16 Jul 2012 14:31:13 -0400 Subject: [PATCH 2/5] Shorten course about link --- lms/urls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/urls.py b/lms/urls.py index 34fccc7070..0f4b6a4b88 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -90,7 +90,7 @@ if settings.COURSEWARE_ENABLED: # TODO (vshnayder): there is no student.views.course_info. # Where should this point instead? same as the info view? - url(r'^courses/(?P[^/]+/[^/]+/[^/]+)/about$', + url(r'^courses/(?P[^/]+/[^/]+/[^/]+)$', 'student.views.course_info', name="about_course"), ) From 27ec1b4dcffca36b5ae0a6da6a5d52ae78712e87 Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Mon, 16 Jul 2012 16:56:25 -0400 Subject: [PATCH 3/5] Change course listing to show course numbers + title --- common/lib/xmodule/xmodule/course_module.py | 6 +++++- lms/templates/course.html | 2 +- lms/templates/portal/course_about.html | 5 +++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/common/lib/xmodule/xmodule/course_module.py b/common/lib/xmodule/xmodule/course_module.py index ff0302a26f..bc51fed51e 100644 --- a/common/lib/xmodule/xmodule/course_module.py +++ b/common/lib/xmodule/xmodule/course_module.py @@ -24,7 +24,11 @@ class CourseDescriptor(SequenceDescriptor): @property def title(self): - self.metadata['display_name'] + return self.metadata['display_name'] + + @property + def course_number(self): + return self.location.course @property def instructors(self): diff --git a/lms/templates/course.html b/lms/templates/course.html index bcfcab2526..e92a2eab1c 100644 --- a/lms/templates/course.html +++ b/lms/templates/course.html @@ -9,7 +9,7 @@
-

${course.get_about_section('title')}

+

${course.course_number} ${course.get_about_section('title')}

diff --git a/lms/templates/portal/course_about.html b/lms/templates/portal/course_about.html index 9b1b616e46..de694611d2 100644 --- a/lms/templates/portal/course_about.html +++ b/lms/templates/portal/course_about.html @@ -47,6 +47,10 @@

Course staff

+ + ${course.get_about_section("instructors")} + +
From 373db8704d21b83c75d8f603fdecbf5245d658a5 Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Tue, 17 Jul 2012 08:21:10 -0400 Subject: [PATCH 4/5] Add number property to CourseDescriptor and switch templates to use it. --- common/lib/xmodule/xmodule/course_module.py | 2 +- lms/templates/course.html | 2 +- lms/templates/portal/course_about.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/lib/xmodule/xmodule/course_module.py b/common/lib/xmodule/xmodule/course_module.py index bc51fed51e..7582a8b64f 100644 --- a/common/lib/xmodule/xmodule/course_module.py +++ b/common/lib/xmodule/xmodule/course_module.py @@ -27,7 +27,7 @@ class CourseDescriptor(SequenceDescriptor): return self.metadata['display_name'] @property - def course_number(self): + def number(self): return self.location.course @property diff --git a/lms/templates/course.html b/lms/templates/course.html index e92a2eab1c..5cc0c33a7a 100644 --- a/lms/templates/course.html +++ b/lms/templates/course.html @@ -9,7 +9,7 @@
-

${course.course_number} ${course.get_about_section('title')}

+

${course.number} ${course.get_about_section('title')}

diff --git a/lms/templates/portal/course_about.html b/lms/templates/portal/course_about.html index de694611d2..9e3bef53a0 100644 --- a/lms/templates/portal/course_about.html +++ b/lms/templates/portal/course_about.html @@ -11,7 +11,7 @@
-

${course.get_about_section("title")}

${course.get_about_section("university")}

+

${course.number}: ${course.get_about_section("title")}

${course.get_about_section("university")}

From c0e8dc1b69542d035ca158d5ae74930a127faf78 Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Tue, 17 Jul 2012 08:25:17 -0400 Subject: [PATCH 5/5] Remove duplicate entries of courses. --- lms/templates/course.html | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/lms/templates/course.html b/lms/templates/course.html index 5cc0c33a7a..b79cf02ac7 100644 --- a/lms/templates/course.html +++ b/lms/templates/course.html @@ -31,31 +31,3 @@

${course.get_about_section('university')}

- -