Newer
Older
dmpopidor / app / javascript / views / plans / download.js
@Bodacious Bodacious on 19 Oct 2018 559 bytes Update asset structure with webpacker gem
$(() => {
  // Add a target="_blank" to the form when PDF or HTML are selected
  // Hide the PDF Formatting section if 'pdf' is not the desired format
  $('#download_form select#format').on('change', (e) => {
    if ($(e.currentTarget).val() === 'pdf' || $(e.currentTarget).val() === 'html') {
      $('#download_form').attr('target', '_blank');
    } else {
      $('#download_form').removeAttr('target');
    }

    if ($(e.currentTarget).val() === 'pdf') {
      $('#pdf-formatting').show();
    } else {
      $('#pdf-formatting').hide();
    }
  });
});