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
67b73242
Commit
67b73242
authored
Mar 01, 2013
by
Arthur Barrett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added advanced component button with ability to specify components in course policy.
parent
32e5f72c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
9 deletions
+26
-9
cms/djangoapps/contentstore/views.py
+25
-8
cms/templates/unit.html
+1
-1
No files found.
cms/djangoapps/contentstore/views.py
View file @
67b73242
...
...
@@ -66,7 +66,12 @@ from cms.djangoapps.models.settings.course_metadata import CourseMetadata
log
=
logging
.
getLogger
(
__name__
)
COMPONENT_TYPES
=
[
'customtag'
,
'discussion'
,
'html'
,
'problem'
,
'video'
]
COMPONENT_TYPES
=
[
'customtag'
,
'discussion'
,
'html'
,
'problem'
,
'video'
,
'advanced'
]
# advanced/beta components that can be enabled for all courses or per-course in the policy file
ADVANCED_COMPONENT_TYPES
=
[]
ADVANCED_COMPONENT_CATEGORY
=
'advanced'
ADVANCED_COMPONENT_POLICY_KEY
=
'enable_advanced_modules'
# cdodge: these are categories which should not be parented, they are detached from the hierarchy
DETACHED_CATEGORIES
=
[
'about'
,
'static_tab'
,
'course_info'
]
...
...
@@ -281,15 +286,26 @@ def edit_unit(request, location):
component_templates
=
defaultdict
(
list
)
# check if there are any advanced modules specified in the course policy
advanced_component_types
=
list
(
ADVANCED_COMPONENT_TYPES
)
course_metadata
=
CourseMetadata
.
fetch
(
course
.
location
)
advanced_component_types
.
extend
(
course_metadata
.
get
(
ADVANCED_COMPONENT_POLICY_KEY
,
[]))
templates
=
modulestore
()
.
get_items
(
Location
(
'i4x'
,
'edx'
,
'templates'
))
for
template
in
templates
:
if
template
.
location
.
category
in
COMPONENT_TYPES
:
component_templates
[
template
.
location
.
category
]
.
append
((
template
.
display_name
,
template
.
location
.
url
(),
'markdown'
in
template
.
metadata
,
'empty'
in
template
.
metadata
))
component_template
=
(
template
.
display_name
,
template
.
location
.
url
(),
'markdown'
in
template
.
metadata
,
'empty'
in
template
.
metadata
)
if
template
.
location
.
category
in
COMPONENT_TYPES
:
component_templates
[
template
.
location
.
category
]
.
append
(
component_template
)
elif
template
.
location
.
category
in
advanced_component_types
:
component_templates
[
ADVANCED_COMPONENT_CATEGORY
]
.
append
(
component_template
)
# order of component types for display purposes
component_template_types
=
[
type
for
type
in
COMPONENT_TYPES
if
type
in
component_templates
.
keys
()]
components
=
[
component
.
location
.
url
()
...
...
@@ -341,6 +357,7 @@ def edit_unit(request, location):
'unit_location'
:
location
,
'components'
:
components
,
'component_templates'
:
component_templates
,
'component_template_types'
:
component_template_types
,
'draft_preview_link'
:
preview_lms_link
,
'published_preview_link'
:
lms_link
,
'subsection'
:
containing_subsection
,
...
...
cms/templates/unit.html
View file @
67b73242
...
...
@@ -53,7 +53,7 @@
<div
class=
"new-component"
>
<h5>
Add New Component
</h5>
<ul
class=
"new-component-type"
>
% for type in
sorted(component_templates.keys())
:
% for type in
component_template_types
:
<li>
<a
href=
"#"
data-type=
"${type}"
>
<span
class=
"large-template-icon large-${type}-icon"
></span>
...
...
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