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
d5576986
Commit
d5576986
authored
Oct 05, 2012
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check if 'delete metadata field' is not in the list of system metadata
parent
95e15c44
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
8 deletions
+22
-8
cms/djangoapps/contentstore/views.py
+5
-4
cms/static/js/base.js
+3
-4
common/static/js/vendor/timepicker/datepair.js
+12
-0
common/static/js/vendor/timepicker/jquery.timepicker.js
+2
-0
No files found.
cms/djangoapps/contentstore/views.py
View file @
d5576986
...
...
@@ -448,14 +448,15 @@ def save_item(request):
# fetch original
existing_item
=
modulestore
()
.
get_item
(
item_location
)
logging
.
debug
(
posted_metadata
)
# update existing metadata with submitted metadata (which can be partial)
# IMPORTANT NOTE: if the client passed pack 'null' (None) for a piece of metadata that means 'remove it'
for
metadata_key
in
posted_metadata
.
keys
():
if
posted_metadata
[
metadata_key
]
is
None
:
# NOTE: We don't want clients to be able to delete 'system metadata' which are not intended to be user
# editable
if
posted_metadata
[
metadata_key
]
is
None
and
metadata_key
not
in
existing_item
.
system_metadata_fields
:
# remove both from passed in collection as well as the collection read in from the modulestore
del
existing_item
.
metadata
[
metadata_key
]
if
metadata_key
in
existing_item
.
metadata
:
del
existing_item
.
metadata
[
metadata_key
]
del
posted_metadata
[
metadata_key
]
# overlay the new metadata over the modulestore sourced collection to support partial updates
...
...
cms/static/js/base.js
View file @
d5576986
...
...
@@ -95,11 +95,10 @@ function saveSubsection(e) {
metadata
[
$
(
el
).
data
(
"metadata-name"
)]
=
el
.
value
;
}
// OK, we have some metadata (namely 'Release Date' (aka 'start') and 'Due Date') which has been normalized in the UI
// we have to piece it back together. Unfortunate 'start' and 'due' use different string formatters. Rather than try to
// replicate the string formatting which is used in the backend here in JS, let's just pass back a unified format
// and let the server re-format into the expected persisted format
// Piece back together the date/time UI elements into one date/time string
// NOTE: our various "date/time" metadata elements don't always utilize the same formatting string
// so make sure we're passing back the correct format
metadata
[
'start'
]
=
getEdxTimeFromDateTimeInputs
(
'start_date'
,
'start_time'
);
metadata
[
'due'
]
=
getEdxTimeFromDateTimeInputs
(
'due_date'
,
'due_time'
,
'MMMM dd HH:mm'
);
...
...
common/static/js/vendor/timepicker/datepair.js
View file @
d5576986
/************************
datepair.js
This is a component of the jquery-timepicker plugin
http://jonthornton.github.com/jquery-timepicker/
requires jQuery 1.6+
version: 1.2.2
************************/
$
(
function
()
{
$
(
'.datepair input.date'
).
each
(
function
(){
...
...
common/static/js/vendor/timepicker/jquery.timepicker.js
View file @
d5576986
...
...
@@ -3,6 +3,8 @@ jquery-timepicker
http://jonthornton.github.com/jquery-timepicker/
requires jQuery 1.6+
version: 1.2.2
************************/
...
...
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