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

10
app/partials/confirm_modal.html

@ -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="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="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="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> <span ng-switch-default ng-bind="message || 'Are you sure?'"></span>
</div> </div>
@ -21,6 +29,8 @@
<button type="button" class="btn btn-primary" ng-switch="type" ng-click="$close()"> <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="LOGOUT">Log Out</span>
<span ng-switch-when="HISTORY_FLUSH">Delete Chat</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> <span ng-switch-default>OK</span>
</button> </button>
</div> </div>

Loading…
Cancel
Save