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:
parent
0197ed3c46
commit
efccbc0597
1 changed files with 19 additions and 0 deletions
|
|
@ -8,6 +8,13 @@
|
||||||
.col-md-12
|
.col-md-12
|
||||||
= f.inputs name: 'Components' do
|
= f.inputs name: 'Components' do
|
||||||
%ul.fa-ul
|
%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
|
%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) }
|
= 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
|
%li
|
||||||
|
|
@ -45,3 +52,15 @@
|
||||||
.col-md-12
|
.col-md-12
|
||||||
%p.text-right
|
%p.text-right
|
||||||
= f.submit 'Save Changes', class: 'btn btn-primary'
|
= 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);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue