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
3e9d325a
Commit
3e9d325a
authored
Dec 10, 2012
by
Valera Rozuvan
Committed by
Alexander Kryklia
Jan 15, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GST work in progress.
parent
ae03090f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
4 deletions
+84
-4
common/lib/xmodule/xmodule/gst_module.py
+3
-2
common/lib/xmodule/xmodule/js/src/graphical_slider_tool/gst_main.js
+3
-2
common/lib/xmodule/xmodule/js/src/graphical_slider_tool/inputs.js
+70
-0
common/lib/xmodule/xmodule/js/src/graphical_slider_tool/sliders.js
+1
-0
common/lib/xmodule/xmodule/js/src/graphical_slider_tool/state.js
+7
-0
No files found.
common/lib/xmodule/xmodule/gst_module.py
View file @
3e9d325a
...
@@ -30,6 +30,7 @@ class GraphicalSliderToolModule(XModule):
...
@@ -30,6 +30,7 @@ class GraphicalSliderToolModule(XModule):
resource_string
(
__name__
,
'js/src/graphical_slider_tool/logme.js'
),
resource_string
(
__name__
,
'js/src/graphical_slider_tool/logme.js'
),
resource_string
(
__name__
,
'js/src/graphical_slider_tool/general_methods.js'
),
resource_string
(
__name__
,
'js/src/graphical_slider_tool/general_methods.js'
),
resource_string
(
__name__
,
'js/src/graphical_slider_tool/sliders.js'
),
resource_string
(
__name__
,
'js/src/graphical_slider_tool/sliders.js'
),
resource_string
(
__name__
,
'js/src/graphical_slider_tool/inputs.js'
),
resource_string
(
__name__
,
'js/src/graphical_slider_tool/graph.js'
),
resource_string
(
__name__
,
'js/src/graphical_slider_tool/graph.js'
),
resource_string
(
__name__
,
'js/src/graphical_slider_tool/gst.js'
)
resource_string
(
__name__
,
'js/src/graphical_slider_tool/gst.js'
)
...
@@ -154,8 +155,8 @@ class GraphicalSliderToolModule(XModule):
...
@@ -154,8 +155,8 @@ class GraphicalSliderToolModule(XModule):
inputs
=
[
inputs
]
inputs
=
[
inputs
]
vars
=
[
x
[
'@var'
]
for
x
in
inputs
]
vars
=
[
x
[
'@var'
]
for
x
in
inputs
]
input_div
=
'<
div
class="{element_class}_input" id="{element_id}_input_{var}"
\
input_div
=
'<
span
class="{element_class}_input" id="{element_id}_input_{var}"
\
data-var="{var}">
This is input</div
>'
data-var="{var}">
</span
>'
for
var
in
vars
:
for
var
in
vars
:
html_string
=
re
.
sub
(
r'\$input\s+'
+
var
+
r'\$'
,
html_string
=
re
.
sub
(
r'\$input\s+'
+
var
+
r'\$'
,
...
...
common/lib/xmodule/xmodule/js/src/graphical_slider_tool/gst_main.js
View file @
3e9d325a
...
@@ -4,8 +4,8 @@
...
@@ -4,8 +4,8 @@
define
(
define
(
'GstMain'
,
'GstMain'
,
[
'State'
,
'GeneralMethods'
,
'Sliders'
,
'Graph'
],
[
'State'
,
'GeneralMethods'
,
'Sliders'
,
'
Inputs'
,
'
Graph'
],
function
(
State
,
GeneralMethods
,
Sliders
,
Graph
)
{
function
(
State
,
GeneralMethods
,
Sliders
,
Inputs
,
Graph
)
{
return
GstMain
;
return
GstMain
;
...
@@ -17,6 +17,7 @@ define(
...
@@ -17,6 +17,7 @@ define(
state
=
State
(
gstId
,
config
);
state
=
State
(
gstId
,
config
);
Sliders
(
gstId
,
config
,
state
);
Sliders
(
gstId
,
config
,
state
);
Inputs
(
gstId
,
config
,
state
);
Graph
(
gstId
,
config
,
state
);
Graph
(
gstId
,
config
,
state
);
}
}
...
...
common/lib/xmodule/xmodule/js/src/graphical_slider_tool/inputs.js
0 → 100644
View file @
3e9d325a
// Wrapper for RequireJS. It will make the standard requirejs(), require(), and
// define() functions from Require JS available inside the anonymous function.
(
function
(
requirejs
,
require
,
define
)
{
define
(
'Inputs'
,
[
'logme'
],
function
(
logme
)
{
return
Inputs
;
function
Inputs
(
gstId
,
config
,
state
)
{
logme
(
'Inside "Inputs" module.'
);
logme
(
gstId
,
config
,
state
);
// We will go thorugh all of the inputs, and those that have a valid
// '@var' property will be added to the page as a HTML text input
// element.
if
((
typeof
config
.
inputs
!==
'undefined'
)
&&
(
typeof
config
.
inputs
.
input
!==
'undefined'
))
{
if
(
$
.
isArray
(
config
.
inputs
.
input
))
{
// config.inputs.input is an array
for
(
c1
=
0
;
c1
<
config
.
inputs
.
input
.
length
;
c1
++
)
{
createInput
(
config
.
inputs
.
input
[
c1
]);
}
}
else
if
(
$
.
isPlainObject
(
config
.
inputs
.
input
))
{
// config.inputs.input is an object
createInput
(
config
.
inputs
.
input
);
}
}
function
createInput
(
obj
)
{
var
constName
,
constValue
,
inputDiv
,
textInputDiv
;
if
(
typeof
obj
[
'@var'
]
===
'undefined'
)
{
return
;
}
constName
=
obj
[
'@var'
];
constValue
=
state
.
getConstValue
(
constName
);
if
(
constValue
===
undefined
)
{
constValue
=
0
;
}
inputDiv
=
$
(
'#'
+
gstId
+
'_input_'
+
constName
);
if
(
inputDiv
.
length
===
0
)
{
return
;
}
textInputDiv
=
$
(
'<input type"text" />'
);
textInputDiv
.
width
(
50
);
textInputDiv
.
appendTo
(
inputDiv
);
textInputDiv
.
val
(
constValue
);
textInputDiv
.
bind
(
'change'
,
inputOnChange
);
return
;
function
inputOnChange
(
event
)
{
state
.
setConstValue
(
constName
,
$
(
this
).
val
());
}
}
}
});
// End of wrapper for RequireJS. As you can see, we are passing
// namespaced Require JS variables to an anonymous function. Within
// it, you can use the standard requirejs(), require(), and define()
// functions as if they were in the global namespace.
}(
RequireJS
.
requirejs
,
RequireJS
.
require
,
RequireJS
.
define
));
// End-of: (function (requirejs, require, define)
common/lib/xmodule/xmodule/js/src/graphical_slider_tool/sliders.js
View file @
3e9d325a
...
@@ -104,6 +104,7 @@ define('Sliders', [], function () {
...
@@ -104,6 +104,7 @@ define('Sliders', [], function () {
// Set the new width to the slider.
// Set the new width to the slider.
sliderDiv
.
width
(
sliderWidth
);
sliderDiv
.
width
(
sliderWidth
);
sliderDiv
.
css
(
'display'
,
'inline-block'
);
// Create a jQuery UI slider from the current DIV. We will set
// Create a jQuery UI slider from the current DIV. We will set
// starting parameters, and will also attach a handler to update
// starting parameters, and will also attach a handler to update
...
...
common/lib/xmodule/xmodule/js/src/graphical_slider_tool/state.js
View file @
3e9d325a
...
@@ -107,6 +107,8 @@ define('State', [], function () {
...
@@ -107,6 +107,8 @@ define('State', [], function () {
}
}
function
setConstValue
(
constName
,
constValue
)
{
function
setConstValue
(
constName
,
constValue
)
{
var
inputDiv
;
if
(
constants
.
hasOwnProperty
(
constName
)
===
false
)
{
if
(
constants
.
hasOwnProperty
(
constName
)
===
false
)
{
// If the name of the constant is not tracked by state, return an
// If the name of the constant is not tracked by state, return an
// 'undefined' value.
// 'undefined' value.
...
@@ -123,6 +125,11 @@ define('State', [], function () {
...
@@ -123,6 +125,11 @@ define('State', [], function () {
if
(
plotDiv
!==
undefined
)
{
if
(
plotDiv
!==
undefined
)
{
plotDiv
.
trigger
(
'update_plot'
);
plotDiv
.
trigger
(
'update_plot'
);
}
}
inputDiv
=
$
(
'#'
+
gstId
+
'_input_'
+
constName
).
children
(
'input'
);
if
(
inputDiv
.
length
!==
0
)
{
inputDiv
.
val
(
constValue
);
}
}
}
function
addConstFromInput
(
obj
)
{
function
addConstFromInput
(
obj
)
{
...
...
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