Browse Source

Fix #230 - paste images with new confirm boxes

master
Igor Zhukov 11 years ago
parent
commit
b9a292fe0c
  1. 10
      app/js/directives.js
  2. 10
      app/partials/confirm_modal.html

10
app/js/directives.js

@ -368,7 +368,7 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -368,7 +368,7 @@ angular.module('myApp.directives', ['myApp.filters'])
})
.directive('mySendForm', function ($timeout, AppConfigManager) {
.directive('mySendForm', function ($timeout, AppConfigManager, ErrorService) {
return {
link: link,
@ -530,13 +530,11 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -530,13 +530,11 @@ angular.module('myApp.directives', ['myApp.filters'])
var blob = new Blob([array], {type: contentType});
if (safeConfirm('Are you sure to send file(s) from clipboard?')) {
$scope.$apply(function () {
ErrorService.confirm({type: 'FILE_CLIPBOARD_PASTE'}).then(function () {
$scope.draftMessage.files = [blob];
$scope.draftMessage.isMedia = true;
});
}
}
};
function onPasteEvent (e) {
@ -551,8 +549,8 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -551,8 +549,8 @@ angular.module('myApp.directives', ['myApp.filters'])
}
}
if (files.length && safeConfirm('Are you sure to send file(s) from clipboard?')) {
$scope.$apply(function () {
if (files.length > 0) {
ErrorService.confirm({type: 'FILES_CLIPBOARD_PASTE', files: files}).then(function () {
$scope.draftMessage.files = files;
$scope.draftMessage.isMedia = true;
});

10
app/partials/confirm_modal.html

@ -9,6 +9,14 @@ @@ -9,6 +9,14 @@
<span ng-switch-when="WEBOGRAM_UPDATED_RELOAD">A new version of Webogram is available. Load it?</span>
<span ng-switch-when="HISTORY_FLUSH">Are you sure? This can not be undone!</span>
<span ng-switch-when="TERMINATE_SESSIONS">Are you sure you want to log out all devices except for the current one?</span>
<span ng-switch-when="FILES_CLIPBOARD_PASTE">
<ng-pluralize count="files.length"
when="{'one': 'Are you sure to send file from clipboard?', 'other': 'Are you sure to send {} files from clipboard?'}">
</ng-pluralize>
</span>
<span ng-switch-when="FILE_CLIPBOARD_PASTE">
Are you sure to send file(s) from clipboard?
</span>
<span ng-switch-default ng-bind="message || 'Are you sure?'"></span>
</div>
@ -21,6 +29,8 @@ @@ -21,6 +29,8 @@
<button type="button" class="btn btn-primary" ng-switch="type" ng-click="$close()">
<span ng-switch-when="LOGOUT">Log Out</span>
<span ng-switch-when="HISTORY_FLUSH">Delete Chat</span>
<span ng-switch-when="FILES_CLIPBOARD_PASTE">Send</span>
<span ng-switch-when="FILE_CLIPBOARD_PASTE">Send</span>
<span ng-switch-default>OK</span>
</button>
</div>

Loading…
Cancel
Save