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
68f5b96b
Commit
68f5b96b
authored
Aug 12, 2014
by
Xavier Antoviaque
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #58 from aboudreault/html-tip-fix
Fix html tip display issue and an issue related to publish_event
parents
5a365759
9bbaee77
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 @
68f5b96b
...
@@ -13,6 +13,15 @@ function MentoringBlock(runtime, element) {
...
@@ -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
()
{
function
renderAttempts
()
{
var
data
=
$
(
'.attempts'
,
element
).
data
();
var
data
=
$
(
'.attempts'
,
element
).
data
();
$
(
'.attempts'
,
element
).
html
(
attemptsTemplate
(
data
));
$
(
'.attempts'
,
element
).
html
(
attemptsTemplate
(
data
));
...
@@ -36,7 +45,7 @@ function MentoringBlock(runtime, element) {
...
@@ -36,7 +45,7 @@ function MentoringBlock(runtime, element) {
children_dom
.
push
(
child_dom
);
children_dom
.
push
(
child_dom
);
children
.
push
(
child
);
children
.
push
(
child
);
if
(
typeof
child
!==
'undefined'
)
{
if
(
typeof
child
!==
'undefined'
)
{
child
=
child
(
runtime
,
child_dom
);
child
=
child
(
runtime
,
child_dom
,
mentoring
);
child
.
name
=
$
(
child_dom
).
attr
(
'name'
);
child
.
name
=
$
(
child_dom
).
attr
(
'name'
);
children
[
children
.
length
-
1
]
=
child
;
children
[
children
.
length
-
1
]
=
child
;
}
}
...
@@ -75,6 +84,7 @@ function MentoringBlock(runtime, element) {
...
@@ -75,6 +84,7 @@ function MentoringBlock(runtime, element) {
var
mentoring
=
{
var
mentoring
=
{
callIfExists
:
callIfExists
,
callIfExists
:
callIfExists
,
setContent
:
setContent
,
renderAttempts
:
renderAttempts
,
renderAttempts
:
renderAttempts
,
renderDependency
:
renderDependency
,
renderDependency
:
renderDependency
,
readChildren
:
readChildren
,
readChildren
:
readChildren
,
...
@@ -83,7 +93,8 @@ function MentoringBlock(runtime, element) {
...
@@ -83,7 +93,8 @@ function MentoringBlock(runtime, element) {
displayChild
:
displayChild
,
displayChild
:
displayChild
,
displayChildren
:
displayChildren
,
displayChildren
:
displayChildren
,
getChildByName
:
getChildByName
,
getChildByName
:
getChildByName
,
step
:
step
step
:
step
,
event_url
:
runtime
.
handlerUrl
(
element
,
'publish_event'
)
}
}
if
(
data
.
mode
===
'standard'
)
{
if
(
data
.
mode
===
'standard'
)
{
...
...
mentoring/public/js/mentoring_standard_view.js
View file @
68f5b96b
...
@@ -22,11 +22,7 @@ function MentoringStandardView(runtime, element, mentoring) {
...
@@ -22,11 +22,7 @@ function MentoringStandardView(runtime, element, mentoring) {
mentoring
.
renderAttempts
();
mentoring
.
renderAttempts
();
// Messages should only be displayed upon hitting 'submit', not on page reload
// Messages should only be displayed upon hitting 'submit', not on page reload
messagesDOM
.
append
(
results
.
message
);
mentoring
.
setContent
(
messagesDOM
,
results
.
message
);
var
template
=
$
(
'#light-child-template'
,
messagesDOM
).
html
();
if
(
template
)
{
messagesDOM
.
append
(
template
);
}
if
(
messagesDOM
.
html
().
trim
())
{
if
(
messagesDOM
.
html
().
trim
())
{
messagesDOM
.
prepend
(
'<div class="title1">Feedback</div>'
);
messagesDOM
.
prepend
(
'<div class="title1">Feedback</div>'
);
messagesDOM
.
show
();
messagesDOM
.
show
();
...
...
mentoring/public/js/questionnaire.js
View file @
68f5b96b
// TODO: Split in two files
// TODO: Split in two files
function
MessageView
(
element
)
{
function
MessageView
(
element
,
mentoring
)
{
return
{
return
{
messageDOM
:
$
(
'.feedback'
,
element
),
messageDOM
:
$
(
'.feedback'
,
element
),
allPopupsDOM
:
$
(
'.choice-tips, .feedback'
,
element
),
allPopupsDOM
:
$
(
'.choice-tips, .feedback'
,
element
),
...
@@ -32,7 +32,7 @@ function MessageView(element) {
...
@@ -32,7 +32,7 @@ function MessageView(element) {
function
publish_event
(
data
)
{
function
publish_event
(
data
)
{
$
.
ajax
({
$
.
ajax
({
type
:
"POST"
,
type
:
"POST"
,
url
:
runtime
.
handlerUrl
(
element
,
'publish_event'
)
,
url
:
mentoring
.
event_url
,
data
:
JSON
.
stringify
(
data
)
data
:
JSON
.
stringify
(
data
)
});
});
}
}
...
@@ -47,7 +47,7 @@ function MessageView(element) {
...
@@ -47,7 +47,7 @@ function MessageView(element) {
},
},
showMessage
:
function
(
message
)
{
showMessage
:
function
(
message
)
{
if
(
_
.
isString
(
message
))
{
if
(
_
.
isString
(
message
))
{
this
.
messageDOM
.
html
(
message
);
mentoring
.
setContent
(
this
.
messageDOM
,
message
)
this
.
showPopup
(
this
.
messageDOM
);
this
.
showPopup
(
this
.
messageDOM
);
}
}
else
{
else
{
...
@@ -63,7 +63,7 @@ function MessageView(element) {
...
@@ -63,7 +63,7 @@ function MessageView(element) {
}
}
}
}
function
MCQBlock
(
runtime
,
element
)
{
function
MCQBlock
(
runtime
,
element
,
mentoring
)
{
return
{
return
{
mode
:
null
,
mode
:
null
,
init
:
function
(
options
)
{
init
:
function
(
options
)
{
...
@@ -85,7 +85,7 @@ function MCQBlock(runtime, element) {
...
@@ -85,7 +85,7 @@ function MCQBlock(runtime, element) {
if
(
this
.
mode
===
'assessment'
)
if
(
this
.
mode
===
'assessment'
)
return
;
return
;
var
messageView
=
MessageView
(
element
);
var
messageView
=
MessageView
(
element
,
mentoring
);
messageView
.
clearResult
();
messageView
.
clearResult
();
var
choiceInputs
=
$
(
'.choice input'
,
element
);
var
choiceInputs
=
$
(
'.choice input'
,
element
);
...
@@ -135,7 +135,7 @@ function MCQBlock(runtime, element) {
...
@@ -135,7 +135,7 @@ function MCQBlock(runtime, element) {
},
},
clearResult
:
function
()
{
clearResult
:
function
()
{
MessageView
(
element
).
clearResult
();
MessageView
(
element
,
mentoring
).
clearResult
();
},
},
validate
:
function
(){
validate
:
function
(){
...
@@ -148,7 +148,7 @@ function MCQBlock(runtime, element) {
...
@@ -148,7 +148,7 @@ function MCQBlock(runtime, element) {
};
};
}
}
function
MRQBlock
(
runtime
,
element
)
{
function
MRQBlock
(
runtime
,
element
,
mentoring
)
{
return
{
return
{
mode
:
null
,
mode
:
null
,
init
:
function
(
options
)
{
init
:
function
(
options
)
{
...
@@ -170,7 +170,7 @@ function MRQBlock(runtime, element) {
...
@@ -170,7 +170,7 @@ function MRQBlock(runtime, element) {
if
(
this
.
mode
===
'assessment'
)
if
(
this
.
mode
===
'assessment'
)
return
;
return
;
var
messageView
=
MessageView
(
element
);
var
messageView
=
MessageView
(
element
,
mentoring
);
if
(
result
.
message
)
{
if
(
result
.
message
)
{
messageView
.
showMessage
(
'<div class="message-content">'
+
result
.
message
+
'</div>'
+
messageView
.
showMessage
(
'<div class="message-content">'
+
result
.
message
+
'</div>'
+
...
@@ -209,7 +209,7 @@ function MRQBlock(runtime, element) {
...
@@ -209,7 +209,7 @@ function MRQBlock(runtime, element) {
},
},
clearResult
:
function
()
{
clearResult
:
function
()
{
MessageView
(
element
).
clearResult
();
MessageView
(
element
,
mentoring
).
clearResult
();
},
},
validate
:
function
(){
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