Browse Source

Added errors, improved file versions

master
Igor Zhukov 10 years ago
parent
commit
2c64d5a2f0
  1. 12
      app/css/app.css
  2. BIN
      app/favicon.ico
  3. BIN
      app/img/placeholders/DialogListAvatarSystem@2x.png
  4. 13
      app/index.html
  5. 2
      app/js/app.js
  6. 9
      app/js/controllers.js
  7. 4
      app/js/directives.js
  8. 44
      app/js/services.js
  9. 17
      app/partials/error_modal.html
  10. 2
      app/partials/im.html
  11. 2
      app/partials/login.html

12
app/css/app.css

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
html {
background: #dee4e9 url(../img/bg_tile.png?1) 0 0 repeat;
background-size: 300px 468px;
/*background-size: 300px 468px;*/
/*background: #dee4e9 url(../img/bg_full.png) 0 0 no-repeat;*/
/*background-size: cover;*/
@ -1103,6 +1103,7 @@ img.img_fullsize { @@ -1103,6 +1103,7 @@ img.img_fullsize {
.chat_modal_window .modal-dialog {
max-width: 506px;
}
.chat_modal_wrap .modal-body {
padding: 23px 25px 15px;
}
@ -1242,4 +1243,13 @@ img.img_fullsize { @@ -1242,4 +1243,13 @@ img.img_fullsize {
/*-moz-border-radius : 0;
-webkit-border-radius : 0;
border-radius : 0;*/
}
.error_modal_window .modal-dialog {
max-width: 400px;
}
.error_modal_description {
text-align: center;
padding: 40px 20px;
}

BIN
app/favicon.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 959 B

BIN
app/img/placeholders/DialogListAvatarSystem@2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

13
app/index.html

@ -7,7 +7,8 @@ @@ -7,7 +7,8 @@
<link rel="stylesheet" href="vendor/angular/angular-csp.css"/>
<link rel="stylesheet" href="vendor/bootstrap/css/bootstrap.css"/>
<link rel="stylesheet" href="vendor/jquery.nanoscroller/nanoscroller.css"/>
<link rel="stylesheet" href="css/app.css?1"/>
<link rel="stylesheet" href="css/app.css?2"/>
<link rel="icon" href="favicon.ico" type="image/x-icon">
</head>
<body>
@ -35,11 +36,11 @@ @@ -35,11 +36,11 @@
<script type="text/javascript" src="js/lib/mtproto.js?1"></script>
<script type="text/javascript" src="js/util.js"></script>
<script type="text/javascript" src="js/app.js"></script>
<script type="text/javascript" src="js/services.js?3"></script>
<script type="text/javascript" src="js/controllers.js?2"></script>
<script type="text/javascript" src="js/filters.js?1"></script>
<script type="text/javascript" src="js/directives.js?3"></script>
<script type="text/javascript" src="js/app.js?1"></script>
<script type="text/javascript" src="js/services.js?4"></script>
<script type="text/javascript" src="js/controllers.js?3"></script>
<script type="text/javascript" src="js/filters.js?2"></script>
<script type="text/javascript" src="js/directives.js?4"></script>
</body>
</html>

2
app/js/app.js

@ -49,7 +49,7 @@ config(['$locationProvider', '$routeProvider', '$compileProvider', function($loc @@ -49,7 +49,7 @@ config(['$locationProvider', '$routeProvider', '$compileProvider', function($loc
// $locationProvider.html5Mode(true);
$routeProvider.when('/', {templateUrl: 'partials/welcome.html', controller: 'AppWelcomeController'});
$routeProvider.when('/login', {templateUrl: 'partials/login.html?1', controller: 'AppLoginController'});
$routeProvider.when('/im', {templateUrl: 'partials/im.html', controller: 'AppIMController', reloadOnSearch: false});
$routeProvider.when('/im', {templateUrl: 'partials/im.html?1', controller: 'AppIMController', reloadOnSearch: false});
$routeProvider.otherwise({redirectTo: '/'});
}]);

9
app/js/controllers.js

@ -21,7 +21,7 @@ angular.module('myApp.controllers', []) @@ -21,7 +21,7 @@ angular.module('myApp.controllers', [])
});
})
.controller('AppLoginController', function ($scope, $location, MtpApiManager) {
.controller('AppLoginController', function ($scope, $location, MtpApiManager, ErrorService) {
var dcID = 1;
$scope.credentials = {};
@ -46,6 +46,11 @@ angular.module('myApp.controllers', []) @@ -46,6 +46,11 @@ angular.module('myApp.controllers', [])
}, {dcID: dcID}).then(function (sentCode) {
$scope.progress.enabled = false;
if (!sentCode.phone_registered) {
ErrorService.showSimpleError('No account', 'Sorry, there is no Telegram account for ' + $scope.credentials.phone_number + '. Please sign up using our mobile apps.');
return false;
}
$scope.credentials.phone_code_hash = sentCode.phone_code_hash;
$scope.credentials.phone_occupied = sentCode.phone_registered;
$scope.error = {};
@ -88,7 +93,7 @@ angular.module('myApp.controllers', []) @@ -88,7 +93,7 @@ angular.module('myApp.controllers', [])
$scope.progress.enabled = false;
if (error.code == 400 && error.type == 'PHONE_NUMBER_UNOCCUPIED') {
return $scope.logIn(true);
} else if (error.code == 400 && error.type == 'PHONE_NUMBER_UNOCCUPIED') {
} else if (error.code == 400 && error.type == 'PHONE_NUMBER_OCCUPIED') {
return $scope.logIn(false);
}

4
app/js/directives.js

@ -16,7 +16,7 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -16,7 +16,7 @@ angular.module('myApp.directives', ['myApp.filters'])
restrict: 'AE',
scope: true,
translude: false,
templateUrl: 'partials/dialog.html'
templateUrl: 'partials/dialog.html?1'
};
})
@ -25,7 +25,7 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -25,7 +25,7 @@ angular.module('myApp.directives', ['myApp.filters'])
restrict: 'AE',
scope: true,
translude: false,
templateUrl: 'partials/message.html?1'
templateUrl: 'partials/message.html?2'
};
})

44
app/js/services.js

@ -160,6 +160,12 @@ angular.module('myApp.services', []) @@ -160,6 +160,12 @@ angular.module('myApp.services', [])
function getUserPhoto(id, placeholder) {
var user = getUser(id);
if (id == 333000) {
return {
placeholder: 'img/placeholders/DialogListAvatarSystem@2x.png'
}
};
return {
placeholder: 'img/placeholders/' + placeholder + 'Avatar'+((Math.abs(id) % 8) + 1)+'@2x.png',
location: user && user.photo && user.photo.photo_small
@ -320,7 +326,7 @@ angular.module('myApp.services', []) @@ -320,7 +326,7 @@ angular.module('myApp.services', [])
scope.chatID = chatID;
var modalInstance = $modal.open({
templateUrl: 'partials/chat_modal.html',
templateUrl: 'partials/chat_modal.html?1',
controller: 'ChatModalController',
windowClass: 'chat_modal_window',
scope: scope,
@ -1309,9 +1315,9 @@ angular.module('myApp.services', []) @@ -1309,9 +1315,9 @@ angular.module('myApp.services', [])
scope.videoID = videoID;
scope.progress = {enabled: false};
scope.player = {};
scope.close = function () {
modalInstance.close();
}
// scope.close = function () {
// modalInstance.close();
// }
var modalInstance = $modal.open({
templateUrl: 'partials/video_modal.html',
@ -1945,3 +1951,33 @@ angular.module('myApp.services', []) @@ -1945,3 +1951,33 @@ angular.module('myApp.services', [])
notificationsShown = [];
}
})
.service('ErrorService', function ($rootScope, $modal) {
function showError (templateUrl, params, options) {
var scope = $rootScope.$new();
angular.extend(scope, params);
return $modal.open({
templateUrl: templateUrl,
// controller: 'ErrorModalController',
scope: scope,
windowClass: options.windowClass || ''
});
}
function showSimpleError (title, description) {
return showError ('partials/error_modal.html', {
title: title,
description: description
}, {
windowClass: 'error_modal_window'
});
};
return {
showError: showError,
showSimpleError: showSimpleError
}
})

17
app/partials/error_modal.html

@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
<div class="error_modal_wrap">
<div class="modal-header">
<a class="modal-close-link" ng-click="$close()">Close</a>
<h4 class="modal-title">{{title}}</h4>
</div>
<div class="modal-body">
<div class="error_modal_description">
{{description}}
</div>
</div>
</div>

2
app/partials/im.html

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
<div ng-include="'partials/head.html'"></div>
<div ng-include="'partials/head.html?1'"></div>
<div class="im_page_wrap">

2
app/partials/login.html

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
<div ng-include="'partials/head.html'"></div>
<div ng-include="'partials/head.html?1'"></div>
<div class="login_form_wrap">

Loading…
Cancel
Save