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
44832e42
Commit
44832e42
authored
Aug 26, 2014
by
Xavier Antoviaque
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #63 from dragonfi/close-feedback-popup
Close feedback popup on click to anywhere else
parents
57cee667
cdef641a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
16 deletions
+41
-16
mentoring/public/js/mentoring.js
+33
-6
mentoring/public/js/questionnaire.js
+8
-10
No files found.
mentoring/public/js/mentoring.js
View file @
44832e42
...
@@ -5,6 +5,37 @@ function MentoringBlock(runtime, element) {
...
@@ -5,6 +5,37 @@ function MentoringBlock(runtime, element) {
var
children
=
[];
var
children
=
[];
var
step
=
data
.
step
;
var
step
=
data
.
step
;
function
publish_event
(
data
)
{
$
.
ajax
({
type
:
"POST"
,
url
:
runtime
.
handlerUrl
(
element
,
'publish_event'
),
data
:
JSON
.
stringify
(
data
)
});
}
$
(
document
).
on
(
"click"
,
function
(
event
,
ui
)
{
target
=
$
(
event
.
target
);
feedback_box
=
".mentoring .feedback"
;
if
(
target
.
is
(
feedback_box
))
{
return
;
};
if
(
target
.
parents
(
feedback_box
).
length
>
0
)
{
return
;
};
$
(
feedback_box
).
each
(
function
(
i
,
el
)
{
el
=
$
(
el
);
if
(
el
.
is
(
":hidden"
))
{
return
;
}
el
.
hide
();
publish_event
({
event_type
:
'xblock.mentoring.feedback.closed'
,
content
:
el
.
text
()
});
});
});
function
callIfExists
(
obj
,
fn
)
{
function
callIfExists
(
obj
,
fn
)
{
if
(
typeof
obj
!==
'undefined'
&&
typeof
obj
[
fn
]
==
'function'
)
{
if
(
typeof
obj
!==
'undefined'
&&
typeof
obj
[
fn
]
==
'function'
)
{
return
obj
[
fn
].
apply
(
obj
,
Array
.
prototype
.
slice
.
call
(
arguments
,
2
));
return
obj
[
fn
].
apply
(
obj
,
Array
.
prototype
.
slice
.
call
(
arguments
,
2
));
...
@@ -94,7 +125,7 @@ function MentoringBlock(runtime, element) {
...
@@ -94,7 +125,7 @@ function MentoringBlock(runtime, element) {
displayChildren
:
displayChildren
,
displayChildren
:
displayChildren
,
getChildByName
:
getChildByName
,
getChildByName
:
getChildByName
,
step
:
step
,
step
:
step
,
event_url
:
runtime
.
handlerUrl
(
element
,
'publish_event'
)
publish_event
:
publish_event
}
}
if
(
data
.
mode
===
'standard'
)
{
if
(
data
.
mode
===
'standard'
)
{
...
@@ -104,9 +135,5 @@ function MentoringBlock(runtime, element) {
...
@@ -104,9 +135,5 @@ function MentoringBlock(runtime, element) {
MentoringAssessmentView
(
runtime
,
element
,
mentoring
);
MentoringAssessmentView
(
runtime
,
element
,
mentoring
);
}
}
$
.
ajax
({
publish_event
({
event_type
:
"xblock.mentoring.loaded"
});
type
:
"POST"
,
url
:
runtime
.
handlerUrl
(
element
,
'publish_event'
),
data
:
JSON
.
stringify
({
event_type
:
"xblock.mentoring.loaded"
})
});
}
}
mentoring/public/js/questionnaire.js
View file @
44832e42
// TODO: Split in two files
// TODO: Split in two files
function
MessageView
(
element
,
mentoring
)
{
function
MessageView
(
element
,
mentoring
)
{
return
{
return
{
messageDOM
:
$
(
'.feedback'
,
element
),
messageDOM
:
$
(
'.feedback'
,
element
),
...
@@ -29,20 +30,17 @@ function MessageView(element, mentoring) {
...
@@ -29,20 +30,17 @@ function MessageView(element, mentoring) {
popupDOM
.
show
();
popupDOM
.
show
();
function
publish_event
(
data
)
{
mentoring
.
publish_event
({
$
.
ajax
({
event_type
:
'xblock.mentoring.feedback.opened'
,
type
:
"POST"
,
content
:
$
(
popupDOM
).
text
()
url
:
mentoring
.
event_url
,
data
:
JSON
.
stringify
(
data
)
});
});
}
publish_event
({
event_type
:
'xblock.mentoring.feedback.opened'
});
$
(
'.close'
,
popupDOM
).
on
(
'click'
,
function
()
{
$
(
'.close'
,
popupDOM
).
on
(
'click'
,
function
()
{
self
.
clearPopupEvents
();
self
.
clearPopupEvents
();
console
.
log
(
popupDOM
);
mentoring
.
publish_event
({
publish_event
({
event_type
:
'xblock.mentoring.feedback.closed'
});
event_type
:
'xblock.mentoring.feedback.closed'
,
content
:
$
(
popupDOM
).
text
()
});
});
});
},
},
showMessage
:
function
(
message
)
{
showMessage
:
function
(
message
)
{
...
...
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