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
d1124357
Commit
d1124357
authored
Jan 03, 2013
by
Don Mitchell
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/cas/speed-editor' of github.com:MITx/mitx into feature/cas/speed-editor
parents
63791b2a
e09a8e4a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
274 deletions
+40
-274
cms/static/coffee/src/views/unit.coffee
+1
-31
cms/templates/unit.html
+14
-225
cms/templates/widgets/problem-edit.html
+24
-17
common/lib/xmodule/xmodule/js/src/problem/markdown.coffee
+1
-1
No files found.
cms/static/coffee/src/views/unit.coffee
View file @
d1124357
class
CMS
.
Views
.
UnitEdit
extends
Backbone
.
View
events
:
# 'click .new-component .new-component-type a': 'showComponentTemplates'
'click .new-component .new-component-type a'
:
'addNewComponent'
'click .new-component .new-component-type a'
:
'showComponentTemplates'
'click .new-component .cancel-button'
:
'closeNewComponent'
'click .new-component-templates .new-component-template a'
:
'saveNewComponent'
'click .new-component-templates .cancel-button'
:
'closeNewComponent'
...
...
@@ -69,35 +68,6 @@ class CMS.Views.UnitEdit extends Backbone.View
@
$newComponentItem
.
removeClass
(
'adding'
)
@
$newComponentItem
.
find
(
'.rendered-component'
).
remove
()
addNewComponent
:
(
event
)
=>
event
.
preventDefault
()
@
$componentItem
=
$
(
'<li>'
).
addClass
(
'editing'
)
type
=
$
(
event
.
currentTarget
).
data
(
'type'
)
switch
type
when
'problem'
@
$editor
=
$
(
$
(
'#problem-editor'
).
html
())
$preview
=
$
(
$
(
'#problem-preview'
).
html
())
initProblemEditors
(
@
$editor
,
$preview
)
@
$editor
.
find
(
'.save-button, .cancel-button'
).
bind
(
'click'
,
=>
@
$componentItem
.
removeClass
(
'editing'
)
@
closeEditor
()
)
$componentActions
=
$
(
$
(
'#component-actions'
).
html
())
@
$componentItem
.
append
(
@
$editor
)
@
$componentItem
.
append
(
$preview
)
@
$componentItem
.
append
(
$componentActions
)
@
$componentItem
.
hide
()
@
$newComponentItem
.
before
(
@
$componentItem
)
@
$componentItem
.
show
()
$modalCover
.
fadeIn
(
200
)
$modalCover
.
bind
(
'click'
,
@
closeEditor
)
closeEditor
:
(
event
)
=>
@
$editor
.
slideUp
(
150
)
$modalCover
.
fadeOut
(
150
)
...
...
cms/templates/unit.html
View file @
d1124357
...
...
@@ -13,8 +13,6 @@
})
});
$body
=
$
(
'body'
);
$body
.
on
(
'click'
,
'.editor-tabs .tab'
,
setEditorTab
);
function
setEditorTab
(
e
)
{
e
.
preventDefault
();
...
...
@@ -53,229 +51,6 @@
}
</script>
<script
src=
"/static/js/speed-editor.js"
></script>
<script
type=
"text/template"
id=
"asset-library-widget"
>
<
article
class
=
"asset-library widget"
>
<
a
href
=
"#"
class
=
"close-button"
>
<
span
class
=
"close-icon"
><
/span
>
<
/a
>
<
div
class
=
"upload-form"
>
<
h1
>
Upload
New
File
<
/h1
>
<
p
class
=
"file-name"
><
/p
>
<
div
class
=
"progress-bar"
>
<
div
class
=
"progress-fill"
><
/div
>
<
/div
>
<
div
class
=
"embeddable"
>
<
label
>
Embeddable
XML
:
<
/label
>
<
input
type
=
"text"
class
=
"embeddable-xml-input"
value
=
"<img src=""/>"
>
<
/div
>
<
form
class
=
"file-chooser"
action
=
"/Giannattasio/313/course/Photoshop_for_Monkeys/upload_asset"
method
=
"post"
enctype
=
"multipart/form-data"
>
<
a
href
=
"#"
class
=
"choose-file-button"
>
Choose
File
<
/a
>
<
input
type
=
"file"
class
=
"file-input"
name
=
"file"
>
<
/form
>
<
/div
>
<
header
>
<
a
href
=
"#"
class
=
"upload-button"
>
Upload
New
File
<
/a
>
<
input
type
=
"text"
class
=
"search"
>
<
/header
>
<
table
class
=
"library-list"
>
<
thead
>
<
tr
>
<
th
class
=
"thumb-col"
><
/th
>
<
th
class
=
"name-col"
><
a
href
=
"#"
>
Name
<
span
class
=
"sort-icon down"
><
/span></
a
><
/th
>
<
th
class
=
"date-col"
><
a
href
=
"#"
>
Date
Added
<
/a></
th
>
<
th
class
=
"insert-col"
><
/th
>
<
/tr
>
<
/thead
>
<
tbody
id
=
"asset_table_body"
>
<
tr
data
-
id
=
"id"
>
<
td
class
=
"thumb-col"
>
<
div
class
=
"thumb"
>
<
img
src
=
"/"
>
<
/div
>
<
/td
>
<
td
class
=
"name-col"
>
<
a
href
=
"#"
class
=
"filename"
>
ut
-
logo
-
350
-
150
.
png
<
/a
>
<
div
class
=
"embeddable-xml"
><
/div
>
<
/td
>
<
td
class
=
"date-col"
>
30
October
,
2012
at
07
:
17
PM
<
/td
>
<
td
class
=
"insert-col"
>
<
a
href
=
"#"
class
=
"insert-asset-button"
data
-
markup
=
"<img src='/c4x/Giannattasio/313/asset/ut-logo-350-150.png'/>"
>
Insert
<
/a
>
<
/td
>
<
/tr
>
<
tr
data
-
id
=
"id"
>
<
td
class
=
"thumb-col"
>
<
div
class
=
"thumb"
>
<
img
src
=
"/"
>
<
/div
>
<
/td
>
<
td
class
=
"name-col"
>
<
a
href
=
"#"
class
=
"filename"
>
ut
-
logo
-
350
-
150
.
png
<
/a
>
<
div
class
=
"embeddable-xml"
><
/div
>
<
/td
>
<
td
class
=
"date-col"
>
30
October
,
2012
at
07
:
17
PM
<
/td
>
<
td
class
=
"insert-col"
>
<
a
href
=
"#"
class
=
"insert-asset-button"
data
-
markup
=
"<img src='/c4x/Giannattasio/313/asset/ut-logo-350-150.png'/>"
>
Insert
<
/a
>
<
/td
>
<
/tr
>
<
tr
data
-
id
=
"id"
>
<
td
class
=
"thumb-col"
>
<
div
class
=
"thumb"
>
<
img
src
=
"/"
>
<
/div
>
<
/td
>
<
td
class
=
"name-col"
>
<
a
href
=
"#"
class
=
"filename"
>
ut
-
logo
-
350
-
150
.
png
<
/a
>
<
div
class
=
"embeddable-xml"
><
/div
>
<
/td
>
<
td
class
=
"date-col"
>
30
October
,
2012
at
07
:
17
PM
<
/td
>
<
td
class
=
"insert-col"
>
<
a
href
=
"#"
class
=
"insert-asset-button"
data
-
markup
=
"<img src='/c4x/Giannattasio/313/asset/ut-logo-350-150.png'/>"
>
Insert
<
/a
>
<
/td
>
<
/tr
>
<
tr
data
-
id
=
"id"
>
<
td
class
=
"thumb-col"
>
<
div
class
=
"thumb"
>
<
img
src
=
"/"
>
<
/div
>
<
/td
>
<
td
class
=
"name-col"
>
<
a
href
=
"#"
class
=
"filename"
>
ut
-
logo
-
350
-
150
.
png
<
/a
>
<
div
class
=
"embeddable-xml"
><
/div
>
<
/td
>
<
td
class
=
"date-col"
>
30
October
,
2012
at
07
:
17
PM
<
/td
>
<
td
class
=
"insert-col"
>
<
a
href
=
"#"
class
=
"insert-asset-button"
data
-
markup
=
"<img src='/c4x/Giannattasio/313/asset/ut-logo-350-150.png'/>"
>
Insert
<
/a
>
<
/td
>
<
/tr
>
<
tr
data
-
id
=
"id"
>
<
td
class
=
"thumb-col"
>
<
div
class
=
"thumb"
>
<
img
src
=
"/"
>
<
/div
>
<
/td
>
<
td
class
=
"name-col"
>
<
a
href
=
"#"
class
=
"filename"
>
ut
-
logo
-
350
-
150
.
png
<
/a
>
<
div
class
=
"embeddable-xml"
><
/div
>
<
/td
>
<
td
class
=
"date-col"
>
30
October
,
2012
at
07
:
17
PM
<
/td
>
<
td
class
=
"insert-col"
>
<
a
href
=
"#"
class
=
"insert-asset-button"
data
-
markup
=
"<img src='/c4x/Giannattasio/313/asset/ut-logo-350-150.png'/>"
>
Insert
<
/a
>
<
/td
>
<
/tr
>
<
tr
data
-
id
=
"id"
>
<
td
class
=
"thumb-col"
>
<
div
class
=
"thumb"
>
<
img
src
=
"/"
>
<
/div
>
<
/td
>
<
td
class
=
"name-col"
>
<
a
href
=
"#"
class
=
"filename"
>
ut
-
logo
-
350
-
150
.
png
<
/a
>
<
div
class
=
"embeddable-xml"
><
/div
>
<
/td
>
<
td
class
=
"date-col"
>
30
October
,
2012
at
07
:
17
PM
<
/td
>
<
td
class
=
"insert-col"
>
<
a
href
=
"#"
class
=
"insert-asset-button"
data
-
markup
=
"<img src='/c4x/Giannattasio/313/asset/ut-logo-350-150.png'/>"
>
Insert
<
/a
>
<
/td
>
<
/tr
>
<
tr
data
-
id
=
"id"
>
<
td
class
=
"thumb-col"
>
<
div
class
=
"thumb"
>
<
img
src
=
"/"
>
<
/div
>
<
/td
>
<
td
class
=
"name-col"
>
<
a
href
=
"#"
class
=
"filename"
>
ut
-
logo
-
350
-
150
.
png
<
/a
>
<
div
class
=
"embeddable-xml"
><
/div
>
<
/td
>
<
td
class
=
"date-col"
>
30
October
,
2012
at
07
:
17
PM
<
/td
>
<
td
class
=
"insert-col"
>
<
a
href
=
"#"
class
=
"insert-asset-button"
data
-
markup
=
"<img src='/c4x/Giannattasio/313/asset/ut-logo-350-150.png'/>"
>
Insert
<
/a
>
<
/td
>
<
/tr
>
<
tr
data
-
id
=
"id"
>
<
td
class
=
"thumb-col"
>
<
div
class
=
"thumb"
>
<
img
src
=
"/"
>
<
/div
>
<
/td
>
<
td
class
=
"name-col"
>
<
a
href
=
"#"
class
=
"filename"
>
ut
-
logo
-
350
-
150
.
png
<
/a
>
<
div
class
=
"embeddable-xml"
><
/div
>
<
/td
>
<
td
class
=
"date-col"
>
30
October
,
2012
at
07
:
17
PM
<
/td
>
<
td
class
=
"insert-col"
>
<
a
href
=
"#"
class
=
"insert-asset-button"
data
-
markup
=
"<img src='/c4x/Giannattasio/313/asset/ut-logo-350-150.png'/>"
>
Insert
<
/a
>
<
/td
>
<
/tr
>
<
tr
data
-
id
=
"id"
>
<
td
class
=
"thumb-col"
>
<
div
class
=
"thumb"
>
<
img
src
=
"/"
>
<
/div
>
<
/td
>
<
td
class
=
"name-col"
>
<
a
href
=
"#"
class
=
"filename"
>
ut
-
logo
-
350
-
150
.
png
<
/a
>
<
div
class
=
"embeddable-xml"
><
/div
>
<
/td
>
<
td
class
=
"date-col"
>
30
October
,
2012
at
07
:
17
PM
<
/td
>
<
td
class
=
"insert-col"
>
<
a
href
=
"#"
class
=
"insert-asset-button"
data
-
markup
=
"<img src='/c4x/Giannattasio/313/asset/ut-logo-350-150.png'/>"
>
Insert
<
/a
>
<
/td
>
<
/tr
>
<
tr
data
-
id
=
"id"
>
<
td
class
=
"thumb-col"
>
<
div
class
=
"thumb"
>
<
img
src
=
"/"
>
<
/div
>
<
/td
>
<
td
class
=
"name-col"
>
<
a
href
=
"#"
class
=
"filename"
>
ut
-
logo
-
350
-
150
.
png
<
/a
>
<
div
class
=
"embeddable-xml"
><
/div
>
<
/td
>
<
td
class
=
"date-col"
>
30
October
,
2012
at
07
:
17
PM
<
/td
>
<
td
class
=
"insert-col"
>
<
a
href
=
"#"
class
=
"insert-asset-button"
data
-
markup
=
"<img src='/c4x/Giannattasio/313/asset/ut-logo-350-150.png'/>"
>
Insert
<
/a
>
<
/td
>
<
/tr
>
<
/tbody
>
<
/table
>
<
nav
class
=
"pagination wip-box"
>
Page
:
<
ol
class
=
"pages"
>
<
li
>
1
<
/li
>
<
li
><
a
href
=
"#"
>
2
<
/a></
li
>
<
li
><
a
href
=
"#"
>
3
<
/a></
li
>
<
li
><
a
href
=
"#"
>
4
<
/a></
li
>
<
li
><
a
href
=
"#"
>
5
<
/a></
li
>
<
/ol
>
<
a
href
=
"#"
class
=
"next"
>
»
<
/a
>
<
/nav
>
<
/article
>
</script>
<script
type=
"text/template"
id=
"simple-editor-cheatsheet"
>
<
article
class
=
"simple-editor-cheatsheet"
>
...
...
@@ -374,6 +149,20 @@
% endfor
</ul>
</div>
% for type, templates in sorted(component_templates.items()):
<div
class=
"new-component-templates new-component-${type}"
>
<ul
class=
"new-component-template"
>
% for name, location in templates:
<li>
<a
href=
"#"
data-location=
"${location}"
>
<span
class=
"name"
>
${name}
</span>
</a>
</li>
%endfor
</ul>
<a
href=
"#"
class=
"cancel-button"
>
Cancel
</a>
</div>
% endfor
</li>
</ol>
</article>
...
...
cms/templates/widgets/problem-edit.html
View file @
d1124357
<
%
include
file=
"metadata-edit.html"
/>
<section
class=
"problem-editor editor"
>
<div
class=
"row"
>
<div
class=
"editor-bar"
>
<ul
class=
"format-buttons"
>
<li><a
href=
"#"
class=
"multiple-choice-button"
data-tooltip=
"Multiple Choice"
><span
class=
"problem-editor-icon multiple-choice"
></span></a></li>
<li><a
href=
"#"
class=
"checks-button"
data-tooltip=
"Check Multiple"
><span
class=
"problem-editor-icon checks"
></span></a></li>
<li><a
href=
"#"
class=
"string-button"
data-tooltip=
"String Response"
><span
class=
"problem-editor-icon string"
></span></a></li>
<li><a
href=
"#"
class=
"number-button"
data-tooltip=
"Numerical Response"
><span
class=
"problem-editor-icon number"
></span></a></li>
<li><a
href=
"#"
class=
"dropdown-button"
data-tooltip=
"Dropdown"
><span
class=
"problem-editor-icon dropdown"
></span></a></li>
</ul>
<ul
class=
"editor-tabs"
>
<li><a
href=
"#"
class=
"simple-tab tab current"
data-tab=
"simple"
>
Simple
</a></li>
<li><a
href=
"#"
class=
"xml-tab tab"
data-tab=
"xml"
>
XML
</a></li>
<li><a
href=
"#"
class=
"cheatsheet-toggle"
data-tooltip=
"Toggle Cheatsheet"
>
?
</a></li>
</ul>
<div
class=
"row"
>
%if markdown != '' or data == '':
<div
class=
"editor-bar"
>
<ul
class=
"format-buttons"
>
<li><a
href=
"#"
class=
"multiple-choice-button"
data-tooltip=
"Multiple Choice"
><span
class=
"problem-editor-icon multiple-choice"
></span></a></li>
<li><a
href=
"#"
class=
"checks-button"
data-tooltip=
"Check Multiple"
><span
class=
"problem-editor-icon checks"
></span></a></li>
<li><a
href=
"#"
class=
"string-button"
data-tooltip=
"String Response"
><span
class=
"problem-editor-icon string"
></span></a></li>
<li><a
href=
"#"
class=
"number-button"
data-tooltip=
"Numerical Response"
><span
class=
"problem-editor-icon number"
></span></a></li>
<li><a
href=
"#"
class=
"dropdown-button"
data-tooltip=
"Dropdown"
><span
class=
"problem-editor-icon dropdown"
></span></a></li>
</ul>
<ul
class=
"editor-tabs"
>
<li><a
href=
"#"
class=
"simple-tab tab current"
data-tab=
"simple"
>
Simple
</a></li>
<li><a
href=
"#"
class=
"xml-tab tab"
data-tab=
"xml"
>
XML
</a></li>
<li><a
href=
"#"
class=
"cheatsheet-toggle"
data-tooltip=
"Toggle Cheatsheet"
>
?
</a></li>
</ul>
</div>
<textarea
class=
"edit-box"
>
${markdown}
</textarea>
%endif
<textarea
class=
"xml-box"
rows=
"8"
cols=
"40"
>
${data | h}
</textarea>
</div>
<textarea
class=
"edit-box"
>
${markdown}
</textarea>
<textarea
class=
"xml-box"
>
${data | h}
</textarea>
</div>
</section>
common/lib/xmodule/xmodule/js/src/problem/markdown.coffee
View file @
d1124357
class
@
MarkdownEditingDescriptor
extends
XModule
.
Descriptor
constructor
:
(
@
element
)
->
@
edit_box
=
CodeMirror
.
fromTextArea
(
$
(
".
edit
-box"
,
@
element
)[
0
],
{
@
edit_box
=
CodeMirror
.
fromTextArea
(
$
(
".
xml
-box"
,
@
element
)[
0
],
{
mode
:
"xml"
lineNumbers
:
true
lineWrapping
:
true
...
...
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