Separate UI elements from cryptpad-common
This commit is contained in:
@@ -2,8 +2,10 @@ define([
|
||||
'jquery',
|
||||
'/file/file-crypto.js',
|
||||
'/common/common-thumbnail.js',
|
||||
'/common/common-interface.js',
|
||||
|
||||
'/bower_components/tweetnacl/nacl-fast.min.js',
|
||||
], function ($, FileCrypto, Thumb) {
|
||||
], function ($, FileCrypto, Thumb, UI) {
|
||||
var Nacl = window.nacl;
|
||||
var module = {};
|
||||
|
||||
@@ -123,7 +125,7 @@ define([
|
||||
window.open(origin + $link.attr('href'), '_blank');
|
||||
});
|
||||
var title = metadata.name;
|
||||
Cryptpad.log(Messages._getKey('upload_success', [title]));
|
||||
UI.log(Messages._getKey('upload_success', [title]));
|
||||
common.prepareFeedback('upload')();
|
||||
|
||||
if (config.onUploaded) {
|
||||
@@ -140,18 +142,18 @@ define([
|
||||
queue.next();
|
||||
if (e === 'TOO_LARGE') {
|
||||
// TODO update table to say too big?
|
||||
return void Cryptpad.alert(Messages.upload_tooLarge);
|
||||
return void UI.alert(Messages.upload_tooLarge);
|
||||
}
|
||||
if (e === 'NOT_ENOUGH_SPACE') {
|
||||
// TODO update table to say not enough space?
|
||||
return void Cryptpad.alert(Messages.upload_notEnoughSpace);
|
||||
return void UI.alert(Messages.upload_notEnoughSpace);
|
||||
}
|
||||
console.error(e);
|
||||
return void Cryptpad.alert(Messages.upload_serverError);
|
||||
return void UI.alert(Messages.upload_serverError);
|
||||
};
|
||||
|
||||
onPending = function (cb) {
|
||||
Cryptpad.confirm(Messages.upload_uploadPending, cb);
|
||||
UI.confirm(Messages.upload_uploadPending, cb);
|
||||
};
|
||||
|
||||
file.noStore = config.noStore;
|
||||
@@ -161,7 +163,7 @@ define([
|
||||
console.log('Upload started...');
|
||||
});
|
||||
} catch (e) {
|
||||
Cryptpad.alert(Messages.upload_serverError);
|
||||
UI.alert(Messages.upload_serverError);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -260,7 +262,7 @@ define([
|
||||
|
||||
var onFileDrop = File.onFileDrop = function (file, e) {
|
||||
if (!common.isLoggedIn()) {
|
||||
return Cryptpad.alert(common.Messages.upload_mustLogin);
|
||||
return UI.alert(common.Messages.upload_mustLogin);
|
||||
}
|
||||
|
||||
Array.prototype.slice.call(file).forEach(function (d) {
|
||||
|
||||
Reference in New Issue
Block a user