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
5d41e2a9
Commit
5d41e2a9
authored
May 30, 2013
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates from code review.
parent
b2fe7f5c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
16 deletions
+11
-16
cms/static/js/views/metadata_editor_view.js
+9
-14
cms/templates/js/metadata-editor.underscore
+1
-1
cms/templates/widgets/metadata-edit.html
+1
-1
No files found.
cms/static/js/views/metadata_editor_view.js
View file @
5d41e2a9
...
...
@@ -10,7 +10,7 @@ CMS.Views.Metadata.Editor = Backbone.View.extend({
}
this
.
template
=
_
.
template
(
tpl
);
this
.
$el
.
html
(
this
.
template
({
metadata_entries
:
this
.
model
.
attributes
}));
this
.
$el
.
html
(
this
.
template
({
numEntries
:
this
.
model
.
keys
().
length
}));
var
counter
=
0
;
// Sort entries by display name.
...
...
@@ -79,10 +79,11 @@ CMS.Views.Metadata.AbstractEditor = Backbone.View.extend({
// Model is CMS.Models.Metadata.
initialize
:
function
()
{
var
self
=
this
;
var
templateName
=
this
.
getTemplateName
();
var
templateName
=
_
.
result
(
this
,
'templateName'
);
// Backbone model cid is only unique within the collection.
this
.
uniqueId
=
_
.
uniqueId
(
templateName
+
"_"
);
var
tpl
=
$
(
"#"
+
templateName
).
text
()
;
var
tpl
=
document
.
getElementById
(
templateName
).
text
;
if
(
!
tpl
)
{
console
.
error
(
"Couldn't load template: "
+
templateName
);
}
...
...
@@ -92,9 +93,9 @@ CMS.Views.Metadata.AbstractEditor = Backbone.View.extend({
},
/**
*
Returns the ID/name of the template. Subclasses should implement this method
.
*
The ID/name of the template. Subclasses must override this
.
*/
getTemplateName
:
function
()
{}
,
templateName
:
''
,
/**
* Returns the value currently displayed in the editor/view. Subclasses should implement this method.
...
...
@@ -170,9 +171,7 @@ CMS.Views.Metadata.String = CMS.Views.Metadata.AbstractEditor.extend({
"click .setting-clear"
:
"clear"
},
getTemplateName
:
function
()
{
return
"metadata-string-entry"
;
},
templateName
:
"metadata-string-entry"
,
getValueFromEditor
:
function
()
{
return
this
.
$el
.
find
(
'#'
+
this
.
uniqueId
).
val
();
...
...
@@ -232,9 +231,7 @@ CMS.Views.Metadata.Number = CMS.Views.Metadata.AbstractEditor.extend({
}
},
getTemplateName
:
function
()
{
return
"metadata-number-entry"
;
},
templateName
:
"metadata-number-entry"
,
getValueFromEditor
:
function
()
{
return
this
.
$el
.
find
(
'#'
+
this
.
uniqueId
).
val
();
...
...
@@ -288,9 +285,7 @@ CMS.Views.Metadata.Option = CMS.Views.Metadata.AbstractEditor.extend({
"click .setting-clear"
:
"clear"
},
getTemplateName
:
function
()
{
return
"metadata-option-entry"
;
},
templateName
:
"metadata-option-entry"
,
getValueFromEditor
:
function
()
{
var
selectedText
=
this
.
$el
.
find
(
'#'
+
this
.
uniqueId
).
find
(
":selected"
).
text
();
...
...
cms/templates/js/metadata-editor.underscore
View file @
5d41e2a9
<ul class="list-input settings-list">
<% _.each(
metadata_entries, function(entry
) { %>
<% _.each(
_.range(numEntries), function(
) { %>
<li class="field comp-setting-entry metadata_entry" id="settings-listing">
</li>
<% }) %>
...
...
cms/templates/widgets/metadata-edit.html
View file @
5d41e2a9
...
...
@@ -26,7 +26,7 @@
</script>
<
%
showHighLevelSource=
'source_code'
in
editable_metadata_fields
and
editable_metadata_fields
['
source_code
']['
explicitly_set
']
%
>
<
%
metadata_field_copy =
copy.
deep
copy(editable_metadata_fields)
%
>
<
%
metadata_field_copy =
copy.copy(editable_metadata_fields)
%
>
## 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.
...
...
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