Sha256: b18efff0fb9a3d7497bb235249e94a8c031d7016139cef8c408be2e7d4a4f1b7

Contents?: true

Size: 941 Bytes

Versions: 1

Compression:

Stored size: 941 Bytes

Contents

const AppRouter = {
  new_email_context_with_template_path: (slug) => `/manager/email_contexts/new_with_template/${slug}`
}

$(document).ready(() => {

  if ($(".email-contexts--form").length) {
    $("#ish_email_context_email_template_id").on('change', (ev) => {
      const val = ev.target.value
      window.location.href = AppRouter.new_email_context_with_template_path(val)
    })

    $("#ish_email_context_type").on('change', (ev) => {
      const val = ev.target.value
      if (val == 'TYPE_CAMPAIGN') {
        $(".email-contexts--form .TYPE_SINGLE").css('display', 'none')
      } else {
        $(".email-contexts--form .TYPE_SINGLE").css('display', 'block')
      }
    })
    // on page load:
    if ($("#ish_email_context_type").val() == 'TYPE_CAMPAIGN') {
      $(".email-contexts--form .TYPE_SINGLE").css('display', 'none')
    } else {
      $(".email-contexts--form .TYPE_SINGLE").css('display', 'block')
    }

  }

})

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ish_manager-0.1.8.358 app/assets/javascripts/ish_manager/email_contexts.js