do not require confirm action on destroyRecord from a modal for new non persisted records

This commit is contained in:
2018-05-31 20:36:55 -03:00
parent 466d67e14a
commit 1c285f8299
+14 -8
View File
@@ -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(@)