|
@@ -8,59 +8,59 @@
|
|
|
var actionCheckboxes = $(this);
|
|
|
var list_editable_changed = false;
|
|
|
var showQuestion = function() {
|
|
|
- $(options.acrossClears).hide();
|
|
|
- $(options.acrossQuestions).show();
|
|
|
- $(options.allContainer).hide();
|
|
|
- },
|
|
|
- showClear = function() {
|
|
|
- $(options.acrossClears).show();
|
|
|
- $(options.acrossQuestions).hide();
|
|
|
- $(options.actionContainer).toggleClass(options.selectedClass);
|
|
|
- $(options.allContainer).show();
|
|
|
- $(options.counterContainer).hide();
|
|
|
- },
|
|
|
- reset = function() {
|
|
|
- $(options.acrossClears).hide();
|
|
|
- $(options.acrossQuestions).hide();
|
|
|
- $(options.allContainer).hide();
|
|
|
- $(options.counterContainer).show();
|
|
|
- },
|
|
|
- clearAcross = function() {
|
|
|
- reset();
|
|
|
- $(options.acrossInput).val(0);
|
|
|
- $(options.actionContainer).removeClass(options.selectedClass);
|
|
|
- },
|
|
|
- checker = function(checked) {
|
|
|
- if (checked) {
|
|
|
- showQuestion();
|
|
|
- } else {
|
|
|
+ $(options.acrossClears).hide();
|
|
|
+ $(options.acrossQuestions).show();
|
|
|
+ $(options.allContainer).hide();
|
|
|
+ },
|
|
|
+ showClear = function() {
|
|
|
+ $(options.acrossClears).show();
|
|
|
+ $(options.acrossQuestions).hide();
|
|
|
+ $(options.actionContainer).toggleClass(options.selectedClass);
|
|
|
+ $(options.allContainer).show();
|
|
|
+ $(options.counterContainer).hide();
|
|
|
+ },
|
|
|
+ reset = function() {
|
|
|
+ $(options.acrossClears).hide();
|
|
|
+ $(options.acrossQuestions).hide();
|
|
|
+ $(options.allContainer).hide();
|
|
|
+ $(options.counterContainer).show();
|
|
|
+ },
|
|
|
+ clearAcross = function() {
|
|
|
reset();
|
|
|
- }
|
|
|
- $(actionCheckboxes).prop("checked", checked)
|
|
|
- .parent().parent().toggleClass(options.selectedClass, checked);
|
|
|
- },
|
|
|
- updateCounter = function() {
|
|
|
- var sel = $(actionCheckboxes).filter(":checked").length;
|
|
|
- // data-actions-icnt is defined in the generated HTML
|
|
|
- // and contains the total amount of objects in the queryset
|
|
|
- var actions_icnt = $('.action-counter').data('actionsIcnt');
|
|
|
- $(options.counterContainer).html(interpolate(
|
|
|
- ngettext('%(sel)s of %(cnt)s selected', '%(sel)s of %(cnt)s selected', sel), {
|
|
|
- sel: sel,
|
|
|
- cnt: actions_icnt
|
|
|
- }, true));
|
|
|
- $(options.allToggle).prop("checked", function() {
|
|
|
- var value;
|
|
|
- if (sel === actionCheckboxes.length) {
|
|
|
- value = true;
|
|
|
+ $(options.acrossInput).val(0);
|
|
|
+ $(options.actionContainer).removeClass(options.selectedClass);
|
|
|
+ },
|
|
|
+ checker = function(checked) {
|
|
|
+ if (checked) {
|
|
|
showQuestion();
|
|
|
} else {
|
|
|
- value = false;
|
|
|
- clearAcross();
|
|
|
+ reset();
|
|
|
}
|
|
|
- return value;
|
|
|
- });
|
|
|
- };
|
|
|
+ $(actionCheckboxes).prop("checked", checked)
|
|
|
+ .parent().parent().toggleClass(options.selectedClass, checked);
|
|
|
+ },
|
|
|
+ updateCounter = function() {
|
|
|
+ var sel = $(actionCheckboxes).filter(":checked").length;
|
|
|
+ // data-actions-icnt is defined in the generated HTML
|
|
|
+ // and contains the total amount of objects in the queryset
|
|
|
+ var actions_icnt = $('.action-counter').data('actionsIcnt');
|
|
|
+ $(options.counterContainer).html(interpolate(
|
|
|
+ ngettext('%(sel)s of %(cnt)s selected', '%(sel)s of %(cnt)s selected', sel), {
|
|
|
+ sel: sel,
|
|
|
+ cnt: actions_icnt
|
|
|
+ }, true));
|
|
|
+ $(options.allToggle).prop("checked", function() {
|
|
|
+ var value;
|
|
|
+ if (sel === actionCheckboxes.length) {
|
|
|
+ value = true;
|
|
|
+ showQuestion();
|
|
|
+ } else {
|
|
|
+ value = false;
|
|
|
+ clearAcross();
|
|
|
+ }
|
|
|
+ return value;
|
|
|
+ });
|
|
|
+ };
|
|
|
// Show counter by default
|
|
|
$(options.counterContainer).show();
|
|
|
// Check state of checkboxes and reinit state if needed
|