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
0829acb8
Commit
0829acb8
authored
Aug 20, 2014
by
Daniel Friedman
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4872 from edx/dan-f/course-outline-start-date
View course start date from course outline
parents
3ddf8263
71e51951
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
101 additions
and
0 deletions
+101
-0
cms/djangoapps/contentstore/views/course.py
+6
-0
cms/djangoapps/contentstore/views/tests/test_course_index.py
+35
-0
cms/static/sass/views/_outline.scss
+43
-0
cms/templates/course_outline.html
+17
-0
No files found.
cms/djangoapps/contentstore/views/course.py
View file @
0829acb8
...
...
@@ -16,8 +16,10 @@ from django.core.exceptions import PermissionDenied
from
django.core.urlresolvers
import
reverse
from
django.http
import
HttpResponseBadRequest
,
HttpResponseNotFound
,
HttpResponse
from
util.json_request
import
JsonResponse
from
util.date_utils
import
get_default_time_display
from
edxmako.shortcuts
import
render_to_response
from
xmodule.course_module
import
DEFAULT_START_DATE
from
xmodule.error_module
import
ErrorDescriptor
from
xmodule.modulestore.django
import
modulestore
from
xmodule.contentstore.content
import
StaticContent
...
...
@@ -376,6 +378,8 @@ def course_index(request, course_key):
sections
=
course_module
.
get_children
()
course_structure
=
_course_outline_json
(
request
,
course_module
)
locator_to_show
=
request
.
REQUEST
.
get
(
'show'
,
None
)
course_release_date
=
get_default_time_display
(
course_module
.
start
)
if
course_module
.
start
!=
DEFAULT_START_DATE
else
_
(
"Unscheduled"
)
settings_url
=
reverse_course_url
(
'settings_handler'
,
course_key
)
try
:
current_action
=
CourseRerunState
.
objects
.
find_first
(
course_key
=
course_key
,
should_display
=
True
)
...
...
@@ -392,6 +396,8 @@ def course_index(request, course_key):
CourseGradingModel
.
fetch
(
course_key
)
.
graders
),
'rerun_notification_id'
:
current_action
.
id
if
current_action
else
None
,
'course_release_date'
:
course_release_date
,
'settings_url'
:
settings_url
,
})
...
...
cms/djangoapps/contentstore/views/tests/test_course_index.py
View file @
0829acb8
...
...
@@ -3,6 +3,7 @@ Unit tests for getting the list of courses and the course outline.
"""
import
json
import
lxml
import
datetime
from
contentstore.tests.utils
import
CourseTestCase
from
contentstore.utils
import
reverse_course_url
,
add_instructor
...
...
@@ -10,6 +11,8 @@ from contentstore.views.access import has_course_access
from
contentstore.views.course
import
course_outline_initial_state
from
contentstore.views.item
import
create_xblock_info
,
VisibilityState
from
course_action_state.models
import
CourseRerunState
from
util.date_utils
import
get_default_time_display
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
opaque_keys.edx.locator
import
CourseLocator
...
...
@@ -273,3 +276,35 @@ class TestCourseOutline(CourseTestCase):
expanded_locators
=
initial_state
[
'expanded_locators'
]
self
.
assertIn
(
unicode
(
self
.
sequential
.
location
),
expanded_locators
)
self
.
assertIn
(
unicode
(
self
.
vertical
.
location
),
expanded_locators
)
def
test_start_date_on_page
(
self
):
"""
Verify that the course start date is included on the course outline page.
"""
def
_get_release_date
(
response
):
"""Return the release date from the course page"""
parsed_html
=
lxml
.
html
.
fromstring
(
response
.
content
)
return
parsed_html
.
find_class
(
'course-status'
)[
0
]
.
find_class
(
'status-release-value'
)[
0
]
.
text_content
()
def
_assert_settings_link_present
(
response
):
"""
Asserts there's a course settings link on the course page by the course release date.
"""
parsed_html
=
lxml
.
html
.
fromstring
(
response
.
content
)
settings_link
=
parsed_html
.
find_class
(
'course-status'
)[
0
]
.
find_class
(
'action-edit'
)[
0
]
.
find
(
'a'
)
self
.
assertIsNotNone
(
settings_link
)
self
.
assertEqual
(
settings_link
.
get
(
'href'
),
reverse_course_url
(
'settings_handler'
,
self
.
course
.
id
))
outline_url
=
reverse_course_url
(
'course_handler'
,
self
.
course
.
id
)
response
=
self
.
client
.
get
(
outline_url
,
{},
HTTP_ACCEPT
=
'text/html'
)
# A course with the default release date should display as "Unscheduled"
self
.
assertEqual
(
_get_release_date
(
response
),
'Unscheduled'
)
_assert_settings_link_present
(
response
)
self
.
course
.
start
=
datetime
.
datetime
(
2014
,
1
,
1
)
modulestore
()
.
update_item
(
self
.
course
,
ModuleStoreEnum
.
UserID
.
test
)
response
=
self
.
client
.
get
(
outline_url
,
{},
HTTP_ACCEPT
=
'text/html'
)
self
.
assertEqual
(
_get_release_date
(
response
),
get_default_time_display
(
self
.
course
.
start
))
_assert_settings_link_present
(
response
)
cms/static/sass/views/_outline.scss
View file @
0829acb8
...
...
@@ -171,6 +171,49 @@
@extend
%expand-collapse
;
}
// course status
// --------------------
.course-status
{
margin-bottom
:
$baseline
;
.status-release
{
@extend
%t-copy-base
;
display
:
inline-block
;
color
:
$color-copy-base
;
}
.status-release-label
,
.status-release-value
,
.status-actions
{
display
:
inline-block
;
vertical-align
:
middle
;
margin-bottom
:
0
;
}
.status-release-label
{
margin-right
:
(
$baseline
/
4
);
}
.status-release-value
{
@extend
%t-strong
;
}
.status-actions
{
@extend
%actions-list
;
@include
transition
(
opacity
$tmg-f1
ease-in-out
0
);
margin-left
:
(
$baseline
/
4
);
opacity
:
0
.0
;
}
// STATE: hover
&
:hover
{
.status-actions
{
opacity
:
1
.0
;
}
}
}
// outline
// --------------------
.outline
{
...
...
cms/templates/course_outline.html
View file @
0829acb8
...
...
@@ -70,10 +70,27 @@ from contentstore.utils import reverse_usage_url
<div
class=
"wrapper-content wrapper"
>
<section
class=
"content"
>
<article
class=
"content-primary"
role=
"main"
>
<div
class=
"course-status"
>
<div
class=
"status-release"
>
<h2
class=
"status-release-label"
>
${_("Course Start Date:")}
</h2>
<p
class=
"status-release-value"
>
${course_release_date}
</p>
<ul
class=
"status-actions"
>
<li
class=
"action-item action-edit"
>
<a
href=
"${settings_url}"
class=
"edit-button action-button"
data-tooltip=
"${_("
Edit
Start
Date
")}"
>
<i
class=
"icon-pencil"
></i>
<span
class=
"action-button-text sr"
>
${_("Edit Start Date")}
</span>
</a>
</li>
</ul>
</div>
</div>
<div
class=
"wrapper-dnd"
>
<
%
course_locator =
context_course.location
%
>
<h2
class=
"sr"
>
${_("Course Outline")}
</h2>
<article
class=
"outline outline-course"
data-locator=
"${course_locator}"
data-course-key=
"${course_locator.course_key}"
>
</article>
</div>
...
...
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