do not require confirm action on destroyRecord from a modal for new non persisted records
This commit is contained in:
@@ -118,14 +118,20 @@ export default Ember.Component.extend
|
||||
if my_scope.get('router.globals.current_route.path')?.match("^#{flat_model_name}.show")
|
||||
my_scope.get('router').transitionTo flat_model_name
|
||||
|
||||
@modal 'confirm',
|
||||
title_path: @get('modal_options.destroy_text_path') || 'general.destroy.are_you_sure'
|
||||
model: @get('model')
|
||||
ok: ->
|
||||
model = @get("model")
|
||||
model = model.get("_content") if model.__changeset__
|
||||
model.destroyRecord().then -> destroy_callback.call(my_scope, model)
|
||||
@send 'closeModal' unless @preventClose
|
||||
if @get('model.isNew')
|
||||
model = @get('model')
|
||||
model = model.get("_content") if model.__changeset__
|
||||
model.destroyRecord().then -> destroy_callback.call(my_scope, model)
|
||||
@send 'closeModal' unless @preventClose
|
||||
else
|
||||
@modal 'confirm',
|
||||
title_path: @get('modal_options.destroy_text_path') || 'general.destroy.are_you_sure'
|
||||
model: @get('model')
|
||||
ok: ->
|
||||
model = @get("model")
|
||||
model = model.get("_content") if model.__changeset__
|
||||
model.destroyRecord().then -> destroy_callback.call(my_scope, model)
|
||||
@send 'closeModal' unless @preventClose
|
||||
|
||||
closeModal: ->
|
||||
container = Ember.getOwner(@)
|
||||
|
||||
Reference in New Issue
Block a user