Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
problem-builder
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
OpenEdx
problem-builder
Commits
9bbaee77
Commit
9bbaee77
authored
Aug 11, 2014
by
Alan Boudreault
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix html tip display issue and an issue related to publish_event
parent
5a365759
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
16 deletions
+23
-16
mentoring/public/js/mentoring.js
+13
-2
mentoring/public/js/mentoring_standard_view.js
+1
-5
mentoring/public/js/questionnaire.js
+9
-9
No files found.
mentoring/public/js/mentoring.js
View file @
9bbaee77
...
...
@@ -13,6 +13,15 @@ function MentoringBlock(runtime, element) {
}
}
function
setContent
(
dom
,
content
)
{
dom
.
html
(
''
);
dom
.
append
(
content
);
var
template
=
$
(
'#light-child-template'
,
dom
).
html
();
if
(
template
)
{
dom
.
append
(
template
);
}
}
function
renderAttempts
()
{
var
data
=
$
(
'.attempts'
,
element
).
data
();
$
(
'.attempts'
,
element
).
html
(
attemptsTemplate
(
data
));
...
...
@@ -36,7 +45,7 @@ function MentoringBlock(runtime, element) {
children_dom
.
push
(
child_dom
);
children
.
push
(
child
);
if
(
typeof
child
!==
'undefined'
)
{
child
=
child
(
runtime
,
child_dom
);
child
=
child
(
runtime
,
child_dom
,
mentoring
);
child
.
name
=
$
(
child_dom
).
attr
(
'name'
);
children
[
children
.
length
-
1
]
=
child
;
}
...
...
@@ -75,6 +84,7 @@ function MentoringBlock(runtime, element) {
var
mentoring
=
{
callIfExists
:
callIfExists
,
setContent
:
setContent
,
renderAttempts
:
renderAttempts
,
renderDependency
:
renderDependency
,
readChildren
:
readChildren
,
...
...
@@ -83,7 +93,8 @@ function MentoringBlock(runtime, element) {
displayChild
:
displayChild
,
displayChildren
:
displayChildren
,
getChildByName
:
getChildByName
,
step
:
step
step
:
step
,
event_url
:
runtime
.
handlerUrl
(
element
,
'publish_event'
)
}
if
(
data
.
mode
===
'standard'
)
{
...
...
mentoring/public/js/mentoring_standard_view.js
View file @
9bbaee77
...
...
@@ -22,11 +22,7 @@ function MentoringStandardView(runtime, element, mentoring) {
mentoring
.
renderAttempts
();
// Messages should only be displayed upon hitting 'submit', not on page reload
messagesDOM
.
append
(
results
.
message
);
var
template
=
$
(
'#light-child-template'
,
messagesDOM
).
html
();
if
(
template
)
{
messagesDOM
.
append
(
template
);
}
mentoring
.
setContent
(
messagesDOM
,
results
.
message
);
if
(
messagesDOM
.
html
().
trim
())
{
messagesDOM
.
prepend
(
'<div class="title1">Feedback</div>'
);
messagesDOM
.
show
();
...
...
mentoring/public/js/questionnaire.js
View file @
9bbaee77
// TODO: Split in two files
function
MessageView
(
element
)
{
function
MessageView
(
element
,
mentoring
)
{
return
{
messageDOM
:
$
(
'.feedback'
,
element
),
allPopupsDOM
:
$
(
'.choice-tips, .feedback'
,
element
),
...
...
@@ -32,7 +32,7 @@ function MessageView(element) {
function
publish_event
(
data
)
{
$
.
ajax
({
type
:
"POST"
,
url
:
runtime
.
handlerUrl
(
element
,
'publish_event'
)
,
url
:
mentoring
.
event_url
,
data
:
JSON
.
stringify
(
data
)
});
}
...
...
@@ -47,7 +47,7 @@ function MessageView(element) {
},
showMessage
:
function
(
message
)
{
if
(
_
.
isString
(
message
))
{
this
.
messageDOM
.
html
(
message
);
mentoring
.
setContent
(
this
.
messageDOM
,
message
)
this
.
showPopup
(
this
.
messageDOM
);
}
else
{
...
...
@@ -63,7 +63,7 @@ function MessageView(element) {
}
}
function
MCQBlock
(
runtime
,
element
)
{
function
MCQBlock
(
runtime
,
element
,
mentoring
)
{
return
{
mode
:
null
,
init
:
function
(
options
)
{
...
...
@@ -85,7 +85,7 @@ function MCQBlock(runtime, element) {
if
(
this
.
mode
===
'assessment'
)
return
;
var
messageView
=
MessageView
(
element
);
var
messageView
=
MessageView
(
element
,
mentoring
);
messageView
.
clearResult
();
var
choiceInputs
=
$
(
'.choice input'
,
element
);
...
...
@@ -135,7 +135,7 @@ function MCQBlock(runtime, element) {
},
clearResult
:
function
()
{
MessageView
(
element
).
clearResult
();
MessageView
(
element
,
mentoring
).
clearResult
();
},
validate
:
function
(){
...
...
@@ -148,7 +148,7 @@ function MCQBlock(runtime, element) {
};
}
function
MRQBlock
(
runtime
,
element
)
{
function
MRQBlock
(
runtime
,
element
,
mentoring
)
{
return
{
mode
:
null
,
init
:
function
(
options
)
{
...
...
@@ -170,7 +170,7 @@ function MRQBlock(runtime, element) {
if
(
this
.
mode
===
'assessment'
)
return
;
var
messageView
=
MessageView
(
element
);
var
messageView
=
MessageView
(
element
,
mentoring
);
if
(
result
.
message
)
{
messageView
.
showMessage
(
'<div class="message-content">'
+
result
.
message
+
'</div>'
+
...
...
@@ -209,7 +209,7 @@ function MRQBlock(runtime, element) {
},
clearResult
:
function
()
{
MessageView
(
element
).
clearResult
();
MessageView
(
element
,
mentoring
).
clearResult
();
},
validate
:
function
(){
...
...
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