Added select-all button in splashpage form

While creating a splashpage,admin may want to
select all the options by checking all the boxes
at once, or clear all the checked boxes at
once.

Closes https://github.com/openSUSE/osem/issues/2022
This commit is contained in:
snpd 2019-03-19 02:43:04 +05:30
parent 0197ed3c46
commit efccbc0597

View file

@ -8,6 +8,13 @@
.col-md-12
= f.inputs name: 'Components' do
%ul.fa-ul
%li
%th
%button.btn.btn-default#select-all{ type: "button" }
Select All
%th
%button.btn.btn-default#unselect-all{ type: "button" }
Unselect All
%li
= f.input :include_cfp, label: 'Display call for papers and call for tracks, while open', input_html: { checked: params[:action] == 'new' || @splashpage.try(:include_cfp) }
%li
@ -45,3 +52,15 @@
.col-md-12
%p.text-right
= f.submit 'Save Changes', class: 'btn btn-primary'
:javascript
$(document).ready(function(){
$('#select-all').click(function(event) {
var parent = $(this).parents('.inputs:last');
parent.find('.input.checkbox input[type=checkbox]').prop('checked',true);
});
$('#unselect-all').click(function(event) {
var parent = $(this).parents('.inputs:last');
parent.find('.input.checkbox input[type=checkbox]').prop('checked',false);
});
});