From 068a3f594496548938974fa182bdf061b437f444 Mon Sep 17 00:00:00 2001 From: ansuz Date: Fri, 22 Jul 2016 15:42:41 +0200 Subject: [PATCH] remove rows from the poll --- customize.dist/main.css | 16 +++++++++++----- customize.dist/src/cryptpad.less | 26 +++++++++++++++----------- www/poll/main.js | 30 ++++++++++++++++++++++++++++-- 3 files changed, 54 insertions(+), 18 deletions(-) diff --git a/customize.dist/main.css b/customize.dist/main.css index 634a23b35..ff7f2b9e5 100644 --- a/customize.dist/main.css +++ b/customize.dist/main.css @@ -179,7 +179,7 @@ tbody tr th:last-child { border-right: 0px; } tbody .remove { - cursor: pointer; + cursor: pointer !important; color: #FF0073; } tbody td { @@ -264,9 +264,12 @@ form.realtime table { } form.realtime table input { height: 100%; - width: 100%; + width: 90%; border: 3px solid #302B28; - display: table-cell; +} +form.realtime table thead tr th .remove { + color: #FF0073; + cursor: pointer; } form.realtime table tfoot tr td { z-index: 4000; @@ -312,9 +315,12 @@ div.modal table { } div.modal table input { height: 100%; - width: 100%; + width: 90%; border: 3px solid #302B28; - display: table-cell; +} +div.modal table thead tr th span.remove { + color: red; + cursor: pointer; } div.modal table tfoot tr td { z-index: 4000; diff --git a/customize.dist/src/cryptpad.less b/customize.dist/src/cryptpad.less index 0ca61f478..a2cae48a1 100644 --- a/customize.dist/src/cryptpad.less +++ b/customize.dist/src/cryptpad.less @@ -211,7 +211,7 @@ tbody { } } .remove { - cursor: pointer; + cursor: pointer !important; color: @cp-red; } @@ -324,15 +324,19 @@ form.realtime { input { height: 100%; - width: 100%; + width: 90%; border: 3px solid @base; - display: table-cell; + //display: table-cell; } thead { tr { - td { + th { + .remove { + color: @cp-red; + cursor: pointer; + } } } @@ -347,7 +351,6 @@ form.realtime { tfoot { tr { td { - z-index: 4000; cursor: pointer; } @@ -389,7 +392,6 @@ div.modal { border: 1px solid @light-base; text-align: center; - } &.shown { @@ -409,16 +411,18 @@ div.modal { input { height: 100%; - width: 100%; + width: 90%; border: 3px solid @base; - display: table-cell; + //display: table-cell; } - thead { tr { - td { - + th { + span.remove { + color: red; + cursor: pointer; + } } } } diff --git a/www/poll/main.js b/www/poll/main.js index b7e6abf74..6f0511881 100644 --- a/www/poll/main.js +++ b/www/poll/main.js @@ -150,6 +150,12 @@ define([ table.removeColumn(uid); }; + var removeFromArray = function (A, e) { + var i = A.indexOf(e); + if (i === -1) { return; } + A.splice(i, 1); + }; + var makeUser = function (proxy, id, value) { var $user = Input({ id: id, @@ -159,9 +165,19 @@ define([ proxy.table.cols[id] = $user.val() || ""; }); + var $wrapper = $('
') + .append($user) + .append($('', { + 'class': 'remove', + 'title': 'remove column', // TODO translate + }).text('✖').click(function () { + removeColumn(proxy, id); + table.removeColumn(id); + })) + proxy.table.cols[id] = value || ""; addIfAbsent(proxy.table.colsOrder, id); - table.addColumn($user, Checkbox, id); + table.addColumn($wrapper, Checkbox, id); return $user; }; @@ -174,10 +190,20 @@ define([ proxy.table.rows[id] = $option.val(); }); + var $wrapper = $('
') + .append($option) + .append($('', { + 'class': 'remove', + 'title': 'remove row', // TODO translate + }).text('✖').click(function () { + removeRow(proxy, id); + table.removeRow(id); + })); + proxy.table.rows[id] = value || ""; addIfAbsent(proxy.table.rowsOrder, id); - table.addRow($option, Checkbox, id); + var $row = table.addRow($wrapper, Checkbox, id); return $option; };