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
fd52980a
Commit
fd52980a
authored
May 10, 2013
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Option view, changes getting persisted.
parent
04bb7335
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
69 additions
and
14 deletions
+69
-14
cms/static/client_templates/metadata_option_entry.html
+12
-0
cms/static/client_templates/metadata_string_entry.html
+2
-3
cms/static/js/views/metadata_editor_view.js
+11
-6
cms/static/js/views/metadata_option_view.js
+32
-0
cms/static/js/views/metadata_string_view.js
+5
-4
common/lib/xmodule/xmodule/capa_module.py
+2
-1
common/lib/xmodule/xmodule/x_module.py
+5
-0
No files found.
cms/static/client_templates/metadata_option_entry.html
View file @
fd52980a
<div
class=
"wrapper-comp-setting"
>
<label
class=
"label setting-label"
for=
"<%= uniqueId %>"
><
%=
model
.
get
('
display_name
')
%
></label>
<select
class=
"input setting-input"
id=
"<%= uniqueId %>"
name=
"<%= model.get('display_name') %>"
>
<
%
_
.
each
(
model
.
get
('
options
'),
function
(
option
)
{
%
>
<option
value=
"<%= option %>"
><
%=
option
%
></option>
<
%
})
%
>
</select>
<button
class=
"action setting-clear inactive"
type=
"button"
name=
"setting-clear"
value=
"Clear"
data-tooltip=
"Clear"
>
<i
class=
"ss-icon ss-symbolicons-block undo"
>
↩
</i>
</button>
</div>
<span
class=
"tip setting-help"
><
%=
model
.
get
('
help
')
%
></span>
cms/static/client_templates/metadata_string_entry.html
View file @
fd52980a
<div
class=
"wrapper-comp-setting"
>
<label
class=
"label setting-label"
for=
"setting-discussion_category"
><
%=
model
.
get
('
display_name
')
%
></label>
<input
class=
"input setting-input"
type=
"text"
id=
"setting-discussion_category"
value=
'<%= model.get("value") %>'
/>
<!--button clickable if is-set -->
<label
class=
"label setting-label"
for=
"<%= uniqueId %>"
><
%=
model
.
get
('
display_name
')
%
></label>
<input
class=
"input setting-input"
type=
"text"
id=
"<%= uniqueId %>"
value=
'<%= model.get("value") %>'
/>
<button
class=
"action setting-clear inactive"
type=
"button"
name=
"setting-clear"
value=
"Clear"
data-tooltip=
"Clear"
>
<i
class=
"ss-icon ss-symbolicons-block undo"
>
↩
</i>
</button>
...
...
cms/static/js/views/metadata_editor_view.js
View file @
fd52980a
...
...
@@ -19,12 +19,17 @@ CMS.Views.Metadata.Editor = Backbone.View.extend({
var
counter
=
0
;
_
.
each
(
self
.
model
.
attributes
,
function
(
item
,
key
)
{
self
.
views
[
key
]
=
new
CMS
.
Views
.
Metadata
.
Generic
({
el
:
self
.
$el
.
find
(
'.metadata_entry'
)[
counter
],
model
:
new
CMS
.
Models
.
Metadata
(
item
)
}
);
counter
+=
1
;
var
data
=
{
el
:
self
.
$el
.
find
(
'.metadata_entry'
)[
counter
++
],
model
:
new
CMS
.
Models
.
Metadata
(
item
)
};
if
(
item
.
options
.
length
>
0
)
{
self
.
views
[
key
]
=
new
CMS
.
Views
.
Metadata
.
Option
(
data
);
}
else
{
self
.
views
[
key
]
=
new
CMS
.
Views
.
Metadata
.
String
(
data
);
}
});
}
);
...
...
cms/static/js/views/metadata_option_view.js
View file @
fd52980a
if
(
!
CMS
.
Views
[
'Metadata'
])
CMS
.
Views
.
Metadata
=
{};
CMS
.
Views
.
Metadata
.
Option
=
Backbone
.
View
.
extend
({
// Model class ...
events
:
{
},
initialize
:
function
()
{
var
self
=
this
;
this
.
uniqueId
=
_
.
uniqueId
(
'metadata_option_entry_'
);
// instantiates an editor template for each update in the collection
window
.
templateLoader
.
loadRemoteTemplate
(
"metadata_option_entry"
,
"/static/client_templates/metadata_option_entry.html"
,
function
(
raw_template
)
{
self
.
template
=
_
.
template
(
raw_template
);
self
.
$el
.
append
(
self
.
template
({
model
:
self
.
model
,
uniqueId
:
self
.
uniqueId
}));
$
(
'#'
+
self
.
uniqueId
+
" option"
).
filter
(
function
()
{
return
$
(
this
).
text
()
===
self
.
model
.
get
(
'value'
);
}).
prop
(
'selected'
,
true
);
}
);
},
modified
:
function
()
{
return
this
.
getValue
()
!==
this
.
model
.
getOriginalValue
();
},
getValue
:
function
()
{
return
this
.
$el
.
find
(
'#'
+
this
.
uniqueId
).
find
(
":selected"
).
text
();
}
});
cms/static/js/views/metadata_string_view.js
View file @
fd52980a
if
(
!
CMS
.
Views
[
'Metadata'
])
CMS
.
Views
.
Metadata
=
{};
CMS
.
Views
.
Metadata
.
Generic
=
Backbone
.
View
.
extend
({
CMS
.
Views
.
Metadata
.
String
=
Backbone
.
View
.
extend
({
// Model class ...
events
:
{
...
...
@@ -8,12 +8,13 @@ CMS.Views.Metadata.Generic = Backbone.View.extend({
initialize
:
function
()
{
var
self
=
this
;
this
.
uniqueId
=
_
.
uniqueId
(
'metadata_string_entry_'
);
// instantiates an editor template for each update in the collection
window
.
templateLoader
.
loadRemoteTemplate
(
"metadata_entry"
,
window
.
templateLoader
.
loadRemoteTemplate
(
"metadata_
string_
entry"
,
"/static/client_templates/metadata_string_entry.html"
,
function
(
raw_template
)
{
self
.
template
=
_
.
template
(
raw_template
);
self
.
$el
.
append
(
self
.
template
({
model
:
self
.
model
}));
self
.
$el
.
append
(
self
.
template
({
model
:
self
.
model
,
uniqueId
:
self
.
uniqueId
}));
}
);
},
...
...
@@ -23,6 +24,6 @@ CMS.Views.Metadata.Generic = Backbone.View.extend({
},
getValue
:
function
()
{
return
this
.
$el
.
find
(
'
.editor'
).
val
();
return
this
.
$el
.
find
(
'
#'
+
this
.
uniqueId
).
val
();
}
});
common/lib/xmodule/xmodule/capa_module.py
View file @
fd52980a
...
...
@@ -68,7 +68,8 @@ class CapaFields(object):
showanswer
=
String
(
help
=
"When to show the problem answer to the student"
,
scope
=
Scope
.
settings
,
default
=
"closed"
,
values
=
[
"answered"
,
"always"
,
"attempted"
,
"closed"
,
"never"
])
force_save_button
=
Boolean
(
help
=
"Whether to force the save button to appear on the page"
,
scope
=
Scope
.
settings
,
default
=
False
)
rerandomize
=
Randomization
(
help
=
"When to rerandomize the problem"
,
default
=
"always"
,
scope
=
Scope
.
settings
)
rerandomize
=
Randomization
(
help
=
"When to rerandomize the problem"
,
default
=
"always"
,
scope
=
Scope
.
settings
,
values
=
[
"always"
,
"onreset"
,
"never"
,
"per_student"
])
data
=
String
(
help
=
"XML data for the problem"
,
scope
=
Scope
.
content
)
correct_map
=
Object
(
help
=
"Dictionary with the correctness of current student answers"
,
scope
=
Scope
.
user_state
,
default
=
{})
input_state
=
Object
(
help
=
"Dictionary for maintaining the state of inputtypes"
,
scope
=
Scope
.
user_state
)
...
...
common/lib/xmodule/xmodule/x_module.py
View file @
fd52980a
...
...
@@ -648,8 +648,13 @@ class XModuleDescriptor(XModuleFields, HTMLSnippet, ResourceTemplates, XBlock):
'inheritable'
:
inheritable
,
'explicitly_set'
:
explicitly_set
}
values
=
[]
if
field
.
values
is
None
else
field
.
values
for
index
,
choice
in
enumerate
(
values
):
values
[
index
]
=
field
.
to_json
(
choice
)
simple_metadata
[
field
.
name
]
=
{
'value'
:
field
.
to_json
(
value
),
'display_name'
:
field
.
display_name
,
'options'
:
values
,
'default_value'
:
field
.
to_json
(
default_value
),
'inheritable'
:
inheritable
,
'explicitly_set'
:
explicitly_set
,
...
...
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