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
80c97c65
Commit
80c97c65
authored
May 09, 2012
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor module loading using class detection
parent
8624927f
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
74 additions
and
58 deletions
+74
-58
djangoapps/courseware/modules/video_module.py
+1
-3
static/coffee/src/calculator.coffee
+5
-6
static/coffee/src/courseware.coffee
+13
-23
static/coffee/src/feedback_form.coffee
+2
-2
static/coffee/src/main.coffee
+2
-3
static/sass/courseware/_video.scss
+0
-1
templates/coffee/src/courseware_navigation.coffee
+19
-0
templates/coffee/src/modules/sequence.coffee
+7
-7
templates/coffee/src/modules/video.coffee
+5
-4
templates/coffee/src/navigation.coffee
+19
-0
templates/video.html
+1
-9
No files found.
djangoapps/courseware/modules/video_module.py
View file @
80c97c65
...
...
@@ -32,9 +32,7 @@ class Module(XModule):
return
[
"video"
]
def
video_list
(
self
):
l
=
self
.
youtube
.
split
(
','
)
l
=
[
i
.
split
(
":"
)
for
i
in
l
]
return
json
.
dumps
(
dict
(
l
))
return
self
.
youtube
def
get_html
(
self
):
return
render_to_string
(
'video.html'
,{
'streams'
:
self
.
video_list
(),
...
...
static/coffee/src/calculator.coffee
View file @
80c97c65
class
window
.
Calculator
@
bind
:
->
calculator
=
new
Calculator
$
(
'.calc'
).
click
calculator
.
toggle
$
(
'form#calculator'
).
submit
(
calculator
.
calculate
).
submit
(
e
)
->
class
Calculator
constructor
:
->
$
(
'.calc'
).
click
@
toggle
$
(
'form#calculator'
).
submit
(
@
calculate
).
submit
(
e
)
->
e
.
preventDefault
()
$
(
'div.help-wrapper a'
).
hover
(
calculator
.
helpToggle
).
click
(
e
)
->
$
(
'div.help-wrapper a'
).
hover
(
@
helpToggle
).
click
(
e
)
->
e
.
preventDefault
()
toggle
:
->
...
...
static/coffee/src/courseware.coffee
View file @
80c97c65
class
window
.
Courseware
@
bind
:
->
@
Navigation
.
bind
()
class
@
Navigation
@
bind
:
->
if
$
(
'#accordion'
).
length
navigation
=
new
Navigation
active
=
$
(
'#accordion ul:has(li.active)'
).
index
(
'#accordion ul'
)
$
(
'#accordion'
).
bind
(
'accordionchange'
,
navigation
.
log
).
accordion
active
:
if
active
>=
0
then
active
else
1
header
:
'h3'
autoHeight
:
false
$
(
'#open_close_accordion a'
).
click
navigation
.
toggle
$
(
'#accordion'
).
show
()
log
:
(
event
,
ui
)
->
log_event
'accordion'
,
newheader
:
ui
.
newHeader
.
text
()
oldheader
:
ui
.
oldHeader
.
text
()
toggle
:
->
$
(
'.course-wrapper'
).
toggleClass
(
'closed'
)
constructor
:
->
new
CoursewareNavigation
new
Calculator
new
FeedbackForm
@
renderModules
()
@
start
:
->
new
Courseware
renderModules
:
->
$
(
'.course-content .video'
).
each
->
id
=
$
(
this
).
attr
(
'id'
).
replace
(
/video_/
,
''
)
new
Video
id
,
$
(
this
).
data
(
'streams'
)
static/coffee/src/feedback_form.coffee
View file @
80c97c65
class
window
.
FeedbackForm
@
bind
:
->
class
FeedbackForm
constructor
:
->
$
(
'#feedback_button'
).
click
->
data
=
subject
:
$
(
'#feedback_subject'
).
val
()
...
...
static/coffee/src/main.coffee
View file @
80c97c65
...
...
@@ -5,8 +5,7 @@ $ ->
window
.
onTouchBasedDevice
=
->
navigator
.
userAgent
.
match
/iPhone|iPod|iPad/i
Calculator
.
bind
()
Courseware
.
bind
()
FeedbackForm
.
bind
()
$
(
"a[rel*=leanModal]"
).
leanModal
()
if
$
(
'body'
).
hasClass
(
'courseware'
)
Courseware
.
start
()
static/sass/courseware/_video.scss
View file @
80c97c65
...
...
@@ -351,7 +351,6 @@ section.course-content {
float
:
left
;
max-height
:
460px
;
overflow
:
auto
;
padding-top
:
10px
;
width
:
flex-grid
(
3
,
9
);
li
{
...
...
templates/coffee/src/courseware_navigation.coffee
0 → 100644
View file @
80c97c65
class
CoursewareNavigation
constructor
:
->
if
$
(
'#accordion'
).
length
active
=
$
(
'#accordion ul:has(li.active)'
).
index
(
'#accordion ul'
)
$
(
'#accordion'
).
bind
(
'accordionchange'
,
@
log
).
accordion
active
:
if
active
>=
0
then
active
else
1
header
:
'h3'
autoHeight
:
false
$
(
'#open_close_accordion a'
).
click
@
toggle
$
(
'#accordion'
).
show
()
log
:
(
event
,
ui
)
->
log_event
'accordion'
,
newheader
:
ui
.
newHeader
.
text
()
oldheader
:
ui
.
oldHeader
.
text
()
toggle
:
->
$
(
'.course-wrapper'
).
toggleClass
(
'closed'
)
templates/coffee/src/modules/sequence.coffee
View file @
80c97c65
...
...
@@ -40,20 +40,20 @@ class window.Sequence
@
position
=
new_position
@
toggleArrows
()
goto
:
(
e
)
=>
e
.
preventDefault
()
new_position
=
$
(
e
.
srcElemen
t
).
data
(
'element'
)
goto
:
(
e
vent
)
=>
e
vent
.
preventDefault
()
new_position
=
$
(
e
vent
.
targe
t
).
data
(
'element'
)
log_event
(
"seq_goto"
,
old
:
@
position
,
new
:
new_position
,
id
:
@
id
)
@
render
new_position
next
:
(
e
)
=>
e
.
preventDefault
()
next
:
(
e
vent
)
=>
e
vent
.
preventDefault
()
new_position
=
@
position
+
1
log_event
(
"seq_next"
,
old
:
@
position
,
new
:
new_position
,
id
:
@
id
)
@
render
new_position
previous
:
(
e
)
=>
e
.
preventDefault
()
previous
:
(
e
vent
)
=>
e
vent
.
preventDefault
()
new_position
=
@
position
-
1
log_event
(
"seq_prev"
,
old
:
@
position
,
new
:
new_position
,
id
:
@
id
)
@
render
new_position
...
...
templates/coffee/src/modules/video.coffee
View file @
80c97c65
class
window
.
Video
class
Video
constructor
:
(
@
id
,
videos
)
->
@
element
=
$
(
"#video_
#{
@
id
}
"
)
@
parseVideos
videos
...
...
@@ -14,9 +14,10 @@ class window.Video
parseVideos
:
(
videos
)
->
@
videos
=
{}
$
.
each
videos
,
(
speed
,
url
)
=>
speed
=
parseFloat
(
speed
).
toFixed
(
2
).
replace
/\.00$/
,
'.0'
@
videos
[
speed
]
=
url
$
.
each
videos
.
split
(
/,/
),
(
index
,
video
)
=>
video
=
video
.
split
(
/:/
)
speed
=
parseFloat
(
video
[
0
]).
toFixed
(
2
).
replace
/\.00$/
,
'.0'
@
videos
[
speed
]
=
video
[
1
]
parseSpeed
:
->
@
setSpeed
(
$
.
cookie
(
'video_speed'
))
...
...
templates/coffee/src/navigation.coffee
0 → 100644
View file @
80c97c65
class
Courseware
::
Navigation
constructor
:
->
if
$
(
'#accordion'
).
length
active
=
$
(
'#accordion ul:has(li.active)'
).
index
(
'#accordion ul'
)
$
(
'#accordion'
).
bind
(
'accordionchange'
,
@
log
).
accordion
active
:
if
active
>=
0
then
active
else
1
header
:
'h3'
autoHeight
:
false
$
(
'#open_close_accordion a'
).
click
@
toggle
$
(
'#accordion'
).
show
()
log
:
(
event
,
ui
)
->
log_event
'accordion'
,
newheader
:
ui
.
newHeader
.
text
()
oldheader
:
ui
.
oldHeader
.
text
()
toggle
:
->
$
(
'.course-wrapper'
).
toggleClass
(
'closed'
)
templates/video.html
View file @
80c97c65
...
...
@@ -2,7 +2,7 @@
<h1>
${name}
</h1>
% endif
<div
id=
"video_${id}"
class=
"video"
>
<div
id=
"video_${id}"
class=
"video"
data-streams=
"${streams}"
>
<div
class=
"tc-wrapper"
>
<article
class=
"video-wrapper"
>
<section
class=
"video-player"
>
...
...
@@ -41,14 +41,6 @@
</div>
</div>
<
%
block
name=
"js_extra"
>
<script
type=
"text/javascript"
>
$
(
function
(){
new
Video
(
'${id}'
,
$
{
streams
});
});
</script>
</
%
block>
<ol
class=
"video-mod"
>
% for t in annotations:
<li
id=
"video-${annotations.index(t)}"
>
...
...
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