Sha256: afadea7d06ac5fe32cf4a8f99d2cb465a00c6fe63ad377970801ec3df4e5ce42

Contents?: true

Size: 822 Bytes

Versions: 30

Compression:

Stored size: 822 Bytes

Contents

<p>
  <div class="uikit-fileupload">
    <input id="{{ include.id }}" type="file" role="button" multiple/>
    <label class="uikit-btn uikit-btn--tertiary" for="{{ include.id }}"><span>{{ include.label }}</span></label>
  </div>
</p>

<script>
  Array.prototype.forEach.call(document.querySelectorAll('.uikit-fileupload input'), function(input) {
    var label	= input.nextElementSibling;
    var labelVal = label.innerHTML;

    input.addEventListener('change', function(e) {
      var fileName = '';

      if(this.files && this.files.length > 1)
        fileName = (this.files.length + ' files selected');
      else
        fileName = e.target.value.split('\\').pop();

      if(fileName)
        label.querySelector('span').innerHTML = fileName;
      else
        label.innerHTML = labelVal;
    });
  });
</script>

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
dta_rapid-0.5.6 _includes/buttons/upload-button.html
dta_rapid-0.5.5 _includes/buttons/upload-button.html
dta_rapid-0.5.4 _includes/buttons/upload-button.html
dta_rapid-0.5.3 _includes/buttons/upload-button.html
dta_rapid-0.5.2 _includes/buttons/upload-button.html
dta_rapid-0.5.1 _includes/buttons/upload-button.html
dta_rapid-0.5.0 _includes/buttons/upload-button.html
dta_rapid-0.4.5 _includes/buttons/upload-button.html
dta_rapid-0.4.4 _includes/buttons/upload-button.html
dta_rapid-0.4.3 _includes/buttons/upload-button.html