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):
...
@@ -401,7 +401,9 @@ def save_item(request):
descriptor
=
modulestore
()
.
get_item
(
item_location
)
descriptor
=
modulestore
()
.
get_item
(
item_location
)
preview_html
=
get_module_previews
(
request
,
descriptor
)[
0
]
preview_html
=
get_module_previews
(
request
,
descriptor
)[
0
]
return
HttpResponse
(
json
.
dumps
(
preview_html
))
return
HttpResponse
(
json
.
dumps
({
'preview'
:
preview_html
}))
@login_required
@login_required
...
...
cms/static/coffee/src/views/module_edit.coffee
View file @
b305c0ba
...
@@ -35,11 +35,12 @@ class CMS.Views.ModuleEdit extends Backbone.View
...
@@ -35,11 +35,12 @@ class CMS.Views.ModuleEdit extends Backbone.View
_metadata
_metadata
save
:
(
data
)
=>
save
:
(
data
)
=>
@
model
.
unset
(
'preview'
)
@
model
.
set
(
data
)
@
model
.
set
(
data
)
@
model
.
save
().
done
(
(
preview
)
=>
@
model
.
save
().
done
(
(
resp
)
=>
alert
(
"Your changes have been saved."
)
alert
(
"Your changes have been saved."
)
$preview
=
$
(
preview
)
$preview
=
$
(
resp
.
preview
)
@
$el
.
replaceWith
(
$preview
)
@
$el
.
replaceWith
(
$preview
)
@
setElement
(
$preview
)
@
setElement
(
$preview
)
@
module
.
constructor
(
@
$el
)
@
module
.
constructor
(
@
$el
)
...
...
common/lib/xmodule/xmodule/js/src/sequence/edit.coffee
View file @
b305c0ba
class
@
SequenceDescriptor
extends
XModule
.
Descriptor
class
@
SequenceDescriptor
extends
XModule
.
Descriptor
constructor
:
(
@
element
)
->
constructor
:
(
@
element
)
->
@
$tabs
=
$
(
@
element
).
find
(
"#sequence-list"
)
@
$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
class
@
VerticalDescriptor
extends
XModule
.
Descriptor
constructor
:
(
@
element
)
->
constructor
:
(
@
element
)
->
@
$items
=
$
(
@
element
).
find
(
".vert-mod"
)
@
$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):
...
@@ -17,7 +17,10 @@ class VerticalModule(XModule):
def
get_html
(
self
):
def
get_html
(
self
):
if
self
.
contents
is
None
:
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'
,
{
return
self
.
system
.
render_template
(
'vert_module.html'
,
{
'items'
:
self
.
contents
'items'
:
self
.
contents
...
...
common/static/coffee/src/xmodule.coffee
View file @
b305c0ba
...
@@ -37,14 +37,15 @@
...
@@ -37,14 +37,15 @@
class
@
XModule
.
Descriptor
class
@
XModule
.
Descriptor
callbacks
:
[]
###
###
Register a callback method to be called when the state of this
Register a callback method to be called when the state of this
descriptor is updated. The callback will be passed the results
descriptor is updated. The callback will be passed the results
of calling the save method on this descriptor.
of calling the save method on this descriptor.
###
###
onUpdate
:
(
callback
)
->
onUpdate
:
(
callback
)
->
if
!
@
callbacks
?
@
callbacks
=
[]
@
callbacks
.
push
(
callback
)
@
callbacks
.
push
(
callback
)
###
###
...
...
lms/templates/vert_module.html
View file @
b305c0ba
<ol
class=
"vert-mod"
>
<ol
class=
"vert-mod"
>
% for idx, item in enumerate(items):
% for idx, item in enumerate(items):
<li
id=
"vert-${idx}"
>
<li
id=
"vert-${idx}"
data-id=
"${item['id']}"
>
${item}
${item
['content']
}
</li>
</li>
% endfor
% endfor
</ol>
</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