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
d35b2903
Commit
d35b2903
authored
May 15, 2013
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up editable_metadata_fields.
parent
305b555d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
19 deletions
+12
-19
cms/templates/widgets/metadata-edit.html
+8
-4
common/lib/xmodule/xmodule/mako_module.py
+1
-5
common/lib/xmodule/xmodule/x_module.py
+3
-10
No files found.
cms/templates/widgets/metadata-edit.html
View file @
d35b2903
<
%
<
%
import
hashlib
import
hashlib
import
copy
import
json
import
json
hlskey =
hashlib.md5(module.location.url()).hexdigest()
hlskey =
hashlib.md5(module.location.url()).hexdigest()
%
>
%
>
<
%
showHighLevelSource=
'source_code'
in
json_metadata_data
and
json_metadata_data
['
source_code
']['
explicitly_set
']
%
>
<
%
showHighLevelSource=
'source_code'
in
editable_metadata_fields
and
editable_metadata_fields
['
source_code
']['
explicitly_set
']
%
>
% if 'source_code' in json_metadata_data:
<
%
metadata_field_copy =
copy.deepcopy(editable_metadata_fields)
%
>
<
%
del
json_metadata_data
['
source_code
']
%
>
## Delete 'source_code' field (if it exists) so metadata editor view does not attempt to render it.
% if 'source_code' in editable_metadata_fields:
## source-edit.html needs access to the 'source_code' value, so delete from a copy.
<
%
del
metadata_field_copy
['
source_code
']
%
>
% endif
% endif
<div
class=
"wrapper-comp-settings metadata_edit"
id=
"settings-tab"
data-metadata=
'${json.dumps(
json_metadata_data
)}'
/>
<div
class=
"wrapper-comp-settings metadata_edit"
id=
"settings-tab"
data-metadata=
'${json.dumps(
metadata_field_copy
)}'
/>
% if showHighLevelSource:
% if showHighLevelSource:
<a
href=
"#hls-modal-${hlskey}"
style=
"color:yellow;"
id=
"hls-trig-${hlskey}"
>
Edit High Level Source
</a>
<a
href=
"#hls-modal-${hlskey}"
style=
"color:yellow;"
id=
"hls-trig-${hlskey}"
>
Edit High Level Source
</a>
...
...
common/lib/xmodule/xmodule/mako_module.py
View file @
d35b2903
...
@@ -31,13 +31,9 @@ class MakoModuleDescriptor(XModuleDescriptor):
...
@@ -31,13 +31,9 @@ class MakoModuleDescriptor(XModuleDescriptor):
"""
"""
Return the context to render the mako template with
Return the context to render the mako template with
"""
"""
# TODO: just return a single thing.
[
editable_metadata
,
simplified_metadata
]
=
self
.
editable_metadata_fields
return
{
return
{
'module'
:
self
,
'module'
:
self
,
'editable_metadata_fields'
:
editable_metadata
,
'editable_metadata_fields'
:
self
.
editable_metadata_fields
'json_metadata_data'
:
simplified_metadata
}
}
def
get_html
(
self
):
def
get_html
(
self
):
...
...
common/lib/xmodule/xmodule/x_module.py
View file @
d35b2903
...
@@ -626,8 +626,7 @@ class XModuleDescriptor(XModuleFields, HTMLSnippet, ResourceTemplates, XBlock):
...
@@ -626,8 +626,7 @@ class XModuleDescriptor(XModuleFields, HTMLSnippet, ResourceTemplates, XBlock):
"""
"""
inherited_metadata
=
getattr
(
self
,
'_inherited_metadata'
,
{})
inherited_metadata
=
getattr
(
self
,
'_inherited_metadata'
,
{})
inheritable_metadata
=
getattr
(
self
,
'_inheritable_metadata'
,
{})
inheritable_metadata
=
getattr
(
self
,
'_inheritable_metadata'
,
{})
metadata
=
{}
metadata_fields
=
{}
simple_metadata
=
{}
for
field
in
self
.
fields
:
for
field
in
self
.
fields
:
if
field
.
scope
!=
Scope
.
settings
or
field
in
self
.
non_editable_metadata_fields
:
if
field
.
scope
!=
Scope
.
settings
or
field
in
self
.
non_editable_metadata_fields
:
...
@@ -643,12 +642,6 @@ class XModuleDescriptor(XModuleFields, HTMLSnippet, ResourceTemplates, XBlock):
...
@@ -643,12 +642,6 @@ class XModuleDescriptor(XModuleFields, HTMLSnippet, ResourceTemplates, XBlock):
if
field
.
name
in
inherited_metadata
:
if
field
.
name
in
inherited_metadata
:
explicitly_set
=
False
explicitly_set
=
False
metadata
[
field
.
name
]
=
{
'field'
:
field
,
'value'
:
value
,
'default_value'
:
default_value
,
'inheritable'
:
inheritable
,
'explicitly_set'
:
explicitly_set
}
# We support the following editors:
# We support the following editors:
# 1. A select editor for fields with a list of possible values (includes Booleans).
# 1. A select editor for fields with a list of possible values (includes Booleans).
# 2. Number editor for integers and floats.
# 2. Number editor for integers and floats.
...
@@ -670,7 +663,7 @@ class XModuleDescriptor(XModuleFields, HTMLSnippet, ResourceTemplates, XBlock):
...
@@ -670,7 +663,7 @@ class XModuleDescriptor(XModuleFields, HTMLSnippet, ResourceTemplates, XBlock):
type
=
"Integer"
type
=
"Integer"
elif
isinstance
(
field
,
Float
):
elif
isinstance
(
field
,
Float
):
type
=
"Float"
type
=
"Float"
simple_metadata
[
field
.
name
]
=
{
'field_name'
:
field
.
name
,
metadata_fields
[
field
.
name
]
=
{
'field_name'
:
field
.
name
,
'type'
:
type
,
'type'
:
type
,
'display_name'
:
field
.
display_name
,
'display_name'
:
field
.
display_name
,
'value'
:
field
.
to_json
(
value
),
'value'
:
field
.
to_json
(
value
),
...
@@ -680,7 +673,7 @@ class XModuleDescriptor(XModuleFields, HTMLSnippet, ResourceTemplates, XBlock):
...
@@ -680,7 +673,7 @@ class XModuleDescriptor(XModuleFields, HTMLSnippet, ResourceTemplates, XBlock):
'explicitly_set'
:
explicitly_set
,
'explicitly_set'
:
explicitly_set
,
'help'
:
field
.
help
}
'help'
:
field
.
help
}
return
metadata
,
simple_metadata
return
metadata
_fields
class
DescriptorSystem
(
object
):
class
DescriptorSystem
(
object
):
...
...
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