Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
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-ora2
Commits
94fe8e3a
Commit
94fe8e3a
authored
Dec 09, 2014
by
Usman Khalid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Studio editor can edit multiple prompts.
TNL-708
parent
b784a1c5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
233 additions
and
40 deletions
+233
-40
openassessment/xblock/static/js/openassessment-lms.min.js
+0
-0
openassessment/xblock/static/js/openassessment-studio.min.js
+0
-0
openassessment/xblock/static/js/src/oa_server.js
+1
-1
openassessment/xblock/static/js/src/studio/oa_container_item.js
+92
-0
openassessment/xblock/static/js/src/studio/oa_edit.js
+9
-5
openassessment/xblock/static/js/src/studio/oa_edit_prompt.js
+0
-34
openassessment/xblock/static/js/src/studio/oa_edit_prompts.js
+131
-0
No files found.
openassessment/xblock/static/js/openassessment-lms.min.js
View file @
94fe8e3a
This diff is collapsed.
Click to expand it.
openassessment/xblock/static/js/openassessment-studio.min.js
View file @
94fe8e3a
This diff is collapsed.
Click to expand it.
openassessment/xblock/static/js/src/oa_server.js
View file @
94fe8e3a
...
@@ -445,7 +445,7 @@ if (typeof OpenAssessment.Server == "undefined" || !OpenAssessment.Server) {
...
@@ -445,7 +445,7 @@ if (typeof OpenAssessment.Server == "undefined" || !OpenAssessment.Server) {
updateEditorContext
:
function
(
kwargs
)
{
updateEditorContext
:
function
(
kwargs
)
{
var
url
=
this
.
url
(
'update_editor_context'
);
var
url
=
this
.
url
(
'update_editor_context'
);
var
payload
=
JSON
.
stringify
({
var
payload
=
JSON
.
stringify
({
prompt
:
kwargs
.
prompt
,
prompt
s
:
kwargs
.
prompts
,
feedback_prompt
:
kwargs
.
feedbackPrompt
,
feedback_prompt
:
kwargs
.
feedbackPrompt
,
feedback_default_text
:
kwargs
.
feedback_default_text
,
feedback_default_text
:
kwargs
.
feedback_default_text
,
title
:
kwargs
.
title
,
title
:
kwargs
.
title
,
...
...
openassessment/xblock/static/js/src/studio/oa_container_item.js
View file @
94fe8e3a
...
@@ -65,6 +65,98 @@ OpenAssessment.ItemUtilities = {
...
@@ -65,6 +65,98 @@ OpenAssessment.ItemUtilities = {
};
};
/**
/**
The Prompt Class is used to construct and maintain references to prompts from within a prompts
container object. Constructs a new Prompt element.
Args:
element (OpenAssessment.Container): The container that the prompt is a member of.
notifier (OpenAssessment.Notifier): Used to send notifications of updates to prompts.
Returns:
OpenAssessment.Prompt
**/
OpenAssessment
.
Prompt
=
function
(
element
,
notifier
)
{
this
.
element
=
element
;
this
.
notifier
=
notifier
;
};
OpenAssessment
.
Prompt
.
prototype
=
{
/**
Finds the values currently entered in the Prompts's fields, and returns them.
Returns:
object literal of the form:
{
'uuid': 'djn98jr4inu',
'description': 'Write a nice long essay about anything.'
}
**/
getFieldValues
:
function
()
{
var
fields
=
{
description
:
this
.
description
()
};
// New prompts won't have unique uuids assigned.
// By convention, we exclude the "uuid" key from the JSON dict
// sent to the server, and the server will assign a unique uuid.
var
uuid
=
OpenAssessment
.
Fields
.
stringField
(
$
(
'.openassessment_prompt_uuid'
,
this
.
element
)
);
if
(
uuid
!==
""
)
{
fields
.
uuid
=
uuid
;
}
return
fields
;
},
/**
Get or set the description of the prompt.
Args:
text (string, optional): If provided, set the description of the prompt.
Returns:
string
**/
description
:
function
(
text
)
{
var
sel
=
$
(
'.openassessment_prompt_description'
,
this
.
element
);
return
OpenAssessment
.
Fields
.
stringField
(
sel
,
text
);
},
addHandler
:
function
(){},
addEventListeners
:
function
()
{},
removeHandler
:
function
()
{},
updateHandler
:
function
()
{},
/**
Mark validation errors.
Returns:
Boolean indicating whether the option is valid.
**/
validate
:
function
()
{
return
true
;
},
/**
Return a list of validation errors visible in the UI.
Mainly useful for testing.
Returns:
list of strings
**/
validationErrors
:
function
()
{
return
[];
},
/**
Clear all validation errors from the UI.
**/
clearValidationErrors
:
function
()
{}
};
/**
The RubricOption Class used to construct and maintain references to rubric options from within an options
The RubricOption Class used to construct and maintain references to rubric options from within an options
container object. Constructs a new RubricOption element.
container object. Constructs a new RubricOption element.
...
...
openassessment/xblock/static/js/src/studio/oa_edit.js
View file @
94fe8e3a
...
@@ -26,8 +26,8 @@ OpenAssessment.StudioView = function(runtime, element, server) {
...
@@ -26,8 +26,8 @@ OpenAssessment.StudioView = function(runtime, element, server) {
this
.
alert
=
new
OpenAssessment
.
ValidationAlert
().
install
();
this
.
alert
=
new
OpenAssessment
.
ValidationAlert
().
install
();
// Initialize the prompt tab view
// Initialize the prompt tab view
this
.
prompt
View
=
new
OpenAssessment
.
EditPrompt
View
(
this
.
prompt
sView
=
new
OpenAssessment
.
EditPrompts
View
(
$
(
"#oa_prompt_editor_wrapper"
,
this
.
element
).
get
(
0
)
$
(
"#oa_prompt
s
_editor_wrapper"
,
this
.
element
).
get
(
0
)
);
);
// Initialize the settings tab view
// Initialize the settings tab view
...
@@ -185,7 +185,7 @@ OpenAssessment.StudioView.prototype = {
...
@@ -185,7 +185,7 @@ OpenAssessment.StudioView.prototype = {
var
view
=
this
;
var
view
=
this
;
this
.
server
.
updateEditorContext
({
this
.
server
.
updateEditorContext
({
prompt
:
view
.
promptView
.
promptText
(),
prompt
s
:
view
.
promptsView
.
promptsDefinition
(),
feedbackPrompt
:
view
.
rubricView
.
feedbackPrompt
(),
feedbackPrompt
:
view
.
rubricView
.
feedbackPrompt
(),
feedback_default_text
:
view
.
rubricView
.
feedback_default_text
(),
feedback_default_text
:
view
.
rubricView
.
feedback_default_text
(),
criteria
:
view
.
rubricView
.
criteriaDefinition
(),
criteria
:
view
.
rubricView
.
criteriaDefinition
(),
...
@@ -236,7 +236,8 @@ OpenAssessment.StudioView.prototype = {
...
@@ -236,7 +236,8 @@ OpenAssessment.StudioView.prototype = {
validate
:
function
()
{
validate
:
function
()
{
var
settingsValid
=
this
.
settingsView
.
validate
();
var
settingsValid
=
this
.
settingsView
.
validate
();
var
rubricValid
=
this
.
rubricView
.
validate
();
var
rubricValid
=
this
.
rubricView
.
validate
();
return
settingsValid
&&
rubricValid
;
var
promptsValid
=
this
.
promptsView
.
validate
();
return
settingsValid
&&
rubricValid
&&
promptsValid
;
},
},
/**
/**
...
@@ -249,7 +250,9 @@ OpenAssessment.StudioView.prototype = {
...
@@ -249,7 +250,9 @@ OpenAssessment.StudioView.prototype = {
**/
**/
validationErrors
:
function
()
{
validationErrors
:
function
()
{
return
this
.
settingsView
.
validationErrors
().
concat
(
return
this
.
settingsView
.
validationErrors
().
concat
(
this
.
rubricView
.
validationErrors
()
this
.
rubricView
.
validationErrors
().
concat
(
this
.
promptsView
.
validationErrors
()
)
);
);
},
},
...
@@ -259,6 +262,7 @@ OpenAssessment.StudioView.prototype = {
...
@@ -259,6 +262,7 @@ OpenAssessment.StudioView.prototype = {
clearValidationErrors
:
function
()
{
clearValidationErrors
:
function
()
{
this
.
settingsView
.
clearValidationErrors
();
this
.
settingsView
.
clearValidationErrors
();
this
.
rubricView
.
clearValidationErrors
();
this
.
rubricView
.
clearValidationErrors
();
this
.
promptsView
.
clearValidationErrors
();
},
},
};
};
...
...
openassessment/xblock/static/js/src/studio/oa_edit_prompt.js
deleted
100644 → 0
View file @
b784a1c5
/**
Editing interface for the rubric prompt.
Args:
element (DOM element): The DOM element representing this view.
Returns:
OpenAssessment.EditPromptView
**/
OpenAssessment
.
EditPromptView
=
function
(
element
)
{
this
.
element
=
element
;
};
OpenAssessment
.
EditPromptView
.
prototype
=
{
/**
Get or set the text of the prompt.
Args:
text (string, optional): If provided, set the text of the prompt.
Returns:
string
**/
promptText
:
function
(
text
)
{
var
sel
=
$
(
'#openassessment_prompt_editor'
,
this
.
element
);
return
OpenAssessment
.
Fields
.
stringField
(
sel
,
text
);
},
};
\ No newline at end of file
openassessment/xblock/static/js/src/studio/oa_edit_prompts.js
0 → 100644
View file @
94fe8e3a
/**
Editing interface for the prompts.
Args:
element (DOM element): The DOM element representing this view.
Returns:
OpenAssessment.EditPromptsView
**/
OpenAssessment
.
EditPromptsView
=
function
(
element
)
{
this
.
element
=
element
;
this
.
promptsContainer
=
new
OpenAssessment
.
Container
(
OpenAssessment
.
Prompt
,
{
containerElement
:
$
(
"#openassessment_prompts_list"
,
this
.
element
).
get
(
0
),
templateElement
:
$
(
"#openassessment_prompt_template"
,
this
.
element
).
get
(
0
),
addButtonElement
:
$
(
"#openassessment_prompts_add_prompt"
,
this
.
element
).
get
(
0
),
removeButtonClass
:
"openassessment_prompt_remove_button"
,
containerItemClass
:
"openassessment_prompt"
}
);
this
.
promptsContainer
.
addEventListeners
();
};
OpenAssessment
.
EditPromptsView
.
prototype
=
{
/**
Construct a list of prompts definitions from the editor UI.
Returns:
list of prompt objects
Example usage:
>>> editPromptsView.promptsDefinition();
[
{
uuid: "cfvgbh657",
description: "Description",
order_num: 0,
},
...
]
**/
promptsDefinition
:
function
()
{
var
prompts
=
this
.
promptsContainer
.
getItemValues
();
// Add order_num fields for prompts
for
(
var
prompt_idx
=
0
;
prompt_idx
<
prompts
.
length
;
prompt_idx
++
)
{
var
prompt
=
prompts
[
prompt_idx
];
prompt
.
order_num
=
prompt_idx
;
}
return
prompts
;
},
/**
Add a new prompt.
Uses a client-side template to create the new prompt.
**/
addPrompt
:
function
()
{
this
.
promptsContainer
.
add
();
},
/**
Remove a prompt.
Args:
item (OpenAssessment.RubricCriterion): The criterion item to remove.
**/
removePrompt
:
function
(
item
)
{
this
.
promptsContainer
.
remove
(
item
);
},
/**
Retrieve all prompts.
Returns:
Array of OpenAssessment.Prompt objects.
**/
getAllPrompts
:
function
()
{
return
this
.
promptsContainer
.
getAllItems
();
},
/**
Retrieve a prompt item from the prompts.
Args:
index (int): The index of the prompt, starting from 0.
Returns:
OpenAssessment.Prompt or null
**/
getPromptItem
:
function
(
index
)
{
return
this
.
promptsContainer
.
getItem
(
index
);
},
/**
Mark validation errors.
Returns:
Boolean indicating whether the view is valid.
**/
validate
:
function
()
{
return
true
;
},
/**
Return a list of validation errors visible in the UI.
Mainly useful for testing.
Returns:
list of string
**/
validationErrors
:
function
()
{
var
errors
=
[];
return
errors
;
},
/**
Clear all validation errors from the UI.
**/
clearValidationErrors
:
function
()
{}
};
\ No newline at end of file
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