fnp
/
redakcja.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ce3d5f6
)
przyporzadkuj -- minimum answers
author
Marcin Koziej
<mkoziej@ksi.(none)>
Mon, 28 Jan 2013 14:26:26 +0000
(15:26 +0100)
committer
Marcin Koziej
<mkoziej@ksi.(none)>
Mon, 28 Jan 2013 14:26:26 +0000
(15:26 +0100)
lib/librarian
patch
|
blob
|
history
redakcja/static/edumed/css/edumed.css
patch
|
blob
|
history
redakcja/static/edumed/js/edumed.coffee
patch
|
blob
|
history
redakcja/static/edumed/js/edumed.js
patch
|
blob
|
history
diff --git
a/lib/librarian
b/lib/librarian
index
f03d1fd
..
c0761a8
160000
(submodule)
--- a/
lib/librarian
+++ b/
lib/librarian
@@
-1
+1
@@
-Subproject commit
f03d1fdbe472dbfb103d00b0e4ee9fa593c7b2c0
+Subproject commit
c0761a86fb4687fda8221e56bf911f051fda3499
diff --git
a/redakcja/static/edumed/css/edumed.css
b/redakcja/static/edumed/css/edumed.css
index
d944d38
..
d63ce5b
100644
(file)
--- a/
redakcja/static/edumed/css/edumed.css
+++ b/
redakcja/static/edumed/css/edumed.css
@@
-444,12
+444,12
@@
em.person {
}
.teacher {
}
.teacher {
- display: none;
+/* display: none;*/
}
}
-.teacher.show {
+
/*
.teacher.show {
display: inherit;
display: inherit;
-}
+}
*/
.question-piece.correct {
background-color: darkgreen;
.question-piece.correct {
background-color: darkgreen;
@@
-535,6
+535,10
@@
em.person {
}
}
+.excercise.uporzadkuj li {
+ cursor: move;
+}
+
.draggable .remove {
font-family: sans-serif;
padding: 2px 4px;
.draggable .remove {
font-family: sans-serif;
padding: 2px 4px;
diff --git
a/redakcja/static/edumed/js/edumed.coffee
b/redakcja/static/edumed/js/edumed.coffee
index
0fd39d9
..
e65faaa
100644
(file)
--- a/
redakcja/static/edumed/js/edumed.coffee
+++ b/
redakcja/static/edumed/js/edumed.coffee
@@
-10,11
+10,11
@@
class EduModule extends Binding
constructor: (element) ->
super 'edumodule', element
constructor: (element) ->
super 'edumodule', element
- $("[name=teacher-toggle]").change (ev) =>
- if $(ev.target).is(":checked")
- $(".teacher", @element).addClass "show"
- else
- $(".teacher", @element).removeClass "show"
+
#
$("[name=teacher-toggle]").change (ev) =>
+
#
if $(ev.target).is(":checked")
+
#
$(".teacher", @element).addClass "show"
+
#
else
+
#
$(".teacher", @element).removeClass "show"
class Excercise extends Binding
class Excercise extends Binding
@@
-116,7
+116,7
@@
class Excercise extends Binding
$($added.data('original')).removeClass('disabled').draggable('enable')
$added.remove()
$($added.data('original')).removeClass('disabled').draggable('enable')
$added.remove()
-
+## XXX co z issortable?
dragging: (ismultiple, issortable) ->
$(".question", @element).each (i, question) =>
draggable_opts =
dragging: (ismultiple, issortable) ->
$(".question", @element).each (i, question) =>
draggable_opts =
@@
-367,41
+367,45
@@
class Przyporzadkuj extends Excercise
check_question: (question) ->
# subjects placed in predicates
check_question: (question) ->
# subjects placed in predicates
+ minimum = $(question).data("minimum")
count = 0
all = 0
count = 0
all = 0
- all_multiple = 0
- for qp in $(".predicate .question-piece", question)
- pred = $(qp).closest("[data-predicate]")
- v = @get_value_optional_list qp, 'solution'
- mandatory = v[0]
- optional = v[1]
- all_multiple += mandatory.length + optional.length
- pn = pred.attr('data-predicate')
- if mandatory.indexOf(pn) >= 0 or optional.indexOf(pn) >= 0
- count += 1
- @piece_correct qp
- else
- @piece_incorrect qp
- all += 1
+ if not minimum
+ all = $(".subjects .question-piece", question).length
+
+ for pred in $(".predicate [data-predicate]", question)
+ pn = $(pred).attr('data-predicate')
+ if minimum?
+ all += minimum
- if @multiple
- for qp in $(".subject .question-piece", question)
+ for qp in $(".question-piece", pred)
v = @get_value_optional_list qp, 'solution'
mandatory = v[0]
optional = v[1]
v = @get_value_optional_list qp, 'solution'
mandatory = v[0]
optional = v[1]
- all_multiple += mandatory.length + optional.length
- return [count, all_multiple]
- else
- return [count, all]
+
+ if mandatory.indexOf(pn) >= 0 or (minimum and optional.indexOf(pn) >= 0)
+ count += 1
+ @piece_correct qp
+ else
+ @piece_incorrect qp
+
+ return [count, all]
solve_question: (question) ->
solve_question: (question) ->
+ minimum = $(question).data("min")
+
for qp in $(".subject .question-piece", question)
v = @get_value_optional_list qp, 'solution'
mandatory = v[0]
optional = v[1]
for qp in $(".subject .question-piece", question)
v = @get_value_optional_list qp, 'solution'
mandatory = v[0]
optional = v[1]
- for m in mandatory.concat(optional)
+
+ if minimum
+ draggables = mandatory.count(optional)[0...minimum]
+ else
+ draggables = mandatory
+ for m in draggables
$pr = $(".predicate [data-predicate=" + m + "]", question)
$pr = $(".predicate [data-predicate=" + m + "]", question)
- $ph = $pr.find ".placeholder"
+ $ph = $pr.find ".placeholder
:visible
"
@draggable_move $(qp), $ph, @multiple
@draggable_move $(qp), $ph, @multiple
diff --git
a/redakcja/static/edumed/js/edumed.js
b/redakcja/static/edumed/js/edumed.js
index
b601128
..
42f0c37
100644
(file)
--- a/
redakcja/static/edumed/js/edumed.js
+++ b/
redakcja/static/edumed/js/edumed.js
@@
-23,15
+23,7
@@
__extends(EduModule, _super);
function EduModule(element) {
__extends(EduModule, _super);
function EduModule(element) {
- var _this = this;
EduModule.__super__.constructor.call(this, 'edumodule', element);
EduModule.__super__.constructor.call(this, 'edumodule', element);
- $("[name=teacher-toggle]").change(function(ev) {
- if ($(ev.target).is(":checked")) {
- return $(".teacher", _this.element).addClass("show");
- } else {
- return $(".teacher", _this.element).removeClass("show");
- }
- });
}
return EduModule;
}
return EduModule;
@@
-490,44
+482,40
@@
};
Przyporzadkuj.prototype.check_question = function(question) {
};
Przyporzadkuj.prototype.check_question = function(question) {
- var all, all_multiple, count, mandatory, optional, pn, pred, qp, v, _i, _j, _len, _len1, _ref, _ref1;
+ var all, count, mandatory, minimum, optional, pn, pred, qp, v, _i, _j, _len, _len1, _ref, _ref1;
+ minimum = $(question).data("minimum");
count = 0;
all = 0;
count = 0;
all = 0;
- all_multiple = 0;
- _ref = $(".predicate .question-piece", question);
+ if (!minimum) {
+ all = $(".subjects .question-piece", question).length;
+ }
+ _ref = $(".predicate [data-predicate]", question);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- qp = _ref[_i];
- pred = $(qp).closest("[data-predicate]");
- v = this.get_value_optional_list(qp, 'solution');
- mandatory = v[0];
- optional = v[1];
- all_multiple += mandatory.length + optional.length;
- pn = pred.attr('data-predicate');
- if (mandatory.indexOf(pn) >= 0 || optional.indexOf(pn) >= 0) {
- count += 1;
- this.piece_correct(qp);
- } else {
- this.piece_incorrect(qp);
+ pred = _ref[_i];
+ pn = $(pred).attr('data-predicate');
+ if (minimum != null) {
+ all += minimum;
}
}
- all += 1;
- }
- if (this.multiple) {
- _ref1 = $(".subject .question-piece", question);
+ _ref1 = $(".question-piece", pred);
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
qp = _ref1[_j];
v = this.get_value_optional_list(qp, 'solution');
mandatory = v[0];
optional = v[1];
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
qp = _ref1[_j];
v = this.get_value_optional_list(qp, 'solution');
mandatory = v[0];
optional = v[1];
- all_multiple += mandatory.length + optional.length;
+ if (mandatory.indexOf(pn) >= 0 || (minimum && optional.indexOf(pn) >= 0)) {
+ count += 1;
+ this.piece_correct(qp);
+ } else {
+ this.piece_incorrect(qp);
+ }
}
}
- return [count, all_multiple];
- } else {
- return [count, all];
}
}
+ return [count, all];
};
Przyporzadkuj.prototype.solve_question = function(question) {
};
Przyporzadkuj.prototype.solve_question = function(question) {
- var $ph, $pr, m, mandatory, optional, qp, v, _i, _len, _ref, _results;
+ var $ph, $pr, draggables, m, mandatory, minimum, optional, qp, v, _i, _len, _ref, _results;
+ minimum = $(question).data("min");
_ref = $(".subject .question-piece", question);
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
_ref = $(".subject .question-piece", question);
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@@
-535,14
+523,18
@@
v = this.get_value_optional_list(qp, 'solution');
mandatory = v[0];
optional = v[1];
v = this.get_value_optional_list(qp, 'solution');
mandatory = v[0];
optional = v[1];
+ if (minimum) {
+ draggables = mandatory.count(optional).slice(0, minimum);
+ } else {
+ draggables = mandatory;
+ }
_results.push((function() {
_results.push((function() {
- var _j, _len1, _ref1, _results1;
- _ref1 = mandatory.concat(optional);
+ var _j, _len1, _results1;
_results1 = [];
_results1 = [];
- for (_j = 0, _len1 =
_ref1
.length; _j < _len1; _j++) {
- m =
_ref1
[_j];
+ for (_j = 0, _len1 =
draggables
.length; _j < _len1; _j++) {
+ m =
draggables
[_j];
$pr = $(".predicate [data-predicate=" + m + "]", question);
$pr = $(".predicate [data-predicate=" + m + "]", question);
- $ph = $pr.find(".placeholder");
+ $ph = $pr.find(".placeholder
:visible
");
_results1.push(this.draggable_move($(qp), $ph, this.multiple));
}
return _results1;
_results1.push(this.draggable_move($(qp), $ph, this.multiple));
}
return _results1;