Merge pull request #20 from seripap/bugfix/styles

General language and style cleanup
This commit is contained in:
Alan Friedman 2016-02-25 19:04:34 -05:00
commit b6635aa5db
5 changed files with 16 additions and 11 deletions

View File

@ -299,9 +299,9 @@ export default class Darkwire {
} }
generateMessage(fileId, fileName, messageType) { generateMessage(fileId, fileName, messageType) {
let message = '<div id="file-transfer-request-' + fileId + '">is attempting to send you ' + fileName + ' (' + messageType + ')'; let message = '<div id="file-transfer-request-' + fileId + '">is attempting to send you <strong>' + fileName + '</strong> (' + messageType + ')';
message += '<br><small class="file-disclaimer"><strong>WARNING: We cannot strictly verify the integrity of this file, its recipients or its owners. By accepting this file, you are liable for any risks that may arise from reciving this file.</strong></small>'; message += '<br><small class="file-disclaimer"><strong>WARNING: We cannot strictly verify the integrity of this file, its recipients or its owners. By accepting this file, you are liable for any risks that may arise from reciving this file.</strong></small>';
message += '<br><a onclick="triggerFileDownload(this);" data-file="' + fileId + '">Accept File</a></div>'; message += '<br><a class="file-download" onclick="triggerFileDownload(this);" data-file="' + fileId + '">Accept File</a></div>';
return message; return message;
} }

View File

@ -44,7 +44,7 @@ export default class FileHandler {
} }
let fileId = uuid.v4(); let fileId = uuid.v4();
let confirmMessage = '<span id="transfer-' + fileId + '">You are about to send ' + file.name + ' to all parties in this chat. <a onclick="triggerFileTransfer(this);" data-file="' + fileId + '">Confirm</a> | <a onclick="triggerFileDestroy(this)" data-file="' + fileId + '">Cancel</a></span>'; let confirmMessage = '<span id="transfer-' + fileId + '" class="file-presend-prompt">You are about to send <strong>' + file.name + '</strong> to all participants in this chat. <a class="file-trigger-confirm" onclick="triggerFileTransfer(this);" data-file="' + fileId + '">Confirm</a> | <a class="file-trigger-cancel" onclick="triggerFileDestroy(this)" data-file="' + fileId + '">Cancel</a></span>';
let fileData = { let fileData = {
id: fileId, id: fileId,
file: file file: file
@ -81,7 +81,7 @@ export default class FileHandler {
fileName: file.name fileName: file.name
}; };
this.darkwire.encodeMessage(base64, fileType, additionalData).then((socketData) => { this.darkwire.encodeMessage(base64, fileType, additionalData).then((socketData) => {
this.chat.replaceMessage('#transfer-' + fileId, 'Sent ' + file.name); this.chat.replaceMessage('#transfer-' + fileId, 'Sent <strong>' + file.name + '</strong>');
this.socket.emit('new message', socketData); this.socket.emit('new message', socketData);
}); });
this.resetInput(); this.resetInput();
@ -93,7 +93,8 @@ export default class FileHandler {
destroyFile(fileId) { destroyFile(fileId) {
const file = _.findWhere(this.localFileQueue, {id: fileId}); const file = _.findWhere(this.localFileQueue, {id: fileId});
this.localFileQueue = _.without(this.localFileQueue, file); this.localFileQueue = _.without(this.localFileQueue, file);
return this.chat.replaceMessage('#transfer-' + fileId, 'The file transfer for ' + file.file.name + ' has been canceled.'); this.resetInput();
return this.chat.replaceMessage('#transfer-' + fileId, 'The file transfer for <strong>' + file.file.name + '</strong> has been canceled.');
} }
createBlob(base64, fileType) { createBlob(base64, fileType) {

View File

@ -173,7 +173,7 @@ $(function() {
let li; let li;
if (user.username === window.username) { if (user.username === window.username) {
// User is me // User is me
li = $('<li>' + user.username + ' <span class="you">(you)</span></li>').css('color', chat.getUsernameColor(user.username)); li = $('<li class="yourself">' + user.username + ' <span class="you">(you)</span></li>').css('color', chat.getUsernameColor(user.username));
} else { } else {
li = $('<li>' + user.username + '</li>').css('color', chat.getUsernameColor(user.username)); li = $('<li>' + user.username + '</li>').css('color', chat.getUsernameColor(user.username));
} }
@ -259,7 +259,7 @@ $(function() {
} }
} }
darkwire.encodeMessage('Downloaded ' + file.additionalData.fileName, 'text').then((socketData) => { darkwire.encodeMessage('Accepted <strong>' + file.additionalData.fileName + '</strong>', 'text').then((socketData) => {
socket.emit('new message', socketData); socket.emit('new message', socketData);
}).catch((err) => { }).catch((err) => {
console.log(err); console.log(err);

View File

@ -74,6 +74,10 @@ p {
margin: 15px 0 15px; margin: 15px 0 15px;
} }
a {
cursor: pointer;
}
/* Typography */ /* Typography */
.bold { .bold {
font-family: "SourceCodePro-Bold", font-family: "SourceCodePro-Bold",

View File

@ -193,7 +193,7 @@ describe('Darkwire', () => {
browser.switchWindow(result.value[0], () => { browser.switchWindow(result.value[0], () => {
browser.waitForElementPresent('span.messageBody', 5000, () => { browser.waitForElementPresent('span.messageBody', 5000, () => {
browser.pause(5000); browser.pause(5000);
browser.assert.containsText('span.messageBody', 'You are about to send ricky.jpg to all parties in this chat. Confirm | Cancel'); browser.assert.containsText('span.messageBody', 'You are about to send ricky.jpg to all participants in this chat. Confirm | Cancel');
}); });
}); });
}); });
@ -202,9 +202,9 @@ describe('Darkwire', () => {
it('Should show sent confirmation message', () => { it('Should show sent confirmation message', () => {
browser.windowHandles((result) => { browser.windowHandles((result) => {
browser.switchWindow(result.value[0], () => { browser.switchWindow(result.value[0], () => {
browser.waitForElementPresent('span.messageBody a:first-child', 5000, () => { browser.waitForElementPresent('a.file-trigger-confirm', 5000, () => {
browser.click('span.messageBody a:first-child', () => { browser.click('a.file-trigger-confirm', () => {
browser.waitForElementNotPresent('span.messageBody a:first-child', 5000, () => { browser.waitForElementNotPresent('a.file-trigger-confirm', 5000, () => {
browser.assert.containsText('span.messageBody', 'Sent ricky.jpg'); browser.assert.containsText('span.messageBody', 'Sent ricky.jpg');
}); });
}); });