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
55d6aff4
Commit
55d6aff4
authored
Oct 03, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wire up the unit location display
parent
2412885e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
29 deletions
+51
-29
cms/djangoapps/contentstore/views.py
+16
-3
cms/static/sass/_cms_mixins.scss
+1
-2
cms/templates/unit.html
+21
-21
cms/templates/widgets/units.html
+13
-3
No files found.
cms/djangoapps/contentstore/views.py
View file @
55d6aff4
...
...
@@ -144,8 +144,9 @@ def edit_subsection(request, location):
if
item
.
location
.
category
!=
'sequential'
:
return
HttpResponseBadRequest
return
render_to_response
(
'edit_subsection.html'
,
{
'subsection'
:
item
})
return
render_to_response
(
'edit_subsection.html'
,
{
'subsection'
:
item
})
@login_required
def
edit_unit
(
request
,
location
):
...
...
@@ -166,7 +167,7 @@ def edit_unit(request, location):
lms_link
=
"{lms_base}/courses/{course_id}/jump_to/{location}"
.
format
(
lms_base
=
settings
.
LMS_BASE
,
# TODO: These will need to be changed to point to the particular instance of this problem in the particular course
course_id
=
modulestore
()
.
get_containing_courses
(
item
.
location
)[
0
]
.
id
,
course_id
=
modulestore
()
.
get_containing_courses
(
item
.
location
)[
0
]
.
id
,
location
=
item
.
location
,
)
else
:
...
...
@@ -188,10 +189,22 @@ def edit_unit(request, location):
in
item
.
get_children
()
]
# TODO (cpennington): If we share units between courses,
# this will need to change to check permissions correctly so as
# to pick the correct parent subsection
containing_subsection_locs
=
modulestore
()
.
get_parent_locations
(
location
)
containing_subsection
=
modulestore
()
.
get_item
(
containing_subsection_locs
[
0
])
containing_section_locs
=
modulestore
()
.
get_parent_locations
(
containing_subsection
.
location
)
containing_section
=
modulestore
()
.
get_item
(
containing_section_locs
[
0
])
return
render_to_response
(
'unit.html'
,
{
'unit'
:
item
,
'components'
:
components
,
'component_templates'
:
component_templates
,
'lms_link'
:
lms_link
,
'subsection'
:
containing_subsection
,
'section'
:
containing_section
,
})
...
...
cms/static/sass/_cms_mixins.scss
View file @
55d6aff4
...
...
@@ -194,4 +194,4 @@
margin-left
:
96px
;
}
}
}
\ No newline at end of file
}
cms/templates/unit.html
View file @
55d6aff4
<
%
inherit
file=
"base.html"
/>
<
%!
from
django
.
core
.
urlresolvers
import
reverse
%
>
<
%
namespace
name=
"units"
file=
"widgets/units.html"
/>
<
%
block
name=
"bodyclass"
>
unit
</
%
block>
<
%
block
name=
"title"
>
CMS Unit
</
%
block>
<
%
block
name=
"content"
>
...
...
@@ -73,37 +74,36 @@
</div>
<div
class=
"row unit-actions"
>
<a
href=
"#"
class=
"save-button"
>
Save
</a>
<a
href=
"
preview.html
"
target=
"_blank"
class=
"preview-button"
>
Preview
</a>
<a
href=
"
${lms_link}
"
target=
"_blank"
class=
"preview-button"
>
Preview
</a>
</div>
</div>
</div>
<div
class=
"window unit-location"
>
<h4>
Unit Location
</h4>
<div
class=
"window-contents"
>
<div><input
type=
"text"
class=
"url"
value=
"/courseware/Week_1/My_Unit"
disabled
/></div>
<ol>
<li>
<a
href=
"#"
class=
"section-item"
>
Week 1
</a>
<div><input
type=
"text"
class=
"url"
value=
"/courseware/${section.url_name}/${subsection.url_name}"
disabled
/></div>
<section
class=
"courseware-section branch"
>
<header>
<div
class=
"item-details"
>
<h3>
${section.display_name}
</h3>
</div>
</header>
<div
class=
"unit-list"
>
<ol>
<li>
<a
href=
"#"
class=
"section-item"
><span
class=
"folder-icon"
></span>
Administrivia and Circuit Elements
</a>
<ol>
<li><a
href=
"#"
class=
"section-item"
><span
class=
"file-icon"
></span>
Motiviation for 6.002
</a></li>
<li><a
href=
"#"
class=
"section-item"
><span
class=
"file-icon"
></span>
Administrivia
</a></li>
<li><a
href=
"#"
class=
"section-item"
><span
class=
"file-icon"
></span>
Course Overview
</a></li>
<li><a
href=
"#"
class=
"section-item"
><span
class=
"file-icon"
></span>
Lumped Element Abstraction
</a></li>
<li><a
href=
"#"
class=
"section-item"
><span
class=
"file-icon"
></span>
Simple Power
</a></li>
<li><a
href=
"#"
class=
"current section-item"
><span
class=
"file-icon"
></span>
New Unit
</a></li>
<li>
<a
href=
"unit.html"
class=
"new-unit-item"
>
<span
class=
"new-unit-icon"
></span>
New Unit
<li
class=
"branch"
>
<div
class=
"section-item"
>
<div>
<a
href=
"${reverse('edit_subsection', args=[subsection.location])}"
>
<span
class=
"folder-icon"
></span>
<span
class=
"subsection-name"
><span
class=
"subsection-name-value"
>
${subsection.display_name}
</span></span>
</a>
</li>
</ol>
</div>
</div>
${units.enum_units(subsection, actions=False, selected=unit.location)}
</li>
</ol>
</
li
>
</
ol
>
</
div
>
</
section
>
</div>
</div>
</div>
...
...
cms/templates/widgets/units.html
View file @
55d6aff4
...
...
@@ -3,18 +3,28 @@
<!--
This def will enumerate through a passed in subsection and list all of the units
-->
<
%
def
name=
"enum_units(subsection)"
>
<
%
def
name=
"enum_units(subsection
, actions=True, selected=None
)"
>
<ol>
% for unit in subsection.get_children():
<li
class=
"leaf"
>
<div
class=
"section-item"
>
<
%
if
unit
.
location =
=
selected:
selected_class =
'editing'
else:
selected_class =
''
%
>
<div
class=
"section-item ${selected_class}"
>
<a
href=
"${reverse('edit_unit', args=[unit.location])}"
class=
"private-item"
>
<span
class=
"${unit.category}-icon"
></span>
${unit.display_name}
<span
class=
"private-tag"
>
- private
</span>
<span
class=
"${unit.category}-icon"
></span>
${unit.display_name}
<span
class=
"private-tag"
>
- private
</span>
</a>
% if actions:
<div
class=
"item-actions"
>
<a
href=
"${reverse('delete_unit', args=[unit.location])}"
classs=
"edit-button wip"
><span
class=
"delete-icon"
></span></a>
<a
href=
"#"
class=
"drag-handle wip"
></a>
</div>
% endif
</div>
</li>
% endfor
...
...
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