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
10361a4a
Commit
10361a4a
authored
Sep 20, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP to update the navigation bar when adding a new module
parent
c5e225c4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
9 deletions
+27
-9
cms/djangoapps/contentstore/views.py
+19
-3
cms/static/coffee/src/views/course.coffee
+1
-0
cms/static/coffee/src/views/week.coffee
+1
-0
cms/templates/course_index.html
+3
-5
cms/urls.py
+3
-1
No files found.
cms/djangoapps/contentstore/views.py
View file @
10361a4a
...
...
@@ -18,6 +18,7 @@ from mitxmako.shortcuts import render_to_response, render_to_string
from
xmodule.modulestore.django
import
modulestore
from
xmodule_modifiers
import
replace_static_urls
,
wrap_xmodule
from
xmodule.exceptions
import
NotFoundError
from
xmodule.course_module
import
CourseDescriptor
from
functools
import
partial
from
itertools
import
groupby
from
operator
import
attrgetter
...
...
@@ -74,20 +75,35 @@ def has_access(user, location):
@login_required
@ensure_csrf_cookie
def
course_index
(
request
,
org
,
course
,
name
):
def
course_index
(
request
,
course_id
):
"""
Display an editable course overview.
org, course, name: Attributes of the Location for the item to edit
"""
location
=
[
'i4x'
,
org
,
course
,
'course'
,
name
]
location
=
CourseDescriptor
.
id_to_location
(
course_id
)
if
not
has_access
(
request
.
user
,
location
):
raise
Http404
# TODO (vshnayder): better error
return
render_to_response
(
'course_index.html'
,
{
'course_id'
:
course_id
})
@login_required
def
navigation
(
request
,
course_id
):
"""
Render the course navigation
org, course, name: Attributes of the Location for the course to edit
"""
location
=
CourseDescriptor
.
id_to_location
(
course_id
)
if
not
has_access
(
request
.
user
,
location
):
raise
Http404
# TODO (vshnayder): better error
# TODO (cpennington): These need to be read in from the active user
course
=
modulestore
()
.
get_item
(
location
)
weeks
=
course
.
get_children
()
return
render_to_response
(
'course_index.html'
,
{
'weeks'
:
weeks
})
return
render_to_response
(
'widgets/navigation.html'
,
{
'weeks'
:
weeks
})
@login_required
...
...
cms/static/coffee/src/views/course.coffee
View file @
10361a4a
...
...
@@ -4,6 +4,7 @@ class CMS.Views.Course extends Backbone.View
CMS
.
on
(
'content.hide'
,
@
hideContent
)
render
:
->
@
$el
.
find
(
'.navigation'
).
load
(
"/
#{
@
$el
.
data
(
'course-id'
)
}
/navigation"
)
@
$
(
'#weeks > li'
).
each
(
index
,
week
)
=>
new
CMS
.
Views
.
Week
(
el
:
week
,
height
:
@
maxWeekHeight
()).
render
()
return
@
...
...
cms/static/coffee/src/views/week.coffee
View file @
10361a4a
...
...
@@ -8,6 +8,7 @@ class CMS.Views.Week extends Backbone.View
CMS
.
on
(
'content.hide'
,
@
setHeight
)
render
:
->
@
$el
.
load
'navigation'
@
setHeight
()
@
$
(
'.editable'
).
inlineEdit
()
@
$
(
'.editable-textarea'
).
inlineEdit
(
control
:
'textarea'
)
...
...
cms/templates/course_index.html
View file @
10361a4a
...
...
@@ -3,12 +3,10 @@
<
%
include
file=
"widgets/header.html"
/>
<
%
block
name=
"content"
>
<section
class=
"main-container"
>
<section
class=
"main-container"
data-course-id=
"${course_id}"
>
<
%
include
file=
"widgets/navigation.html"
/>
<section
class=
"main-content"
>
</section>
<section
class=
"navigation"
></section>
<section
class=
"main-content"
></section>
</section>
</
%
block>
cms/urls.py
View file @
10361a4a
...
...
@@ -13,7 +13,9 @@ urlpatterns = ('',
url
(
r'^edit_item$'
,
'contentstore.views.edit_item'
,
name
=
'edit_item'
),
url
(
r'^save_item$'
,
'contentstore.views.save_item'
,
name
=
'save_item'
),
url
(
r'^clone_item$'
,
'contentstore.views.clone_item'
,
name
=
'clone_item'
),
url
(
r'^(?P<org>[^/]+)/(?P<course>[^/]+)/course/(?P<name>[^/]+)$'
,
url
(
r'^(?P<course_id>[^/]+/[^/]+/[^/]+)/navigation$'
,
'contentstore.views.navigation'
,
name
=
'navigation'
),
url
(
r'^(?P<course_id>[^/]+/[^/]+/[^/]+)$'
,
'contentstore.views.course_index'
,
name
=
'course_index'
),
url
(
r'^github_service_hook$'
,
'github_sync.views.github_post_receive'
),
url
(
r'^preview/modx/(?P<preview_id>[^/]*)/(?P<location>.*?)/(?P<dispatch>[^/]*)$'
,
...
...
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