mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-12 06:54:19 +01:00
28 lines
909 B
Plaintext
28 lines
909 B
Plaintext
'use strict'
|
|
|
|
Application.Services.factory 'dialogs', ["$modal", ($modal) ->
|
|
confirm: (options, success, error)->
|
|
defaultOpts =
|
|
templateUrl: '<%= asset_path "shared/confirm_modal.html" %>'
|
|
size: 'sm'
|
|
resolve:
|
|
object: ->
|
|
title: 'Titre de confirmation'
|
|
msg: 'Message de confiramtion'
|
|
controller: ['$scope', '$modalInstance', '$state', 'object', ($scope, $modalInstance, $state, object) ->
|
|
$scope.object = object
|
|
$scope.ok = ->
|
|
$modalInstance.close()
|
|
$scope.cancel = ->
|
|
$modalInstance.dismiss('cancel')
|
|
]
|
|
angular.extend(defaultOpts, options) if angular.isObject options
|
|
$modal.open defaultOpts
|
|
.result['finally'](null).then ->
|
|
if angular.isFunction(success)
|
|
success()
|
|
, ->
|
|
if angular.isFunction(error)
|
|
error()
|
|
]
|