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
7e4d3c8b
Commit
7e4d3c8b
authored
Jul 19, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modularize sequence coffeescript in prepration for CMS preview
parent
a8c70d35
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
76 deletions
+84
-76
common/lib/xmodule/xmodule/js/src/sequence/display.coffee
+14
-27
common/lib/xmodule/xmodule/seq_module.py
+1
-5
lms/static/sass/.gitignore
+1
-0
lms/static/sass/course/old/courseware/_sequence-nav.scss
+52
-42
lms/templates/seq_module.html
+16
-2
No files found.
common/lib/xmodule/xmodule/js/src/sequence/display.coffee
View file @
7e4d3c8b
class
@
Sequence
constructor
:
(
@
id
,
@
element_id
,
@
elements
,
@
tag
,
position
)
->
@
el
=
$
(
"#
#{
@
element_id
}
"
)
@
buildNavigation
()
constructor
:
(
element
)
->
(
@
id
,
@
element_id
,
@
elements
,
position
)
->
@
el
=
$
(
element
)
@
contents
=
@
$
(
'.seq_contents'
)
@
id
=
@
el
.
data
(
'id'
)
@
initProgress
()
@
bind
()
@
render
p
osition
@
render
p
arseInt
(
@
el
.
data
(
'position'
))
$
:
(
selector
)
->
$
(
selector
,
@
el
)
...
...
@@ -58,19 +60,6 @@ class @Sequence
when
'in_progress'
then
element
.
addClass
(
'progress-some'
)
when
'done'
then
element
.
addClass
(
'progress-done'
)
buildNavigation
:
->
$
.
each
@
elements
,
(
index
,
item
)
=>
link
=
$
(
'<a>'
).
attr
class
:
"seq_
#{
item
.
type
}
_inactive"
,
'data-element'
:
index
+
1
title
=
$
(
'<p>'
).
html
(
item
.
title
)
# TODO (vshnayder): add item.progress_detail either to the title or somewhere else.
# Make sure it gets updated after ajax calls.
# implementation note: will need to figure out how to handle combining detail
# statuses of multiple modules in js.
list_item
=
$
(
'<li>'
).
append
(
link
.
append
(
title
))
@
setProgress
item
.
progress_status
,
link
@
$
(
'#sequence-list'
).
append
list_item
toggleArrows
:
=>
@
$
(
'.sequence-nav-buttons a'
).
unbind
(
'click'
)
...
...
@@ -79,7 +68,7 @@ class @Sequence
else
@
$
(
'.sequence-nav-buttons .prev a'
).
removeClass
(
'disabled'
).
click
(
@
previous
)
if
@
position
==
@
elem
ents
.
length
if
@
position
==
@
cont
ents
.
length
@
$
(
'.sequence-nav-buttons .next a'
).
addClass
(
'disabled'
)
else
@
$
(
'.sequence-nav-buttons .next a'
).
removeClass
(
'disabled'
).
click
(
@
next
)
...
...
@@ -91,7 +80,7 @@ class @Sequence
$
.
postWithPrefix
"/modx/
#{
@
id
}
/goto_position"
,
position
:
new_position
@
mark_active
new_position
@
$
(
'#seq_content'
).
html
@
elements
[
new_position
-
1
].
content
@
$
(
'#seq_content'
).
html
@
contents
.
eq
(
new_position
-
1
).
text
()
MathJax
.
Hub
.
Queue
([
"Typeset"
,
MathJax
.
Hub
])
@
position
=
new_position
...
...
@@ -122,16 +111,14 @@ class @Sequence
mark_visited
:
(
position
)
->
# Don't overwrite class attribute to avoid changing Progress class
type
=
@
elements
[
position
-
1
].
type
element
=
@
link_for
(
position
)
element
.
removeClass
(
"
seq_
#{
type
}
_
inactive"
)
.
removeClass
(
"
seq_
#{
type
}
_
active"
)
.
addClass
(
"
seq_
#{
type
}
_
visited"
)
element
.
removeClass
(
"inactive"
)
.
removeClass
(
"active"
)
.
addClass
(
"visited"
)
mark_active
:
(
position
)
->
# Don't overwrite class attribute to avoid changing Progress class
type
=
@
elements
[
position
-
1
].
type
element
=
@
link_for
(
position
)
element
.
removeClass
(
"
seq_
#{
type
}
_
inactive"
)
.
removeClass
(
"
seq_
#{
type
}
_
visited"
)
.
addClass
(
"
seq_
#{
type
}
_
active"
)
element
.
removeClass
(
"inactive"
)
.
removeClass
(
"visited"
)
.
addClass
(
"active"
)
common/lib/xmodule/xmodule/seq_module.py
View file @
7e4d3c8b
...
...
@@ -81,11 +81,7 @@ class SequenceModule(XModule):
'type'
:
child
.
get_icon_class
(),
})
# Split </script> tags -- browsers handle this as end
# of script, even if it occurs mid-string. Do this after json.dumps()ing
# so that we can be sure of the quotations being used
import
re
params
=
{
'items'
:
re
.
sub
(
r'(?i)</(script)'
,
r'\u003c/\1'
,
json
.
dumps
(
contents
)),
# ?i = re.IGNORECASE for py2.6 compatability
params
=
{
'items'
:
contents
,
'element_id'
:
self
.
location
.
html_id
(),
'item_id'
:
self
.
id
,
'position'
:
self
.
position
,
...
...
lms/static/sass/.gitignore
0 → 100644
View file @
7e4d3c8b
*.css
lms/static/sass/course/old/courseware/_sequence-nav.scss
View file @
7e4d3c8b
...
...
@@ -87,60 +87,66 @@ nav.sequence-nav {
}
//video
&
.seq_video_inactive
{
@extend
.inactive
;
background-image
:
url('../images/sequence-nav/video-icon-normal.png')
;
background-position
:
center
;
}
&
.seq_video
{
&
.inactive
{
@extend
.inactive
;
background-image
:
url('../images/sequence-nav/video-icon-normal.png')
;
background-position
:
center
;
}
&
.seq_video_
visited
{
@extend
.visited
;
background-image
:
url('../images/sequence-nav/video-icon-visited.png')
;
background-position
:
center
;
}
&
.
visited
{
@extend
.visited
;
background-image
:
url('../images/sequence-nav/video-icon-visited.png')
;
background-position
:
center
;
}
&
.seq_video_active
{
@extend
.active
;
background-image
:
url('../images/sequence-nav/video-icon-current.png')
;
background-position
:
center
;
&
.active
{
@extend
.active
;
background-image
:
url('../images/sequence-nav/video-icon-current.png')
;
background-position
:
center
;
}
}
//other
&
.seq_other_inactive
{
@extend
.inactive
;
background-image
:
url('../images/sequence-nav/document-icon-normal.png')
;
background-position
:
center
;
}
&
.seq_other
{
&
.inactive
{
@extend
.inactive
;
background-image
:
url('../images/sequence-nav/document-icon-normal.png')
;
background-position
:
center
;
}
&
.seq_other_
visited
{
@extend
.visited
;
background-image
:
url('../images/sequence-nav/document-icon-visited.png')
;
background-position
:
center
;
}
&
.
visited
{
@extend
.visited
;
background-image
:
url('../images/sequence-nav/document-icon-visited.png')
;
background-position
:
center
;
}
&
.seq_other_active
{
@extend
.active
;
background-image
:
url('../images/sequence-nav/document-icon-current.png')
;
background-position
:
center
;
&
.active
{
@extend
.active
;
background-image
:
url('../images/sequence-nav/document-icon-current.png')
;
background-position
:
center
;
}
}
//vertical & problems
&
.seq_vertical_inactive
,
&
.seq_problem_inactive
{
@extend
.inactive
;
background-image
:
url('../images/sequence-nav/list-icon-normal.png')
;
background-position
:
center
;
}
&
.seq_vertical
,
&
.seq_problem
{
&
.inactive
{
@extend
.inactive
;
background-image
:
url('../images/sequence-nav/list-icon-normal.png')
;
background-position
:
center
;
}
&
.seq_vertical_visited
,
&
.seq_problem_
visited
{
@extend
.visited
;
background-image
:
url('../images/sequence-nav/list-icon-visited.png')
;
background-position
:
center
;
}
&
.
visited
{
@extend
.visited
;
background-image
:
url('../images/sequence-nav/list-icon-visited.png')
;
background-position
:
center
;
}
&
.seq_vertical_active
,
&
.seq_problem_active
{
@extend
.active
;
background-image
:
url('../images/sequence-nav/list-icon-current.png')
;
background-position
:
center
;
&
.active
{
@extend
.active
;
background-image
:
url('../images/sequence-nav/list-icon-current.png')
;
background-position
:
center
;
}
}
p
{
...
...
@@ -265,6 +271,10 @@ section.course-content {
}
}
div
.seq_contents
{
display
:
none
;
}
nav
.sequence-bottom
{
margin
:
lh
(
2
)
0
0
;
text-align
:
center
;
...
...
lms/templates/seq_module.html
View file @
7e4d3c8b
<div
id=
"sequence_${element_id}"
class=
"sequence"
>
<div
id=
"sequence_${element_id}"
class=
"sequence"
data-id=
"${item_id}"
data-position=
"${position}"
>
<nav
aria-label=
"Section Navigation"
class=
"sequence-nav"
>
<ol
id=
"sequence-list"
>
% for idx, item in enumerate(items):
## TODO (vshnayder): add item.progress_detail either to the title or somewhere else.
## Make sure it gets updated after ajax calls.
## implementation note: will need to figure out how to handle combining detail
## statuses of multiple modules in js.
<li>
<a
class=
"seq_${item['type']} inactive progress-${item['progress_status']}"
data-element=
"${idx+1}"
>
<p>
${item['title']}
</p>
</a>
</li>
% endfor
</ol>
<ul
class=
"sequence-nav-buttons"
>
...
...
@@ -9,6 +20,9 @@
</ul>
</nav>
% for item in items:
<div
class=
"seq_contents"
>
${item['content'] | h}
</div>
% endfor
<div
id=
"seq_content"
></div>
<nav
class=
"sequence-bottom"
>
...
...
@@ -22,7 +36,7 @@
<
%
block
name=
"js_extra"
>
<script
type=
"text/javascript"
>
$
(
function
(){
new
Sequence
(
'${item_id}'
,
'sequence_${element_id}'
,
$
{
items
},
'${tag}'
,
$
{
position
}
);
new
Sequence
(
$
(
"#sequence_${element_id}"
)
);
});
</script>
</
%
block>
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