Subscribe selection fix
This commit is contained in:
parent
d07b8f4c09
commit
849cfa2076
|
@ -3,15 +3,15 @@
|
|||
<% end %>
|
||||
<script type="text/javascript">
|
||||
|
||||
var checkboxes = $('.checkbox input');
|
||||
var $checkboxes = $('.checkbox input');
|
||||
|
||||
$(document).ready(function() {
|
||||
var categories = <%= @categories.to_json.html_safe %>;
|
||||
|
||||
for (var i = 0; i < checkboxes.length; i++) {
|
||||
for (var i = 0; i < $checkboxes.length; i++) {
|
||||
|
||||
if ($.inArray(checkboxes[i].value, categories) != -1) {
|
||||
checkboxes[i].checked = true;
|
||||
if ($.inArray($checkboxes[i].value, categories) != -1) {
|
||||
$checkboxes[i].checked = true;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
@ -19,10 +19,18 @@ $(document).ready(function() {
|
|||
|
||||
});
|
||||
|
||||
checkboxes.on('click', function() {
|
||||
if (checkboxes[0].checked == true) {
|
||||
for (var i = 1; i < checkboxes.length; i++) {
|
||||
checkboxes[i].checked = false;
|
||||
$('#announcement_feed_categories_').on('click', function() {
|
||||
if ($checkboxes[0].checked == true) {
|
||||
for (var i = 1; i < $checkboxes.length; i++) {
|
||||
$checkboxes[i].checked = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$checkboxes.on('click', function() {
|
||||
for (var i = 1; i < $checkboxes.length; i++) {
|
||||
if ($checkboxes[i].checked == true) {
|
||||
$checkboxes[0].checked = false
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue