From 00e8d32d607f78a65b39c96033231d0d607bd07a Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 11 Oct 2017 15:37:47 +0200 Subject: [PATCH] Fix column position in poll for Chrome --- www/poll/inner.js | 17 ++++++++++++++++- www/poll/render.js | 5 ----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/www/poll/inner.js b/www/poll/inner.js index bf4b4003e..9e3114ef0 100644 --- a/www/poll/inner.js +++ b/www/poll/inner.js @@ -254,6 +254,7 @@ define([ APP.unlocked.row.forEach(enableRow); APP.unlocked.col.forEach(enableColumn); }; + var setTablePublished = function (bool) { if (bool) { if (APP.$publish) { APP.$publish.hide(); } @@ -268,16 +269,30 @@ define([ var addScrollClass = function () { var $scroll = $('#cp-app-poll-table-scroll'); var hasScroll = $scroll.width() < $scroll[0].scrollWidth; - if (hasScroll) { + var noColumn = $scroll.width() < 100; + if (hasScroll && !noColumn) { $scroll.addClass('cp-app-poll-table-scrolled'); return; } $scroll.removeClass('cp-app-poll-table-scrolled'); }; + var updateTableButtons = function () { + var uncomColId = APP.uncommitted.content.colsOrder[0]; + var uncomRowId = APP.uncommitted.content.rowsOrder[0]; + var $createOption = $('tbody input[data-rt-id="' + uncomRowId+'"]') + .closest('td').find('> div'); + $createOption.find('#cp-app-poll-create-option').remove(); + $createOption.append(APP.$createRow); + var $createUser = $('thead input[data-rt-id="' + uncomColId + '"]') + .closest('td'); + $createUser.find('#cp-app-poll-create-user').remove(); + $createUser.prepend(APP.$createCol); + }; var updateDisplayedTable = function () { setTablePublished(APP.proxy.published); addScrollClass(); + updateTableButtons(); }; var unlockColumn = function (id, cb) { diff --git a/www/poll/render.js b/www/poll/render.js index ba0a07c77..a92f222b4 100644 --- a/www/poll/render.js +++ b/www/poll/render.js @@ -503,11 +503,6 @@ var Renderer = function (Cryptpad, APP) { if (APP.proxy.content.colsOrder.indexOf(APP.userid) === -1) { $(table).find('.cp-app-poll-table-bookmark').css('visibility', ''); } - - if (!APP.proxy || - !APP.proxy.content.rowsOrder || - APP.proxy.content.rowsOrder.length === 0) { - } }; var addCount = function (table) { var $tr = $(table).find('tbody tr').first();