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
17750a7d
Commit
17750a7d
authored
May 14, 2013
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use min, max, and step values from server.
parent
5bd0442f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
3 deletions
+35
-3
cms/static/client_templates/metadata_number_entry.html
+1
-1
cms/static/js/models/metadata_model.js
+6
-1
cms/static/js/views/metadata_editor_view.js
+27
-0
common/lib/xmodule/xmodule/capa_module.py
+1
-1
No files found.
cms/static/client_templates/metadata_number_entry.html
View file @
17750a7d
<div
class=
"wrapper-comp-setting"
>
<label
class=
"label setting-label"
for=
"<%= uniqueId %>"
><
%=
model
.
get
('
display_name
')
%
></label>
<input
class=
"input setting-input"
type=
"number"
min=
"1"
max=
"10"
step=
"1"
id=
"<%= uniqueId %>"
value=
'<%= model.get("value") %>'
/>
<input
class=
"input setting-input"
type=
"number"
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><span
class=
"sr"
>
Clear Value
</span>
</button>
...
...
cms/static/js/models/metadata_model.js
View file @
17750a7d
...
...
@@ -8,7 +8,8 @@ CMS.Models.Metadata = Backbone.Model.extend({
"value"
:
null
,
"explicitly_set"
:
null
,
"default_value"
:
null
,
"options"
:
null
"options"
:
null
,
"type"
:
null
},
initialize
:
function
()
{
...
...
@@ -55,6 +56,10 @@ CMS.Models.Metadata = Backbone.Model.extend({
return
this
.
get
(
'options'
);
},
getType
:
function
()
{
return
this
.
get
(
'type'
);
},
clear
:
function
()
{
this
.
set
(
'explicitly_set'
,
false
);
this
.
set
(
'value'
,
this
.
get
(
'default_value'
));
...
...
cms/static/js/views/metadata_editor_view.js
View file @
17750a7d
...
...
@@ -159,6 +159,33 @@ CMS.Views.Metadata.Number = CMS.Views.Metadata.AbstractEditor.extend({
"click .setting-clear"
:
"clear"
},
render
:
function
()
{
CMS
.
Views
.
Metadata
.
AbstractEditor
.
prototype
.
render
.
apply
(
this
);
if
(
!
this
.
inputAttributesSet
)
{
var
min
=
"min"
;
var
max
=
"max"
;
var
step
=
"step"
;
var
options
=
this
.
model
.
getOptions
();
if
(
options
.
hasOwnProperty
(
min
))
{
this
.
$el
.
find
(
'input'
).
attr
(
min
,
options
[
min
].
toString
());
}
if
(
options
.
hasOwnProperty
(
max
))
{
this
.
$el
.
find
(
'input'
).
attr
(
max
,
options
[
max
].
toString
());
}
var
stepValue
=
undefined
;
if
(
options
.
hasOwnProperty
(
step
))
{
stepValue
=
options
[
step
].
toString
();
}
else
if
(
this
.
model
.
getType
()
===
'Integer'
)
{
stepValue
=
"1"
;
}
if
(
stepValue
!==
undefined
)
{
this
.
$el
.
find
(
'input'
).
attr
(
step
,
stepValue
);
}
this
.
inputAttributesSet
=
true
;
}
},
getTemplateName
:
function
()
{
return
"metadata_number_entry"
;
},
...
...
common/lib/xmodule/xmodule/capa_module.py
View file @
17750a7d
...
...
@@ -89,7 +89,7 @@ class CapaFields(object):
seed
=
StringyInteger
(
help
=
"Random seed for this student"
,
scope
=
Scope
.
user_state
)
weight
=
StringyFloat
(
display_name
=
"Problem Weight"
,
help
=
"Specifies the number of points the problem is worth. If unset, each response field in the problem is worth one point."
,
values
=
{
"min"
:
0
},
values
=
{
"min"
:
0
,
"step"
:
".1"
},
scope
=
Scope
.
settings
)
markdown
=
String
(
help
=
"Markdown source of this module"
,
scope
=
Scope
.
settings
)
source_code
=
String
(
help
=
"Source code for LaTeX and Word problems. This feature is not well-supported."
,
...
...
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