Skip to content

Instantly share code, notes, and snippets.

@ronco
Last active August 29, 2015 14:11
Show Gist options
  • Save ronco/212f09852509b5f38785 to your computer and use it in GitHub Desktop.
Save ronco/212f09852509b5f38785 to your computer and use it in GitHub Desktop.
Ember Widgets Modal custom actions
App.ApplicationController = Ember.Controller.extend
actions:
showModal: ->
Ember.Widgets.ModalComponent.popup
targetObject: this
contentViewClass: 'App.SampleModalContentView'
confirm: "modalConfirm"
cancel: "modalCancel"
maybeAction: "modalMaybe"
modalConfirm: -> console.log("Modal Confirm!")
modalCancel: -> console.log("Modal Cancel!")
modalMaybe: -> console.log("Modal Maybe!")
<button {{action 'sendConfirm'}}>Confirm</button>
<button {{action 'customAction' 'maybeAction'}}>Maybe</button>
Ember.Widgets.ModalComponent.reopen
actions:
customAction: ->
@sendAction.apply(@, arguments)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment