Add destroyRecord route action
This commit is contained in:
@@ -168,3 +168,15 @@ export default Ember.Mixin.create ApplicationRouteMixin,
|
||||
url: "#{config.apiHost}/users/sign_out"
|
||||
type: 'DELETE'
|
||||
dataType: 'json'
|
||||
|
||||
destroyRecord: (model, options = {}) ->
|
||||
return unless model
|
||||
model = model.get("_content") if model.__changeset__
|
||||
@send 'openModal', 'confirm',
|
||||
title_path: options.destroy_text_path || 'general.destroy.are_you_sure'
|
||||
model: model
|
||||
body: options.body
|
||||
ok: ->
|
||||
@get('model').destroyRecord()
|
||||
@send 'closeModal' unless @preventClose
|
||||
false
|
||||
|
||||
@@ -108,6 +108,7 @@ export default Ember.Component.extend
|
||||
else
|
||||
model.rollbackAttributes() if typeof model.rollbackAttributes is 'function'
|
||||
@send 'close'
|
||||
|
||||
destroyRecord: ->
|
||||
my_scope = @
|
||||
destroy_callback = @get('modal_options.destroy_callback') || ->
|
||||
|
||||
Reference in New Issue
Block a user