source: main/kofacustom.pcn/trunk/layout/static/js/file-upload.js @ 14195

Last change on this file since 14195 was 11706, checked in by Henrik Bettermann, 10 years ago
  • Remove waeup.kofa from sources. Use waeup.kofa PyPI package instead.
  • Copy layout folder from waeup.kofa. kofacustom.sampleuni uses its own Diazo layout.
File size: 586 bytes
Line 
1$(document)
2        .on('change', '.btn-file :file', function() {
3                var input = $(this),
4                numFiles = input.get(0).files ? input.get(0).files.length : 1,
5                label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
6                input.trigger('fileselect', [numFiles, label]);
7});
8
9$(document).ready( function() {
10        $('.btn-file :file').on('fileselect', function(event, numFiles, label) {
11
12                var input = $(this).parents('.input-group').find(':text'),
13                        log = numFiles > 1 ? numFiles + ' files selected' : label;
14
15                if( input.length ) {
16                        input.val(log);
17                } else {
18                        if( log ) alert(log);
19                }
20        });
21});
Note: See TracBrowser for help on using the repository browser.