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
fe42f6fd
Commit
fe42f6fd
authored
Oct 04, 2012
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
address pull request feedback
parent
48d84c2e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
41 deletions
+10
-41
cms/djangoapps/contentstore/views.py
+7
-37
cms/static/js/base.js
+1
-1
cms/templates/widgets/units.html
+2
-2
cms/urls.py
+0
-1
No files found.
cms/djangoapps/contentstore/views.py
View file @
fe42f6fd
...
...
@@ -128,14 +128,10 @@ def course_index(request, org, course, name):
course
=
modulestore
()
.
get_item
(
location
)
sections
=
course
.
get_children
()
# This knowledge of what the 'new template' should be seems like it needs to be kept deeper down in the
# code. We should probably refactor
template
=
modulestore
()
.
get_item
(
Location
(
'i4x'
,
'edx'
,
'templates'
,
'vertical'
,
'Empty'
))
return
render_to_response
(
'overview.html'
,
{
'sections'
:
sections
,
'upload_asset_callback_url'
:
upload_asset_callback_url
,
'create_new_unit_template'
:
template
.
location
'create_new_unit_template'
:
Location
(
'i4x'
,
'edx'
,
'templates'
,
'vertical'
,
'Empty'
)
})
...
...
@@ -151,13 +147,9 @@ def edit_subsection(request, location):
if
item
.
location
.
category
!=
'sequential'
:
return
HttpResponseBadRequest
# This knowledge of what the 'new template' should be seems like it needs to be kept deeper down in the
# code. We should probably refactor
template
=
modulestore
()
.
get_item
(
Location
(
'i4x'
,
'edx'
,
'templates'
,
'vertical'
,
'Empty'
))
return
render_to_response
(
'edit_subsection.html'
,
{
'subsection'
:
item
,
'create_new_unit_template'
:
template
.
location
'create_new_unit_template'
:
Location
(
'i4x'
,
'edx'
,
'templates'
,
'vertical'
,
'Empty'
)
})
@login_required
...
...
@@ -210,10 +202,6 @@ def edit_unit(request, location):
containing_section_locs
=
modulestore
()
.
get_parent_locations
(
containing_subsection
.
location
)
containing_section
=
modulestore
()
.
get_item
(
containing_section_locs
[
0
])
# This knowledge of what the 'new template' should be seems like it needs to be kept deeper down in the
# code. We should probably refactor
template
=
modulestore
()
.
get_item
(
Location
(
'i4x'
,
'edx'
,
'templates'
,
'vertical'
,
'Empty'
))
return
render_to_response
(
'unit.html'
,
{
'unit'
:
item
,
'components'
:
components
,
...
...
@@ -221,7 +209,7 @@ def edit_unit(request, location):
'lms_link'
:
lms_link
,
'subsection'
:
containing_subsection
,
'section'
:
containing_section
,
'create_new_unit_template'
:
template
.
location
'create_new_unit_template'
:
Location
(
'i4x'
,
'edx'
,
'templates'
,
'vertical'
,
'Empty'
)
})
...
...
@@ -412,7 +400,7 @@ def _delete_item(item, recurse=False):
if
recurse
:
children
=
item
.
get_children
()
for
child
in
children
:
_delete_item
(
child
)
_delete_item
(
child
,
recurse
)
modulestore
()
.
delete_item
(
item
.
location
);
...
...
@@ -427,30 +415,14 @@ def delete_item(request):
raise
PermissionDenied
()
# optional parameter to delete all children (default False)
delete_children
=
False
if
'delete_children'
in
request
.
POST
:
delete_children
=
request
.
POST
[
'delete_children'
]
in
[
'true'
,
'True'
]
delete_children
=
request
.
POST
.
get
(
'delete_children'
,
False
)
item
=
modulestore
()
.
get_item
(
item_location
)
_delete_item
(
item
)
_delete_item
(
item
,
delete_children
)
return
HttpResponse
()
@login_required
@expect_json
def
create_item
(
request
):
# parent_location should be the location of the parent container
parent_location
=
request
.
POST
[
'parent_id'
]
# which type of item to create
category
=
request
.
POST
[
'category'
]
# check permissions for this user within this course
if
not
has_access
(
request
.
user
,
parent_location
):
raise
PermissionDenied
()
@login_required
@expect_json
...
...
@@ -491,9 +463,7 @@ def clone_item(request):
parent_location
=
Location
(
request
.
POST
[
'parent_location'
])
template
=
Location
(
request
.
POST
[
'template'
])
display_name
=
None
if
'display_name'
in
request
.
POST
:
display_name
=
request
.
POST
[
'display_name'
]
display_name
=
request
.
POST
.
get
(
'display_name'
)
if
not
has_access
(
request
.
user
,
parent_location
):
raise
PermissionDenied
()
...
...
cms/static/js/base.js
View file @
fe42f6fd
...
...
@@ -113,7 +113,7 @@ function deleteUnit(e) {
var
id
=
_li_el
.
data
(
'id'
);
$
.
post
(
'/delete_item'
,
{
'id'
:
id
,
'delete_children'
:
'true'
},
{
'id'
:
id
,
'delete_children'
:
true
},
function
(
data
)
{
_li_el
.
remove
();
});
...
...
cms/templates/widgets/units.html
View file @
fe42f6fd
...
...
@@ -22,14 +22,14 @@ This def will enumerate through a passed in subsection and list all of the units
% if actions:
<div
class=
"item-actions"
>
<a
href=
"#"
class=
"delete-button"
data-id=
"${unit.location}"
><span
class=
"delete-icon"
></span></a>
<a
href=
"#"
class=
"drag-handle
wip
"
></a>
<a
href=
"#"
class=
"drag-handle"
></a>
</div>
% endif
</div>
</li>
% endfor
<li>
<a
href=
"#"
class=
"new-unit-item
wip
"
data-template=
"${create_new_unit_template}"
data-parent=
"${subsection.location}"
>
<a
href=
"#"
class=
"new-unit-item"
data-template=
"${create_new_unit_template}"
data-parent=
"${subsection.location}"
>
<span
class=
"new-unit-icon"
></span>
New Unit
</a>
</li>
...
...
cms/urls.py
View file @
fe42f6fd
...
...
@@ -13,7 +13,6 @@ urlpatterns = ('',
url
(
r'^subsection/(?P<location>.*?)$'
,
'contentstore.views.edit_subsection'
,
name
=
'edit_subsection'
),
url
(
r'^preview_component/(?P<location>.*?)$'
,
'contentstore.views.preview_component'
,
name
=
'preview_component'
),
url
(
r'^save_item$'
,
'contentstore.views.save_item'
,
name
=
'save_item'
),
url
(
r'^create_item$'
,
'contentstore.views.create_item'
,
name
=
'create_item'
),
url
(
r'^delete_item$'
,
'contentstore.views.delete_item'
,
name
=
'delete_item'
),
url
(
r'^clone_item$'
,
'contentstore.views.clone_item'
,
name
=
'clone_item'
),
url
(
r'^(?P<org>[^/]+)/(?P<course>[^/]+)/course/(?P<name>[^/]+)$'
,
...
...
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