Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beez: Remove useless JS-Code related to btn-group #12029

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions templates/beez3/javascript/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,5 @@
$(document).ready(function()
{
$('*[rel=tooltip]').tooltip()

// Turn radios into btn-group
$('.radio.btn-group label').addClass('btn');

$('fieldset.btn-group').each(function() {
// Handle disabled, prevent clicks on the container, and add disabled style to each button
if ($(this).prop('disabled')) {
$(this).css('pointer-events', 'none').off('click');
$(this).find('.btn').addClass('disabled');
}
});

$(".btn-group label:not(.active)").click(function()
{
var label = $(this);
var input = $('#' + label.attr('for'));

if (!input.prop('checked')) {
label.closest('.btn-group').find("label").removeClass('active btn-success btn-danger btn-primary');
if (input.val() == '') {
label.addClass('active btn-primary');
} else if (input.val() == 0) {
label.addClass('active btn-danger');
} else {
label.addClass('active btn-success');
}
input.prop('checked', true);
}
});
$(".btn-group input[checked=checked]").each(function()
{
if ($(this).val() == '') {
$("label[for=" + $(this).attr('id') + "]").addClass('active btn-primary');
} else if ($(this).val() == 0) {
$("label[for=" + $(this).attr('id') + "]").addClass('active btn-danger');
} else {
$("label[for=" + $(this).attr('id') + "]").addClass('active btn-success');
}
});
})
})(jQuery);