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
b305c0ba
Commit
b305c0ba
authored
Sep 27, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make drag/drop save content immediately in seqs and verticals
parent
fd7223bd
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
27 additions
and
10 deletions
+27
-10
cms/djangoapps/contentstore/views.py
+3
-1
cms/static/coffee/src/views/module_edit.coffee
+3
-2
common/lib/xmodule/xmodule/js/src/sequence/edit.coffee
+6
-1
common/lib/xmodule/xmodule/js/src/vertical/edit.coffee
+6
-1
common/lib/xmodule/xmodule/vertical_module.py
+4
-1
common/static/coffee/src/xmodule.coffee
+3
-2
lms/templates/vert_module.html
+2
-2
No files found.
cms/djangoapps/contentstore/views.py
View file @
b305c0ba
...
...
@@ -401,7 +401,9 @@ def save_item(request):
descriptor
=
modulestore
()
.
get_item
(
item_location
)
preview_html
=
get_module_previews
(
request
,
descriptor
)[
0
]
return
HttpResponse
(
json
.
dumps
(
preview_html
))
return
HttpResponse
(
json
.
dumps
({
'preview'
:
preview_html
}))
@login_required
...
...
cms/static/coffee/src/views/module_edit.coffee
View file @
b305c0ba
...
...
@@ -35,11 +35,12 @@ class CMS.Views.ModuleEdit extends Backbone.View
_metadata
save
:
(
data
)
=>
@
model
.
unset
(
'preview'
)
@
model
.
set
(
data
)
@
model
.
save
().
done
(
(
preview
)
=>
@
model
.
save
().
done
(
(
resp
)
=>
alert
(
"Your changes have been saved."
)
$preview
=
$
(
preview
)
$preview
=
$
(
resp
.
preview
)
@
$el
.
replaceWith
(
$preview
)
@
setElement
(
$preview
)
@
module
.
constructor
(
@
$el
)
...
...
common/lib/xmodule/xmodule/js/src/sequence/edit.coffee
View file @
b305c0ba
class
@
SequenceDescriptor
extends
XModule
.
Descriptor
constructor
:
(
@
element
)
->
@
$tabs
=
$
(
@
element
).
find
(
"#sequence-list"
)
@
$tabs
.
sortable
()
@
$tabs
.
sortable
(
update
:
(
event
,
ui
)
=>
@
update
()
)
save
:
->
children
:
$
(
'#sequence-list li a'
,
@
element
).
map
((
idx
,
el
)
->
$
(
el
).
data
(
'id'
)).
toArray
()
common/lib/xmodule/xmodule/js/src/vertical/edit.coffee
View file @
b305c0ba
class
@
VerticalDescriptor
extends
XModule
.
Descriptor
constructor
:
(
@
element
)
->
@
$items
=
$
(
@
element
).
find
(
".vert-mod"
)
@
$items
.
sortable
()
@
$items
.
sortable
(
update
:
(
event
,
ui
)
=>
@
update
()
)
save
:
->
children
:
$
(
'.vert-mod li'
,
@
element
).
map
((
idx
,
el
)
->
$
(
el
).
data
(
'id'
)).
toArray
()
common/lib/xmodule/xmodule/vertical_module.py
View file @
b305c0ba
...
...
@@ -17,7 +17,10 @@ class VerticalModule(XModule):
def
get_html
(
self
):
if
self
.
contents
is
None
:
self
.
contents
=
[
child
.
get_html
()
for
child
in
self
.
get_display_items
()]
self
.
contents
=
[{
'id'
:
child
.
id
,
'content'
:
child
.
get_html
()
}
for
child
in
self
.
get_display_items
()]
return
self
.
system
.
render_template
(
'vert_module.html'
,
{
'items'
:
self
.
contents
...
...
common/static/coffee/src/xmodule.coffee
View file @
b305c0ba
...
...
@@ -37,14 +37,15 @@
class
@
XModule
.
Descriptor
callbacks
:
[]
###
Register a callback method to be called when the state of this
descriptor is updated. The callback will be passed the results
of calling the save method on this descriptor.
###
onUpdate
:
(
callback
)
->
if
!
@
callbacks
?
@
callbacks
=
[]
@
callbacks
.
push
(
callback
)
###
...
...
lms/templates/vert_module.html
View file @
b305c0ba
<ol
class=
"vert-mod"
>
% for idx, item in enumerate(items):
<li
id=
"vert-${idx}"
>
${item}
<li
id=
"vert-${idx}"
data-id=
"${item['id']}"
>
${item
['content']
}
</li>
% endfor
</ol>
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