Fix column position in poll for Chrome

pull/1/head
yflory 7 years ago
parent b110e1b8da
commit 00e8d32d60

@ -254,6 +254,7 @@ define([
APP.unlocked.row.forEach(enableRow); APP.unlocked.row.forEach(enableRow);
APP.unlocked.col.forEach(enableColumn); APP.unlocked.col.forEach(enableColumn);
}; };
var setTablePublished = function (bool) { var setTablePublished = function (bool) {
if (bool) { if (bool) {
if (APP.$publish) { APP.$publish.hide(); } if (APP.$publish) { APP.$publish.hide(); }
@ -268,16 +269,30 @@ define([
var addScrollClass = function () { var addScrollClass = function () {
var $scroll = $('#cp-app-poll-table-scroll'); var $scroll = $('#cp-app-poll-table-scroll');
var hasScroll = $scroll.width() < $scroll[0].scrollWidth; var hasScroll = $scroll.width() < $scroll[0].scrollWidth;
if (hasScroll) { var noColumn = $scroll.width() < 100;
if (hasScroll && !noColumn) {
$scroll.addClass('cp-app-poll-table-scrolled'); $scroll.addClass('cp-app-poll-table-scrolled');
return; return;
} }
$scroll.removeClass('cp-app-poll-table-scrolled'); $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 () { var updateDisplayedTable = function () {
setTablePublished(APP.proxy.published); setTablePublished(APP.proxy.published);
addScrollClass(); addScrollClass();
updateTableButtons();
}; };
var unlockColumn = function (id, cb) { var unlockColumn = function (id, cb) {

@ -503,11 +503,6 @@ var Renderer = function (Cryptpad, APP) {
if (APP.proxy.content.colsOrder.indexOf(APP.userid) === -1) { if (APP.proxy.content.colsOrder.indexOf(APP.userid) === -1) {
$(table).find('.cp-app-poll-table-bookmark').css('visibility', ''); $(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 addCount = function (table) {
var $tr = $(table).find('tbody tr').first(); var $tr = $(table).find('tbody tr').first();

Loading…
Cancel
Save