From 4d137446227b0b8f68592c65d1a4b4568f479795 Mon Sep 17 00:00:00 2001 From: Brian Talbot Date: Wed, 19 Dec 2012 16:21:37 -0500 Subject: [PATCH 1/4] added new visual status to course listings on edx.org --- lms/static/sass/shared/_course_object.scss | 25 ++++++++++++++++++++++ lms/templates/course.html | 1 + 2 files changed, 26 insertions(+) diff --git a/lms/static/sass/shared/_course_object.scss b/lms/static/sass/shared/_course_object.scss index 374caf4898..2f6ca88a63 100644 --- a/lms/static/sass/shared/_course_object.scss +++ b/lms/static/sass/shared/_course_object.scss @@ -24,6 +24,31 @@ width: 100%; @include transition(all, 0.15s, linear); + .status { + background: $blue; + color: white; + font-size: 10px; + left: 10px; + padding: 2px 10px; + @include border-radius(2px); + position: absolute; + text-transform: uppercase; + top: -6px; + z-index: 100; + } + + .status:after { + border-bottom: 6px solid shade($blue, 50%); + border-right: 6px solid transparent; + content: ""; + display: block; + height: 0; + position: absolute; + right: -6px; + top: 0; + width: 0; + } + a:hover { text-decoration: none; } diff --git a/lms/templates/course.html b/lms/templates/course.html index 50a00f9d31..7392dfcefa 100644 --- a/lms/templates/course.html +++ b/lms/templates/course.html @@ -5,6 +5,7 @@ %> <%page args="course" />
+ New
From 37e0d98fec68f13eb83201df9c217ed364274948 Mon Sep 17 00:00:00 2001 From: Brian Talbot Date: Thu, 20 Dec 2012 09:32:15 -0500 Subject: [PATCH 2/4] course listings - new html and css for ordering - wip --- lms/static/sass/shared/_course_object.scss | 17 + .../static_templates/_courses-newlisting.html | 301 ++++++++++++++++++ 2 files changed, 318 insertions(+) create mode 100644 lms/templates/static_templates/_courses-newlisting.html diff --git a/lms/static/sass/shared/_course_object.scss b/lms/static/sass/shared/_course_object.scss index 374caf4898..3adcc11534 100644 --- a/lms/static/sass/shared/_course_object.scss +++ b/lms/static/sass/shared/_course_object.scss @@ -13,6 +13,23 @@ } } + .courses-listing { + @include clearfix(); + margin: 0; + padding: 0; + list-style: none; + + .courses-listing-item { + width: flex-grid(4); + margin-right: flex-gutter(); + float: left; + + &:nth-child(3n+3) { + margin-right: 0; + } + } + } + .course { background: rgb(250,250,250); border: 1px solid rgb(180,180,180); diff --git a/lms/templates/static_templates/_courses-newlisting.html b/lms/templates/static_templates/_courses-newlisting.html new file mode 100644 index 0000000000..4d67304fd6 --- /dev/null +++ b/lms/templates/static_templates/_courses-newlisting.html @@ -0,0 +1,301 @@ + \ No newline at end of file From f92266d6595b3a67adae799672aeddbd915f5a7d Mon Sep 17 00:00:00 2001 From: Brian Talbot Date: Thu, 20 Dec 2012 09:55:52 -0500 Subject: [PATCH 3/4] course listings - new html and css for ordering - finished sass changes and static markup example --- .../static_templates/_courses-newlisting.html | 582 +++++++++--------- 1 file changed, 291 insertions(+), 291 deletions(-) diff --git a/lms/templates/static_templates/_courses-newlisting.html b/lms/templates/static_templates/_courses-newlisting.html index 4d67304fd6..97985977c1 100644 --- a/lms/templates/static_templates/_courses-newlisting.html +++ b/lms/templates/static_templates/_courses-newlisting.html @@ -1,301 +1,301 @@ \ No newline at end of file +
  • + +
  • + \ No newline at end of file From 8ac89c39a785390fedb21a17efa3b4eb0afb5c46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s=20Rocha?= Date: Fri, 21 Dec 2012 11:12:21 -0500 Subject: [PATCH 4/4] Use course metadata instead of setting attributes to display new course overlay --- lms/djangoapps/courseware/courses.py | 9 +++++---- lms/templates/course.html | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lms/djangoapps/courseware/courses.py b/lms/djangoapps/courseware/courses.py index 0f039b6cf5..422974cdcf 100644 --- a/lms/djangoapps/courseware/courses.py +++ b/lms/djangoapps/courseware/courses.py @@ -251,11 +251,12 @@ def _sort_courses_and_mark_new(courses): for course in courses: days_to_start = _get_course_days_to_start(course) - # Add values as attributes, so they can be used in templates - setattr(course, '_days_to_start', days_to_start) - setattr(course, 'is_new', days_to_start > 1) + metadata = course.metadata + metadata['days_to_start'] = days_to_start + metadata['is_new'] = course.metadata.get('is_new', days_to_start > 1) - courses = sorted(courses, key=lambda d: d._days_to_start, reverse=True) + key = lambda c: c.metadata['days_to_start'] + courses = sorted(courses, key=key, reverse=True) return courses diff --git a/lms/templates/course.html b/lms/templates/course.html index a2eff572e1..dcf6ab895e 100644 --- a/lms/templates/course.html +++ b/lms/templates/course.html @@ -5,7 +5,7 @@ %> <%page args="course" />
    - %if course.is_new: + %if course.metadata['is_new']: New %endif