Browse Source

error dialog on error on dialog ok cancel

tags/0.1.0
Robin Thoni 9 years ago
parent
commit
4cc16bd1d1

+ 3
- 3
src/modals/dialogerror.html View File

5
         <div class="clearfix"></div>
5
         <div class="clearfix"></div>
6
     </div>
6
     </div>
7
     <div class="modal-footer">
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
     </div>
11
     </div>
12
 </div>
12
 </div>

+ 3
- 3
src/modals/dialogerrorhelper.js View File

23
             luticateDialogErrorHelper.errorDialog = function(data)
23
             luticateDialogErrorHelper.errorDialog = function(data)
24
             {
24
             {
25
                 var message = luticateDialogErrorHelper.errorMessage(data);
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
             return luticateDialogErrorHelper;
29
             return luticateDialogErrorHelper;
39
         '        <div class="clearfix"></div>' +
39
         '        <div class="clearfix"></div>' +
40
         '        </div>' +
40
         '        </div>' +
41
         '        <div class="modal-footer">' +
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
         '        <button type="button" class="btn btn-pink" ng-click="reconnect()" ng-show="showLogin">Login</button>' +
44
         '        <button type="button" class="btn btn-pink" ng-click="reconnect()" ng-show="showLogin">Login</button>' +
45
         '        </div>' +
45
         '        </div>' +
46
         '        </div>')
46
         '        </div>')

+ 2
- 2
src/modals/dialogokcancel.html View File

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

+ 11
- 12
src/modals/dialogokcancel.js View File

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

Loading…
Cancel
Save