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
66be24c6
Commit
66be24c6
authored
Apr 11, 2014
by
Xavier Antoviaque
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #22 from aboudreault/mrq-tip-width-height
Mrq tip width height
parents
fdbfc077
7befbdaa
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
66 deletions
+66
-66
mentoring/public/css/questionnaire.css
+1
-0
mentoring/public/js/answer.js
+4
-4
mentoring/public/js/mentoring.js
+3
-3
mentoring/public/js/questionnaire.js
+58
-58
mentoring/templates/html/mcqblock_choices.html
+0
-1
No files found.
mentoring/public/css/questionnaire.css
View file @
66be24c6
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
font-family
:
arial
;
font-family
:
arial
;
font-size
:
14px
;
font-size
:
14px
;
height
:
100%
;
height
:
100%
;
max-height
:
100%
;
opacity
:
0.9
;
opacity
:
0.9
;
padding
:
10px
;
padding
:
10px
;
width
:
300px
;
width
:
300px
;
...
...
mentoring/public/js/answer.js
View file @
66be24c6
...
@@ -2,8 +2,8 @@ function AnswerBlock(runtime, element) {
...
@@ -2,8 +2,8 @@ function AnswerBlock(runtime, element) {
return
{
return
{
init
:
function
(
options
)
{
init
:
function
(
options
)
{
// register the child validator
// register the child validator
$
(
':input'
,
element
).
on
(
'keyup'
,
options
.
blockValidator
);
$
(
':input'
,
element
).
on
(
'keyup'
,
options
.
blockValidator
);
},
},
submit
:
function
()
{
submit
:
function
()
{
...
@@ -15,7 +15,7 @@ function AnswerBlock(runtime, element) {
...
@@ -15,7 +15,7 @@ function AnswerBlock(runtime, element) {
$
(
element
).
find
(
'.message'
).
text
((
result
||
{}).
error
||
''
);
$
(
element
).
find
(
'.message'
).
text
((
result
||
{}).
error
||
''
);
checkmark
.
removeClass
(
checkmark
.
removeClass
(
'checkmark-incorrect icon-exclamation fa-exclamation checkmark-correct icon-ok fa-check'
'checkmark-incorrect icon-exclamation fa-exclamation checkmark-correct icon-ok fa-check'
);
);
if
(
result
.
completed
)
{
if
(
result
.
completed
)
{
checkmark
.
addClass
(
'checkmark-correct icon-ok fa-check'
);
checkmark
.
addClass
(
'checkmark-correct icon-ok fa-check'
);
...
@@ -31,7 +31,7 @@ function AnswerBlock(runtime, element) {
...
@@ -31,7 +31,7 @@ function AnswerBlock(runtime, element) {
// return true if the answer is read only
// return true if the answer is read only
var
blockquote_ro
=
$
(
'blockquote.answer.read_only'
,
element
);
var
blockquote_ro
=
$
(
'blockquote.answer.read_only'
,
element
);
if
(
blockquote_ro
.
length
>
0
)
if
(
blockquote_ro
.
length
>
0
)
return
true
;
return
true
;
var
input
=
$
(
':input'
,
element
),
var
input
=
$
(
':input'
,
element
),
input_value
=
input
.
val
().
replace
(
/^
\s
+|
\s
+$/gm
,
''
),
input_value
=
input
.
val
().
replace
(
/^
\s
+|
\s
+$/gm
,
''
),
...
...
mentoring/public/js/mentoring.js
View file @
66be24c6
...
@@ -55,7 +55,7 @@ function MentoringBlock(runtime, element) {
...
@@ -55,7 +55,7 @@ function MentoringBlock(runtime, element) {
function
getChildren
(
element
)
{
function
getChildren
(
element
)
{
if
(
!
_
.
isUndefined
(
children
))
if
(
!
_
.
isUndefined
(
children
))
return
children
;
return
children
;
var
children_dom
=
$
(
'.xblock-light-child'
,
element
);
var
children_dom
=
$
(
'.xblock-light-child'
,
element
);
children
=
[];
children
=
[];
...
@@ -106,7 +106,7 @@ function MentoringBlock(runtime, element) {
...
@@ -106,7 +106,7 @@ function MentoringBlock(runtime, element) {
blockValidator
:
validateXBlock
blockValidator
:
validateXBlock
};
};
_
.
each
(
children
,
function
(
child
)
{
_
.
each
(
children
,
function
(
child
)
{
callIfExists
(
child
,
'init'
,
options
);
callIfExists
(
child
,
'init'
,
options
);
});
});
...
@@ -134,7 +134,7 @@ function MentoringBlock(runtime, element) {
...
@@ -134,7 +134,7 @@ function MentoringBlock(runtime, element) {
var
children
=
getChildren
(
element
);
var
children
=
getChildren
(
element
);
if
((
data
.
max_attempts
>
0
)
&&
(
data
.
num_attempts
>=
data
.
max_attempts
))
{
if
((
data
.
max_attempts
>
0
)
&&
(
data
.
num_attempts
>=
data
.
max_attempts
))
{
is_valid
=
false
;
is_valid
=
false
;
}
}
else
{
else
{
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
...
...
mentoring/public/js/questionnaire.js
View file @
66be24c6
// TODO: Split in two files
// TODO: Split in two files
function
MessageView
(
element
)
{
function
MessageView
(
element
)
{
return
{
return
{
messageDOM
:
$
(
'.feedback'
,
element
),
messageDOM
:
$
(
'.feedback'
,
element
),
allPopupsDOM
:
$
(
'.choice-tips, .feedback'
,
element
),
allPopupsDOM
:
$
(
'.choice-tips, .feedback'
,
element
),
clearPopupEvents
:
function
()
{
clearPopupEvents
:
function
()
{
this
.
allPopupsDOM
.
hide
();
this
.
allPopupsDOM
.
hide
();
$
(
'.close'
,
this
.
allPopupsDOM
).
off
(
'click'
);
$
(
'.close'
,
this
.
allPopupsDOM
).
off
(
'click'
);
},
},
showPopup
:
function
(
popupDOM
)
{
showPopup
:
function
(
popupDOM
)
{
var
self
=
this
;
var
self
=
this
;
this
.
clearPopupEvents
();
this
.
clearPopupEvents
();
// Set the width/height
// Set the width/height
var
tip
=
$
(
'.tip'
,
popupDOM
)[
0
];
var
tip
=
$
(
'.tip'
,
popupDOM
)[
0
];
var
data
=
$
(
tip
).
data
();
var
data
=
$
(
tip
).
data
();
if
(
data
&&
data
.
width
)
{
if
(
data
&&
data
.
width
)
{
popupDOM
.
css
(
'width'
,
data
.
width
)
popupDOM
.
css
(
'width'
,
data
.
width
)
}
else
{
}
else
{
popupDOM
.
css
(
'width'
,
''
)
popupDOM
.
css
(
'width'
,
''
)
}
}
if
(
data
&&
data
.
height
)
{
if
(
data
&&
data
.
height
)
{
popupDOM
.
css
(
'height'
,
data
.
height
);
popupDOM
.
css
(
'height'
,
data
.
height
);
}
else
{
}
else
{
popupDOM
.
css
(
'height'
,
''
)
popupDOM
.
css
(
'height'
,
''
)
}
}
popupDOM
.
show
();
popupDOM
.
show
();
popupDOM
.
on
(
'click'
,
function
()
{
popupDOM
.
on
(
'click'
,
function
()
{
self
.
clearPopupEvents
();
self
.
clearPopupEvents
();
});
});
},
},
showMessage
:
function
(
message
)
{
showMessage
:
function
(
message
)
{
if
(
_
.
isString
(
message
))
{
if
(
_
.
isString
(
message
))
{
this
.
messageDOM
.
html
(
message
);
this
.
messageDOM
.
html
(
message
);
this
.
showPopup
(
this
.
messageDOM
);
this
.
showPopup
(
this
.
messageDOM
);
}
}
else
{
else
{
this
.
showPopup
(
message
);
// already a DOM
this
.
showPopup
(
message
);
// already a DOM
}
}
}
}
}
}
}
}
function
MCQBlock
(
runtime
,
element
)
{
function
MCQBlock
(
runtime
,
element
)
{
...
@@ -66,7 +66,7 @@ function MCQBlock(runtime, element) {
...
@@ -66,7 +66,7 @@ function MCQBlock(runtime, element) {
choiceTipsCloseDOM
;
choiceTipsCloseDOM
;
choiceResultDOM
.
removeClass
(
choiceResultDOM
.
removeClass
(
'checkmark-incorrect icon-exclamation fa-exclamation checkmark-correct icon-ok fa-check'
'checkmark-incorrect icon-exclamation fa-exclamation checkmark-correct icon-ok fa-check'
);
);
if
(
result
.
completed
&&
choiceInputDOM
.
val
()
===
result
.
submission
)
{
if
(
result
.
completed
&&
choiceInputDOM
.
val
()
===
result
.
submission
)
{
choiceResultDOM
.
addClass
(
'checkmark-correct icon-ok fa-check'
);
choiceResultDOM
.
addClass
(
'checkmark-correct icon-ok fa-check'
);
...
@@ -75,17 +75,17 @@ function MCQBlock(runtime, element) {
...
@@ -75,17 +75,17 @@ function MCQBlock(runtime, element) {
choiceResultDOM
.
addClass
(
'checkmark-incorrect icon-exclamation fa-exclamation'
);
choiceResultDOM
.
addClass
(
'checkmark-incorrect icon-exclamation fa-exclamation'
);
}
}
var
tips
=
_
.
find
(
result
.
tips
,
function
(
obj
)
{
var
tips
=
_
.
find
(
result
.
tips
,
function
(
obj
)
{
return
obj
.
choice
===
choiceInputDOM
.
val
();
return
obj
.
choice
===
choiceInputDOM
.
val
();
});
});
if
(
tips
)
{
if
(
tips
)
{
choiceTipsDOM
.
html
(
tips
.
tips
);
choiceTipsDOM
.
html
(
tips
.
tips
);
}
}
choiceTipsCloseDOM
=
$
(
'.close'
,
choiceTipsDOM
);
choiceTipsCloseDOM
=
$
(
'.close'
,
choiceTipsDOM
);
choiceResultDOM
.
off
(
'click'
).
on
(
'click'
,
function
()
{
choiceResultDOM
.
off
(
'click'
).
on
(
'click'
,
function
()
{
if
(
choiceTipsDOM
.
html
()
!=
''
)
{
if
(
choiceTipsDOM
.
html
()
!=
''
)
{
messageView
.
showMessage
(
choiceTipsDOM
);
messageView
.
showMessage
(
choiceTipsDOM
);
}
}
});
});
});
});
...
@@ -96,15 +96,15 @@ function MCQBlock(runtime, element) {
...
@@ -96,15 +96,15 @@ function MCQBlock(runtime, element) {
}
}
else
if
(
result
.
tips
)
{
else
if
(
result
.
tips
)
{
var
tips
=
_
.
find
(
result
.
tips
,
function
(
obj
)
{
var
tips
=
_
.
find
(
result
.
tips
,
function
(
obj
)
{
return
obj
.
choice
===
result
.
submission
;
return
obj
.
choice
===
result
.
submission
;
});
});
if
(
tips
)
{
if
(
tips
)
{
messageView
.
showMessage
(
tips
.
tips
);
messageView
.
showMessage
(
tips
.
tips
);
}
else
{
}
else
{
messageView
.
clearPopupEvents
();
messageView
.
clearPopupEvents
();
}
}
}
}
}
}
};
};
}
}
...
@@ -140,17 +140,17 @@ function MRQBlock(runtime, element) {
...
@@ -140,17 +140,17 @@ function MRQBlock(runtime, element) {
choiceTipsCloseDOM
;
choiceTipsCloseDOM
;
choiceResultDOM
.
removeClass
(
choiceResultDOM
.
removeClass
(
'checkmark-incorrect icon-exclamation fa-exclamation checkmark-correct icon-ok fa-check'
'checkmark-incorrect icon-exclamation fa-exclamation checkmark-correct icon-ok fa-check'
);
);
/* show hint if checked or max_attempts is disabled */
/* show hint if checked or max_attempts is disabled */
if
(
!
hide_results
&&
if
(
!
hide_results
&&
(
result
.
completed
||
choiceInputDOM
.
prop
(
'checked'
)
||
options
.
max_attempts
<=
0
))
{
(
result
.
completed
||
choiceInputDOM
.
prop
(
'checked'
)
||
options
.
max_attempts
<=
0
))
{
if
(
choice
.
completed
)
{
if
(
choice
.
completed
)
{
choiceResultDOM
.
addClass
(
'checkmark-correct icon-ok fa-check'
);
choiceResultDOM
.
addClass
(
'checkmark-correct icon-ok fa-check'
);
}
else
if
(
!
choice
.
completed
)
{
}
else
if
(
!
choice
.
completed
)
{
choiceResultDOM
.
addClass
(
'checkmark-incorrect icon-exclamation fa-exclamation'
);
choiceResultDOM
.
addClass
(
'checkmark-incorrect icon-exclamation fa-exclamation'
);
}
}
}
}
choiceTipsDOM
.
html
(
choice
.
tips
);
choiceTipsDOM
.
html
(
choice
.
tips
);
...
...
mentoring/templates/html/mcqblock_choices.html
View file @
66be24c6
...
@@ -10,7 +10,6 @@
...
@@ -10,7 +10,6 @@
<div
class=
"choice-tips"
></div>
<div
class=
"choice-tips"
></div>
</div>
</div>
{% endfor %}
{% endfor %}
<div
<div
class=
"feedback"
></div>
<div
class=
"feedback"
></div>
</div>
</div>
</fieldset>
</fieldset>
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