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
83b3d51f
Commit
83b3d51f
authored
Jun 22, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wire up the cancel button in the unit editor
parent
72eef72d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
16 deletions
+19
-16
cms/static/coffee/main.coffee
+14
-13
cms/static/coffee/unit.coffee
+5
-3
No files found.
cms/static/coffee/main.coffee
View file @
83b3d51f
bind_edit_links
=
->
class
@
CMS
$
(
'a.module-edit'
).
click
->
@
bind
=
=>
edit_item
(
$
(
this
).
attr
(
'id'
))
$
(
'a.module-edit'
).
click
->
return
false
CMS
.
edit_item
(
$
(
this
).
attr
(
'id'
))
return
false
edit_item
=
(
id
)
=>
@
edit_item
=
(
id
)
=>
$
.
get
(
'/edit_item'
,
{
id
:
id
},
(
data
)
=>
$
.
get
(
'/edit_item'
,
{
id
:
id
},
(
data
)
=>
$
(
'#module-html'
).
empty
().
append
(
data
)
$
(
'#module-html'
).
empty
().
append
(
data
)
bind_edit_links
()
CMS
.
bind
()
$
(
'section.edit-pane'
).
show
()
$
(
'section.edit-pane'
).
show
()
$
(
'body'
).
addClass
(
'content'
)
$
(
'body'
).
addClass
(
'content'
)
new
@
Unit
(
'unit-wrapper'
,
id
)
new
Unit
(
'unit-wrapper'
,
id
)
)
)
$
->
$
->
$
.
ajaxSetup
$
.
ajaxSetup
...
@@ -73,5 +74,5 @@ $ ->
...
@@ -73,5 +74,5 @@ $ ->
$
(
'section.edit-pane'
).
show
()
$
(
'section.edit-pane'
).
show
()
return
false
return
false
bind_edit_links
()
CMS
.
bind
()
cms/static/coffee/unit.coffee
View file @
83b3d51f
...
@@ -2,12 +2,14 @@ class @Unit
...
@@ -2,12 +2,14 @@ class @Unit
constructor
:
(
@
element_id
,
@
module_id
)
->
constructor
:
(
@
element_id
,
@
module_id
)
->
@
module
=
new
window
[
$
(
"#
#{
@
element_id
}
"
).
attr
(
'class'
)]
'module-html'
@
module
=
new
window
[
$
(
"#
#{
@
element_id
}
"
).
attr
(
'class'
)]
'module-html'
$
(
"#
#{
@
element_id
}
.save-update"
).
click
(
(
event
)
=>
$
(
"#
#{
@
element_id
}
.save-update"
).
click
(
event
)
=>
event
.
preventDefault
()
event
.
preventDefault
()
$
.
post
(
"save_item"
,
{
$
.
post
(
"save_item"
,
{
id
:
@
module_id
id
:
@
module_id
data
:
JSON
.
stringify
(
@
module
.
save
())
data
:
JSON
.
stringify
(
@
module
.
save
())
})
})
)
$
(
"#
#{
@
element_id
}
.cancel"
).
click
(
event
)
=>
event
.
preventDefault
()
CMS
.
edit_item
(
@
module_id
)
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