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.7.10 _includes/buttons/upload-button.html
dta_rapid-0.7.9 _includes/buttons/upload-button.html
dta_rapid-0.7.8 _includes/buttons/upload-button.html
dta_rapid-0.7.7 _includes/buttons/upload-button.html
dta_rapid-0.7.6 _includes/buttons/upload-button.html
dta_rapid-0.7.5 _includes/buttons/upload-button.html
dta_rapid-0.7.4 _includes/buttons/upload-button.html
dta_rapid-0.7.3 _includes/buttons/upload-button.html
dta_rapid-0.7.2 _includes/buttons/upload-button.html
dta_rapid-0.7.1 _includes/buttons/upload-button.html
dta_rapid-0.7.0 _includes/buttons/upload-button.html
dta_rapid-0.6.6 _includes/buttons/upload-button.html
dta_rapid-0.6.5 _includes/buttons/upload-button.html
dta_rapid-0.6.4 _includes/buttons/upload-button.html
dta_rapid-0.6.3 _includes/buttons/upload-button.html
dta_rapid-0.6.2 _includes/buttons/upload-button.html
dta_rapid-0.6.1 _includes/buttons/upload-button.html
dta_rapid-0.6.0 _includes/buttons/upload-button.html
dta_rapid-0.5.8 _includes/buttons/upload-button.html
dta_rapid-0.5.7 _includes/buttons/upload-button.html