Skip to content

Commit

Permalink
fix(notifications): use the correct way to check if checkbox is checked
Browse files Browse the repository at this point in the history
fixes #9511
  • Loading branch information
jdalsem committed Apr 14, 2016
1 parent c804e32 commit 4c7b8b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<script> <script>
function setCollection(members, method, id) { function setCollection(members, method, id) {
for ( var i in members ) { for ( var i in members ) {
var checked = $('#' + method + 'collections' + id).children("INPUT[type='checkbox']").attr('checked'); var checked = $('#' + method + 'collections' + id).children("INPUT[type='checkbox']").prop('checked');
if ($("#"+method+members[i]).children("INPUT[type='checkbox']").attr('checked') != checked) { if ($("#"+method+members[i]).children("INPUT[type='checkbox']").prop('checked') != checked) {
$("#"+method+members[i]).children("INPUT[type='checkbox']").attr('checked', checked); $("#"+method+members[i]).children("INPUT[type='checkbox']").prop('checked', checked);
functioncall = 'adjust' + method + '_alt("'+method+members[i]+'");'; functioncall = 'adjust' + method + '_alt("'+method+members[i]+'");';
eval(functioncall); eval(functioncall);
} }
Expand All @@ -32,7 +32,7 @@ functioncall = 'adjust' + method + '_alt("'+method+members[i]+'");';
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<?php <?php
$i = 0; $i = 0;
$NOTIFICATION_HANDLERS = _elgg_services()->notifications->getMethodsAsDeprecatedGlobal(); $NOTIFICATION_HANDLERS = _elgg_services()->notifications->getMethodsAsDeprecatedGlobal();
foreach($NOTIFICATION_HANDLERS as $method => $foo) { foreach($NOTIFICATION_HANDLERS as $method => $foo) {
if ($i > 0) { if ($i > 0) {
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


$NOTIFICATION_HANDLERS = _elgg_services()->notifications->getMethodsAsDeprecatedGlobal(); $NOTIFICATION_HANDLERS = _elgg_services()->notifications->getMethodsAsDeprecatedGlobal();


?> ?>
<?php //@todo JS 1.8: no ?> <?php //@todo JS 1.8: no ?>
<script> <script>
require(['jquery'], function($) { require(['jquery'], function($) {
Expand All @@ -19,7 +19,7 @@
?> ?>
}); });
}); });
<?php <?php
foreach($NOTIFICATION_HANDLERS as $method => $foo) { foreach($NOTIFICATION_HANDLERS as $method => $foo) {
?> ?>
function adjust<?php echo $method; ?>(linkId) { function adjust<?php echo $method; ?>(linkId) {
Expand All @@ -37,10 +37,10 @@ function adjust<?php echo $method; ?>_alt(linkId) {


if (obj.className == "<?php echo $method; ?>toggleOff") { if (obj.className == "<?php echo $method; ?>toggleOff") {
obj.className = "<?php echo $method; ?>toggleOn"; obj.className = "<?php echo $method; ?>toggleOn";
$('#' + linkId).children("input[type='checkbox']").attr('checked', true); $('#' + linkId).children("input[type='checkbox']").prop('checked', true);
} else { } else {
obj.className = "<?php echo $method; ?>toggleOff"; obj.className = "<?php echo $method; ?>toggleOff";
$('#' + linkId).children("input[type='checkbox']").attr('checked', false); $('#' + linkId).children("input[type='checkbox']").prop('checked', false);
} }
return false; return false;
} }
Expand Down

0 comments on commit 4c7b8b6

Please sign in to comment.