diff --git a/www/poll/main.js b/www/poll/main.js
index a4d976901..e689d33a4 100644
--- a/www/poll/main.js
+++ b/www/poll/main.js
@@ -12,9 +12,11 @@ define([
'/common/notify.js',
'/bower_components/file-saver/FileSaver.min.js',
'/bower_components/jquery/dist/jquery.min.js',
-], function (Config, Messages, TextPatcher, Listmap, Crypto, Cryptpad, Hyperjson, Render, Toolbar) {
+], function (Config, Messages, TextPatcher, Listmap, Crypto, Cryptpad, Hyperjson, Renderer, Toolbar) {
var $ = window.jQuery;
+ var unlockHTML = '
';
+ var lockHTML = '
';
var HIDE_INTRODUCTION_TEXT = "hide_poll_text";
var defaultName;
@@ -26,6 +28,8 @@ define([
Cryptpad.errorLoadingScreen(Messages.websocketError);
};
+ var Render = Renderer(Cryptpad);
+
var APP = window.APP = {
Toolbar: Toolbar,
Hyperjson: Hyperjson,
@@ -88,6 +92,7 @@ define([
$('input[data-rt-id^="' + id + '"]').attr('disabled', 'disabled');
};
+
var styleUncommittedColumn = function () {
var id = APP.userid;
@@ -95,7 +100,7 @@ define([
$('input[disabled="disabled"][data-rt-id^="' + id + '"]').removeAttr('disabled');
$('input[type="checkbox"][data-rt-id^="' + id + '"]').addClass('enabled');
$('[data-rt-id="' + id + '"] ~ .edit').css('visibility', 'hidden');
- $('.lock[data-rt-id="' + id + '"]').html('🔓');
+ $('.lock[data-rt-id="' + id + '"]').html(unlockHTML);
if (isOwnColumnCommitted()) { return; }
$('[data-rt-id^="' + id + '"]').closest('td').addClass("uncommitted");
@@ -113,7 +118,7 @@ define([
$('input[disabled="disabled"][data-rt-id^="' + id + '"]').removeAttr('disabled');
$('input[type="checkbox"][data-rt-id^="' + id + '"]').addClass('enabled');
$('span.edit[data-rt-id="' + id + '"]').css('visibility', 'hidden');
- $('.lock[data-rt-id="' + id + '"]').html('🔓');
+ $('.lock[data-rt-id="' + id + '"]').html(unlockHTML);
});
};
@@ -153,6 +158,11 @@ define([
unlockElements();
updateTableButtons();
setTablePublished(APP.proxy.published);
+
+ /*
+ APP.proxy.table.rowsOrder.forEach(function (rowId) {
+ $('[data-rt-id="' + rowId +'"]').val(APP.proxy.table.rows[rowId] || '');
+ });*/
};
var unlockColumn = function (id, cb) {
@@ -173,7 +183,7 @@ define([
};
/* Any time the realtime object changes, call this function */
- var change = function (o, n, path) {
+ var change = function (o, n, path, throttle) {
if (path && path.join) {
console.log("Change from [%s] to [%s] at [%s]",
o, n, path.join(', '));
@@ -197,6 +207,18 @@ define([
https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
*/
+
+ if (throttle) {
+ if (APP.throttled) { window.clearTimeout(APP.throttled); }
+ var displayedObj2 = mergeUncommitted(APP.proxy, APP.uncommitted);
+ Render.updateTable(table, displayedObj2, conf);
+ updateDisplayedTable();
+ APP.throttled = window.setTimeout(function () {
+ updateDisplayedTable();
+ }, throttle);
+ return;
+ }
+
window.setTimeout(function () {
var displayedObj2 = mergeUncommitted(APP.proxy, APP.uncommitted);
Render.updateTable(table, displayedObj2, conf);
@@ -227,7 +249,7 @@ define([
console.log("text[rt-id='%s'] [%s]", id, input.value);
if (!input.value) { return void console.log("Hit enter?"); }
Render.setValue(object, id, input.value);
- change();
+ change(null, null, null, 50);
break;
case 'checkbox':
console.log("checkbox[tr-id='%s'] %s", id, input.checked);
@@ -287,7 +309,7 @@ define([
if ($(e.target).is('[type="text"]')) {
return;
}
- $('.lock[data-rt-id!="' + APP.userid + '"]').html('🔒 ');
+ $('.lock[data-rt-id!="' + APP.userid + '"]').html(lockHTML);
var $cells = APP.$table.find('thead td:not(.uncommitted), tbody td');
$cells.find('[type="text"][data-rt-id!="' + APP.userid + '"]').attr('disabled', true);
$('.edit[data-rt-id!="' + APP.userid + '"]').css('visibility', 'visible');
@@ -469,9 +491,15 @@ define([
var $table = APP.$table = $(Render.asHTML(displayedObj, null, colsOrder, readOnly));
var $createRow = APP.$createRow = $('#create-option').click(function () {
- console.error("BUTTON CLICKED! LOL");
+ //console.error("BUTTON CLICKED! LOL");
Render.createRow(proxy, function () {
change();
+ var order = APP.proxy.table.rowsOrder;
+
+ var last = order[order.length - 1];
+ var $newest = $('[data-rt-id="' + last + '"]');
+ $newest.val('');
+ window.setTimeout(change);
});
});
@@ -679,6 +707,7 @@ define([
validateKey: secret.keys.validateKey || undefined,
//readOnly: readOnly,
crypto: Crypto.createEncryptor(secret.keys),
+ userName: 'poll',
};
// don't initialize until the store is ready.
diff --git a/www/Poll/index.html b/www/poll/old/index.html
similarity index 99%
rename from www/Poll/index.html
rename to www/poll/old/index.html
index 10dd07fc4..01b6f6b76 100644
--- a/www/Poll/index.html
+++ b/www/poll/old/index.html
@@ -1,5 +1,5 @@
-
+
diff --git a/www/Poll/main.js b/www/poll/old/main.js
similarity index 99%
rename from www/Poll/main.js
rename to www/poll/old/main.js
index 7417ad10b..a702028bd 100644
--- a/www/Poll/main.js
+++ b/www/poll/old/main.js
@@ -11,7 +11,6 @@ define([
'/common/notify.js',
'/bower_components/file-saver/FileSaver.min.js',
'/bower_components/jquery/dist/jquery.min.js',
- '/customize/pad.js'
], function (Config, Messages, Table, Wizard, TextPatcher, Listmap, Crypto, Cryptpad, Visible, Notify) {
var $ = window.jQuery;
var saveAs = window.saveAs;
@@ -169,7 +168,7 @@ define([
items.forEach(function ($item) {
$item.attr('disabled', !bool);
- });
+ });
if (!bool) {
$('input[id^="y"]').each(function (i, e) {
diff --git a/www/Poll/table.js b/www/poll/old/table.js
similarity index 100%
rename from www/Poll/table.js
rename to www/poll/old/table.js
diff --git a/www/Poll/wizard.js b/www/poll/old/wizard.js
similarity index 100%
rename from www/Poll/wizard.js
rename to www/poll/old/wizard.js
diff --git a/www/poll/render.js b/www/poll/render.js
index d70cd2067..ce2f67518 100644
--- a/www/poll/render.js
+++ b/www/poll/render.js
@@ -268,7 +268,11 @@ var Renderer = function (Cryptpad) {
return ['SPAN', {
'data-rt-id': id,
class: 'lock',
- }, ['🔒']];
+ }, [['i', {
+ class: 'fa fa-lock',
+ 'aria-hidden': true,
+ }, []]
+ ]];
};
var makeHeadingCell = Render.makeHeadingCell = function (cell, readOnly) {