InquireViaPhoneModalView = require '../inquire_via_phone/index.coffee'

module.exports = ($el) ->
  $el
    .find '.js-artwork-partner-stub-inquire-via-phone'
    .click (e) ->
      e.preventDefault()
      @modal = new InquireViaPhoneModalView
        width: '500px'
        copy:
          login: 'Log in to Artsy to call gallery'
          signup: 'Create an Artsy account to call gallery'
          register: 'Create an Artsy account to call gallery'
        artistIds: JSON.parse(e.target.dataset.artist_ids)
        userData:
          partner: JSON.parse(e.target.dataset.partner)
  $el
    .find '.js-artwork-partner-stub-phone-toggle'
    .click (e) ->
      e.preventDefault()
      $(this).hide()
      $el
        .find '.js-artwork-partner-stub-phone-toggleable'
        .show()

InquireViaPhoneModalView = require '../inquire_via_phone/index.coffee'

module.exports = ($el) ->
  $el
    .find '.js-artwork-partner-stub-inquire-via-phone'
    .click (e) ->
      e.preventDefault()
      @modal = new InquireViaPhoneModalView
        width: '500px'
        copy:
          login: 'Log in to Artsy to call gallery'
          signup: 'Create an Artsy account to call gallery'
          register: 'Create an Artsy account to call gallery'
        artistIds: JSON.parse(e.currentTarget.getAttribute('data-artist_ids'))
        userData:
          partner: JSON.parse(e.currentTarget.getAttribute('data-partner'))
  $el
    .find '.js-artwork-partner-stub-phone-toggle'
    .click (e) ->
      e.preventDefault()
      $(this).hide()
      $el
        .find '.js-artwork-partner-stub-phone-toggleable'
        .show()

Use currentTarget and getAttribute for older browsers
Use currentTarget and getAttribute for older browsers

 * #currentTarget gives the element that the event listener is attached to while #target could be something else.
 * Older browsers don't have #dataset implemented and #getAttribute should be used instead.
