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
ecf0126f
Commit
ecf0126f
authored
May 07, 2012
by
Prem Sichanugrist
Committed by
Kyle Fiedler
May 08, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the accordian expand 'Week 1' by default
This fixes the regression from javascript rewrite.
parent
dfee512b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
19 deletions
+46
-19
static/js/application.js
+3
-2
templates/coffee/spec/courseware_spec.coffee
+19
-8
templates/coffee/spec/courseware_spec.js
+22
-8
templates/coffee/src/courseware.coffee
+2
-1
No files found.
static/js/application.js
View file @
ecf0126f
...
...
@@ -52,11 +52,12 @@
function
Navigation
()
{}
Navigation
.
bind
=
function
()
{
var
navigation
;
var
active
,
navigation
;
if
(
$
(
'#accordion'
).
length
)
{
navigation
=
new
Navigation
;
active
=
$
(
'#accordion ul:has(li.active)'
).
index
(
'#accordion ul'
);
$
(
'#accordion'
).
bind
(
'accordionchange'
,
navigation
.
log
).
accordion
({
active
:
$
(
'#accordion ul:has(li.active)'
).
index
(
'#accordion ul'
)
,
active
:
active
>=
0
?
active
:
1
,
header
:
'h3'
,
autoHeight
:
false
});
...
...
templates/coffee/spec/courseware_spec.coffee
View file @
ecf0126f
...
...
@@ -12,14 +12,25 @@ describe 'Courseware', ->
describe
'bind'
,
->
describe
'when the #accordion exists'
,
->
it
'activate the accordion with correct active section'
,
->
spyOn
$
.
fn
,
'accordion'
$
(
'#accordion'
).
append
(
'<ul><li></li></ul><ul><li class="active"></li></ul>'
)
Courseware
.
Navigation
.
bind
()
expect
(
$
(
'#accordion'
).
accordion
).
toHaveBeenCalledWith
active
:
1
header
:
'h3'
autoHeight
:
false
describe
'when there is an active section'
,
->
it
'activate the accordion with correct active section'
,
->
spyOn
$
.
fn
,
'accordion'
$
(
'#accordion'
).
append
(
'<ul><li></li></ul><ul><li class="active"></li></ul>'
)
Courseware
.
Navigation
.
bind
()
expect
(
$
(
'#accordion'
).
accordion
).
toHaveBeenCalledWith
active
:
1
header
:
'h3'
autoHeight
:
false
describe
'when there is no active section'
,
->
it
'activate the accordian with section 1 as active'
,
->
spyOn
$
.
fn
,
'accordion'
$
(
'#accordion'
).
append
(
'<ul><li></li></ul><ul><li></li></ul>'
)
Courseware
.
Navigation
.
bind
()
expect
(
$
(
'#accordion'
).
accordion
).
toHaveBeenCalledWith
active
:
1
header
:
'h3'
autoHeight
:
false
it
'binds the accordionchange event'
,
->
Courseware
.
Navigation
.
bind
()
...
...
templates/coffee/spec/courseware_spec.js
View file @
ecf0126f
...
...
@@ -16,14 +16,28 @@
});
describe
(
'bind'
,
function
()
{
describe
(
'when the #accordion exists'
,
function
()
{
it
(
'activate the accordion with correct active section'
,
function
()
{
spyOn
(
$
.
fn
,
'accordion'
);
$
(
'#accordion'
).
append
(
'<ul><li></li></ul><ul><li class="active"></li></ul>'
);
Courseware
.
Navigation
.
bind
();
return
expect
(
$
(
'#accordion'
).
accordion
).
toHaveBeenCalledWith
({
active
:
1
,
header
:
'h3'
,
autoHeight
:
false
describe
(
'when there is an active section'
,
function
()
{
return
it
(
'activate the accordion with correct active section'
,
function
()
{
spyOn
(
$
.
fn
,
'accordion'
);
$
(
'#accordion'
).
append
(
'<ul><li></li></ul><ul><li class="active"></li></ul>'
);
Courseware
.
Navigation
.
bind
();
return
expect
(
$
(
'#accordion'
).
accordion
).
toHaveBeenCalledWith
({
active
:
1
,
header
:
'h3'
,
autoHeight
:
false
});
});
});
describe
(
'when there is no active section'
,
function
()
{
return
it
(
'activate the accordian with section 1 as active'
,
function
()
{
spyOn
(
$
.
fn
,
'accordion'
);
$
(
'#accordion'
).
append
(
'<ul><li></li></ul><ul><li></li></ul>'
);
Courseware
.
Navigation
.
bind
();
return
expect
(
$
(
'#accordion'
).
accordion
).
toHaveBeenCalledWith
({
active
:
1
,
header
:
'h3'
,
autoHeight
:
false
});
});
});
it
(
'binds the accordionchange event'
,
function
()
{
...
...
templates/coffee/src/courseware.coffee
View file @
ecf0126f
...
...
@@ -6,8 +6,9 @@ class window.Courseware
@
bind
:
->
if
$
(
'#accordion'
).
length
navigation
=
new
Navigation
active
=
$
(
'#accordion ul:has(li.active)'
).
index
(
'#accordion ul'
)
$
(
'#accordion'
).
bind
(
'accordionchange'
,
navigation
.
log
).
accordion
active
:
$
(
'#accordion ul:has(li.active)'
).
index
(
'#accordion ul'
)
active
:
if
active
>=
0
then
active
else
1
header
:
'h3'
autoHeight
:
false
$
(
'#open_close_accordion a'
).
click
navigation
.
toggle
...
...
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