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")
|
if my_scope.get('router.globals.current_route.path')?.match("^#{flat_model_name}.show")
|
||||||
my_scope.get('router').transitionTo flat_model_name
|
my_scope.get('router').transitionTo flat_model_name
|
||||||
|
|
||||||
@modal 'confirm',
|
if @get('model.isNew')
|
||||||
title_path: @get('modal_options.destroy_text_path') || 'general.destroy.are_you_sure'
|
model = @get('model')
|
||||||
model: @get('model')
|
model = model.get("_content") if model.__changeset__
|
||||||
ok: ->
|
model.destroyRecord().then -> destroy_callback.call(my_scope, model)
|
||||||
model = @get("model")
|
@send 'closeModal' unless @preventClose
|
||||||
model = model.get("_content") if model.__changeset__
|
else
|
||||||
model.destroyRecord().then -> destroy_callback.call(my_scope, model)
|
@modal 'confirm',
|
||||||
@send 'closeModal' unless @preventClose
|
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: ->
|
closeModal: ->
|
||||||
container = Ember.getOwner(@)
|
container = Ember.getOwner(@)
|
||||||
|
|||||||
Reference in New Issue
Block a user