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
8a91616a
Commit
8a91616a
authored
Jun 28, 2012
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement viewStack to support nested view
parent
a7dc045f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
8 deletions
+27
-8
cms/static/coffee/src/main.coffee
+19
-0
cms/static/coffee/src/views/course.coffee
+2
-2
cms/static/coffee/src/views/module.coffee
+1
-1
cms/static/coffee/src/views/module_edit.coffee
+2
-2
cms/static/coffee/src/views/week.coffee
+3
-3
No files found.
cms/static/coffee/src/main.coffee
View file @
8a91616a
...
...
@@ -2,9 +2,28 @@
Models
:
{}
Views
:
{}
viewStack
:
[]
start
:
->
new
CMS
.
Views
.
Course
el
:
$
(
'section.main-container'
)
replaceView
:
(
view
)
->
@
viewStack
=
[
view
]
CMS
.
trigger
(
'content.show'
,
view
)
pushView
:
(
view
)
->
@
viewStack
.
push
(
view
)
CMS
.
trigger
(
'content.show'
,
view
)
popView
:
->
@
viewStack
.
pop
()
if
_
.
isEmpty
(
@
viewStack
)
CMS
.
trigger
(
'content.hide'
)
else
view
=
_
.
last
(
@
viewStack
)
CMS
.
trigger
(
'content.show'
,
view
)
view
.
delegateEvents
()
_
.
extend
CMS
,
Backbone
.
Events
$
->
...
...
cms/static/coffee/src/views/course.coffee
View file @
8a91616a
...
...
@@ -3,8 +3,8 @@ class CMS.Views.Course extends Backbone.View
@
$
(
'#weeks > li'
).
each
(
index
,
week
)
=>
new
CMS
.
Views
.
Week
el
:
week
,
height
:
@
maxWeekHeight
()
CMS
.
on
(
'
showContent
'
,
@
showContent
)
CMS
.
on
(
'
hideContent
'
,
@
hideContent
)
CMS
.
on
(
'
content.show
'
,
@
showContent
)
CMS
.
on
(
'
content.hide
'
,
@
hideContent
)
showContent
:
(
subview
)
=>
$
(
'body'
).
addClass
(
'content'
)
...
...
cms/static/coffee/src/views/module.coffee
View file @
8a91616a
...
...
@@ -6,4 +6,4 @@ class CMS.Views.Module extends Backbone.View
@
model
=
new
CMS
.
Models
.
Module
(
id
:
@
$el
.
data
(
'id'
),
type
:
@
$el
.
data
(
'type'
))
edit
:
=>
CMS
.
trigger
(
'showContent'
,
new
CMS
.
Views
.
ModuleEdit
(
model
:
@
model
))
CMS
.
replaceView
(
new
CMS
.
Views
.
ModuleEdit
(
model
:
@
model
))
cms/static/coffee/src/views/module_edit.coffee
View file @
8a91616a
...
...
@@ -4,10 +4,10 @@ class CMS.Views.ModuleEdit extends Backbone.View
events
:
'click .cancel'
:
'cancel'
# 'click .module-edit', 'edit'
initialize
:
->
CMS
.
trigger
'module.edit'
@
$el
.
append
(
$
(
"""<div id="
#{
@
model
.
get
(
'id'
)
}
">"""
).
load
(
@
model
.
editUrl
()))
cancel
:
->
CMS
.
trigger
'hideContent'
CMS
.
popView
()
cms/static/coffee/src/views/week.coffee
View file @
8a91616a
...
...
@@ -11,11 +11,11 @@ class CMS.Views.Week extends Backbone.View
@
$
(
'.modules .module'
).
each
->
new
CMS
.
Views
.
Module
el
:
this
CMS
.
on
(
'
showContent
'
,
@
resetHeight
)
CMS
.
on
(
'
hideContent
'
,
@
setHeight
)
CMS
.
on
(
'
content.show
'
,
@
resetHeight
)
CMS
.
on
(
'
content.hide
'
,
@
setHeight
)
edit
:
=>
CMS
.
trigger
(
'showContent'
,
new
CMS
.
Views
.
WeekEdit
(
model
:
@
model
))
CMS
.
replaceView
(
new
CMS
.
Views
.
WeekEdit
(
model
:
@
model
))
setHeight
:
=>
@
$el
.
height
(
@
options
.
height
)
...
...
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