Pārlūkot izejas kodu

error dialog on error on dialog ok cancel

tags/0.1.0
Robin Thoni 9 gadus atpakaļ
vecāks
revīzija
4cc16bd1d1

+ 3
- 3
src/modals/dialogerror.html Parādīt failu

@@ -5,8 +5,8 @@
5 5
         <div class="clearfix"></div>
6 6
     </div>
7 7
     <div class="modal-footer">
8
-        <button type="submit" class="btn btn-pink" ng-click="$dismiss()" ng-show="!showLogin">Close</button>
9
-        <button type="submit" class="btn btn-default" ng-click="$dismiss()" ng-show="showLogin">Cancel</button>
10
-        <button type="button" class="btn btn-pink" ng-click="reconnect()" ng-show="showLogin">Login</button>
8
+        <button type="submit" class="btn btn-default" ng-click="$close()" ng-show="!showLogin">Close</button>
9
+        <button type="submit" class="btn btn-default" ng-click="$close()" ng-show="showLogin">Cancel</button>
10
+        <button type="button" class="btn btn-default" ng-click="reconnect()" ng-show="showLogin">Login</button>
11 11
     </div>
12 12
 </div>

+ 3
- 3
src/modals/dialogerrorhelper.js Parādīt failu

@@ -23,7 +23,7 @@
23 23
             luticateDialogErrorHelper.errorDialog = function(data)
24 24
             {
25 25
                 var message = luticateDialogErrorHelper.errorMessage(data);
26
-                dialogs.create('/luticateUtils/dialogerror.html', 'luticateDialogError', {message: message, data: data}, {keyboard: false, backdrop: 'static'});
26
+                return dialogs.create('/luticateUtils/dialogerror.html', 'luticateDialogError', {message: message, data: data}, {keyboard: false, backdrop: 'static'});
27 27
             };
28 28
 
29 29
             return luticateDialogErrorHelper;
@@ -39,8 +39,8 @@ angular.module("luticateUtils").run(["$templateCache", function($templateCache)
39 39
         '        <div class="clearfix"></div>' +
40 40
         '        </div>' +
41 41
         '        <div class="modal-footer">' +
42
-        '        <button type="submit" class="btn btn-pink" ng-click="$dismiss()" ng-show="!showLogin">Close</button>' +
43
-        '        <button type="submit" class="btn btn-default" ng-click="$dismiss()" ng-show="showLogin">Cancel</button>' +
42
+        '        <button type="submit" class="btn btn-pink" ng-click="$close()" ng-show="!showLogin">Close</button>' +
43
+        '        <button type="submit" class="btn btn-default" ng-click="$close()" ng-show="showLogin">Cancel</button>' +
44 44
         '        <button type="button" class="btn btn-pink" ng-click="reconnect()" ng-show="showLogin">Login</button>' +
45 45
         '        </div>' +
46 46
         '        </div>')

+ 2
- 2
src/modals/dialogokcancel.html Parādīt failu

@@ -6,9 +6,9 @@
6 6
                 <ng-transclude></ng-transclude>
7 7
             </div>
8 8
             <div class="clearfix"></div>
9
-            <span class="error" ng-show="submitted">
9
+            <!--<span class="error" ng-show="submitted">
10 10
                 <p class="error">{{ errorString }}</p>
11
-            </span>
11
+            </span>-->
12 12
         </div>
13 13
         <div class="modal-footer">
14 14
             <button type="button" class="btn btn-default" ng-click="__cancel()">Cancel</button>

+ 11
- 12
src/modals/dialogokcancel.js Parādīt failu

@@ -4,8 +4,8 @@
4 4
 
5 5
 
6 6
 angular.module('luticateUtils')
7
-    .directive('dialogOkCancel', [
8
-        function () {
7
+    .directive('dialogOkCancel', ['luticateDialogErrorHelper',
8
+        function (luticateDialogErrorHelper) {
9 9
             return {
10 10
                 restrict: 'EA',
11 11
                 transclude: true,
@@ -15,12 +15,10 @@ angular.module('luticateUtils')
15 15
                     $scope.model = {};
16 16
                     $scope.pending = false;
17 17
                     $scope.submitted = false;
18
-                    $scope.errorString = "";
19 18
 
20 19
                     $scope.__submit = function()
21 20
                     {
22 21
                         $scope.submitted = true;
23
-                        $scope.errorString = "";
24 22
                         if ($scope.form.$valid) {
25 23
                             $scope.pending = true;
26 24
                             $scope.promise = $scope.submitForm();
@@ -38,12 +36,13 @@ angular.module('luticateUtils')
38 36
                                         if ($scope.onError) {
39 37
                                             $scope.onError(error);
40 38
                                         }
41
-                                        if (error.Data) {
42
-                                            $scope.errorString = error.Data;
43
-                                        }
44
-                                        else {
45
-                                            $scope.errorString = error;
46
-                                        }
39
+                                        luticateDialogErrorHelper.errorDialog(error)
40
+                                            .result.then(function(data)
41
+                                            {
42
+                                            }, function(error2)
43
+                                            {
44
+                                                $scope.$dismiss(error);
45
+                                            });
47 46
                                         $scope.pending = false;
48 47
                                     });
49 48
                             }
@@ -76,9 +75,9 @@ angular.module("luticateUtils").run(["$templateCache", function($templateCache)
76 75
 '    <ng-transclude></ng-transclude>' +
77 76
 '    </div>' +
78 77
 '    <div class="clearfix"></div>' +
79
-'    <span class="error" ng-show="submitted">' +
78
+/*'    <span class="error" ng-show="submitted">' +
80 79
 '    <p class="error">{{ errorString }}</p>' +
81
-'</span>' +
80
+'</span>' +*/
82 81
 '</div>' +
83 82
 '<div class="modal-footer">' +
84 83
 '    <button type="button" class="btn btn-default" ng-click="__cancel()">Cancel</button>' +

Notiek ielāde…
Atcelt
Saglabāt