Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
8ac89c39
Commit
8ac89c39
authored
Dec 21, 2012
by
Carlos Andrés Rocha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use course metadata instead of setting attributes to display new course overlay
parent
22de7cbb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
lms/djangoapps/courseware/courses.py
+5
-4
lms/templates/course.html
+1
-1
No files found.
lms/djangoapps/courseware/courses.py
View file @
8ac89c39
...
...
@@ -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
...
...
lms/templates/course.html
View file @
8ac89c39
...
...
@@ -5,7 +5,7 @@
%
>
<
%
page
args=
"course"
/>
<article
id=
"${course.id}"
class=
"course"
>
%if course.
is_new
:
%if course.
metadata['is_new']
:
<span
class=
"status"
>
New
</span>
%endif
<a
href=
"${reverse('about_course', args=[course.id])}"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment