提交 | 用户 | 时间
|
1ac2bc
|
1 |
/* |
懒 |
2 |
* Activiti Modeler component part of the Activiti project |
|
3 |
* Copyright 2005-2014 Alfresco Software, Ltd. All rights reserved. |
|
4 |
* |
|
5 |
* This library is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU Lesser General Public |
|
7 |
* License as published by the Free Software Foundation; either |
|
8 |
* version 2.1 of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This library is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 |
* Lesser General Public License for more details. |
|
14 |
|
|
15 |
* You should have received a copy of the GNU Lesser General Public |
|
16 |
* License along with this library; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
18 |
*/ |
|
19 |
'use strict'; |
|
20 |
|
|
21 |
angular.module('activitiModeler') |
|
22 |
.controller('EditorUnsavedChangesPopupCrtl', ['$rootScope', '$scope', '$http', '$location', '$window', function ($rootScope, $scope, $http, $location, $window) { |
|
23 |
|
|
24 |
$scope.ok = function () { |
|
25 |
if ($scope.handleResponseFunction) { |
|
26 |
$scope.handleResponseFunction(true); |
|
27 |
|
|
28 |
// Also clear any 'onbeforeunload', added by oryx |
|
29 |
$window.onbeforeunload = undefined; |
|
30 |
} |
|
31 |
$scope.$hide(); |
|
32 |
}; |
|
33 |
|
|
34 |
$scope.cancel = function () { |
|
35 |
if ($scope.handleResponseFunction) { |
|
36 |
$scope.handleResponseFunction(false); |
|
37 |
} |
|
38 |
$scope.$hide(); |
|
39 |
}; |
|
40 |
}]); |
|
41 |
|
|
42 |
activitiModule |
|
43 |
.directive('autoFocus', ['$timeout', '$parse', function($timeout, $parse) { |
|
44 |
return { |
|
45 |
restrict: 'AC', |
|
46 |
compile: function($element, attr) { |
|
47 |
|
|
48 |
return function(_scope, _element, _attrs) { |
|
49 |
var firstChild = (_attrs.focusFirstChild !== undefined); |
|
50 |
$timeout(function () { |
|
51 |
if (firstChild) { |
|
52 |
// look for first input-element in child-tree and focus that |
|
53 |
var inputs = _element.find('input'); |
|
54 |
if (inputs && inputs.length > 0) { |
|
55 |
inputs[0].focus(); |
|
56 |
} |
|
57 |
} else { |
|
58 |
// Focus element where the directive is put on |
|
59 |
_element[0].focus(); |
|
60 |
} |
|
61 |
}, 100); |
|
62 |
} |
|
63 |
} |
|
64 |
}; |
|
65 |
}]); |