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
d93bf63d
Commit
d93bf63d
authored
Oct 04, 2012
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save display_name and subtitle metadata
parent
29c142e3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
3 deletions
+35
-3
cms/static/js/base.js
+32
-0
cms/templates/edit_subsection.html
+3
-3
No files found.
cms/static/js/base.js
View file @
d93bf63d
...
...
@@ -25,8 +25,40 @@ $(document).ready(function() {
$
(
'.upload-modal .close-button'
).
bind
(
'click'
,
hideModal
);
$
(
'.unit .item-actions .delete-button'
).
bind
(
'click'
,
deleteUnit
);
$
(
'.new-unit-item'
).
bind
(
'click'
,
createNewUnit
);
$
(
'.save-subsection'
).
bind
(
'click'
,
saveSubsection
);
});
function
saveSubsection
(
e
)
{
e
.
preventDefault
();
var
id
=
$
(
this
).
data
(
'id'
);
// pull all metadata editable fields on page
var
metadata_fields
=
$
(
'input[data-metadata-name]'
);
metadata
=
{};
for
(
var
i
=
0
;
i
<
metadata_fields
.
length
;
i
++
)
{
el
=
metadata_fields
[
i
];
metadata
[
$
(
el
).
data
(
"metadata-name"
)]
=
el
.
value
;
}
children
=
[];
$
.
ajax
({
url
:
"/save_item"
,
type
:
"POST"
,
dataType
:
"json"
,
contentType
:
"application/json"
,
data
:
JSON
.
stringify
({
'id'
:
id
,
'metadata'
:
metadata
,
'data'
:
null
,
'children'
:
children
}),
success
:
function
()
{
alert
(
'Your changes have been saved.'
);
},
error
:
function
()
{
alert
(
'There has been an error while saving your changes.'
);
}
});
}
function
createNewUnit
(
e
)
{
e
.
preventDefault
();
...
...
cms/templates/edit_subsection.html
View file @
d93bf63d
...
...
@@ -12,11 +12,11 @@
<article
class=
"subsection-body window"
>
<div
class=
"subsection-name-input"
>
<label>
Display Name:
</label>
<input
type=
"text"
value=
"
Welcome to 6.002x"
class=
"subsection-display-name-input"
/>
<input
type=
"text"
value=
"
${subsection.metadata['display_name']}"
class=
"subsection-display-name-input"
data-metadata-name=
"display_name"
/>
</div>
<div>
<label>
Subtitle:
</label>
<input
type=
"text"
value=
"
Lecture Sequence"
class=
"unit-subtitle"
/>
<input
type=
"text"
value=
"
${subsection.metadata['subtitle'] if 'subtitle' in subsection.metadata else ''}"
class=
"unit-subtitle"
data-metadata-name=
"subtitle"
/>
</div>
<div
class=
"unit-list"
>
<label>
Units:
</label>
...
...
@@ -55,7 +55,7 @@
<a
href=
"#"
class=
"toggle-off"
>
hide
</a><a
href=
"#"
class=
"large-toggle"
></a><a
href=
"#"
class=
"toggle-on"
>
show
</a>
</div>
<div
class=
"row unit-actions"
>
<a
href=
"#"
class=
"save-button"
>
Save
</a>
<a
href=
"#"
class=
"save-button
save-subsection"
data-id=
"${subsection.location}
"
>
Save
</a>
<a
href=
"preview.html"
target=
"_blank"
class=
"preview-button"
>
Preview
</a>
</div>
</div>
...
...
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