From f8f66800d15bf3cf32abdb71ec8a636e9b36844b Mon Sep 17 00:00:00 2001
From: ansuz <ansuz@transitiontech.ca>
Date: Thu, 18 Aug 2016 17:54:17 +0200
Subject: [PATCH] display a 'commit' button which locks your column

---
 customize.dist/main.css          | 12 +++++++++---
 customize.dist/src/cryptpad.less | 13 ++++++++++---
 www/poll/main.js                 | 17 +++++++++++++++++
 3 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/customize.dist/main.css b/customize.dist/main.css
index 38e935783..e3f5078cb 100644
--- a/customize.dist/main.css
+++ b/customize.dist/main.css
@@ -265,6 +265,7 @@ tbody td:last-child {
 }
 .remove {
   color: #FF0073;
+  cursor: pointer !important;
 }
 form.realtime {
   padding: 0px;
@@ -357,6 +358,14 @@ form.realtime table thead tr th .edit:after {
 form.realtime table thead tr th .edit.editable {
   display: none;
 }
+form.realtime table tfoot tr td {
+  text-align: center;
+}
+form.realtime table tfoot tr td .save {
+  padding: 15px;
+  border-top-left-radius: 5px;
+  border-top-right-radius: 5px;
+}
 form.realtime #adduser,
 form.realtime #addoption {
   color: #46E981;
@@ -401,9 +410,6 @@ div.modal table input {
   width: 90%;
   border: 3px solid #302B28;
 }
-div.modal table thead tr th span.remove {
-  cursor: pointer;
-}
 div.modal table tfoot tr td {
   z-index: 4000;
   cursor: pointer;
diff --git a/customize.dist/src/cryptpad.less b/customize.dist/src/cryptpad.less
index 7d25161e3..87fcda0c0 100644
--- a/customize.dist/src/cryptpad.less
+++ b/customize.dist/src/cryptpad.less
@@ -315,7 +315,10 @@ tbody {
     .top-left;
 }
 
-.remove { color: @cp-red; }
+.remove {
+    color: @cp-red;
+    cursor: pointer !important;
+}
 
 form.realtime {
     > input {
@@ -440,6 +443,12 @@ form.realtime {
         tfoot {
             tr {
                 td {
+                    text-align: center;
+                    .save {
+                        padding: 15px;
+                        border-top-left-radius: 5px;
+                        border-top-right-radius: 5px;
+                    }
                 }
             }
         }
@@ -505,7 +514,6 @@ div.modal {
             tr {
                 th {
                     span.remove {
-                        cursor: pointer;
                     }
                 }
             }
@@ -520,7 +528,6 @@ div.modal {
         tfoot {
             tr {
                 td {
-
                     z-index: 4000;
                     cursor: pointer;
                 }
diff --git a/www/poll/main.js b/www/poll/main.js
index 1cc51e30a..34e2c9e96 100644
--- a/www/poll/main.js
+++ b/www/poll/main.js
@@ -199,10 +199,27 @@ define([
             .attr('disabled', !bool);
 
         if (bool) {
+            var $target = $('tfoot td')
+                .eq(module.rt.proxy.table.colsOrder.indexOf(id) + 1);
+
+            if ($target.length) {
+                var $save = $('<span>', {
+                    'class': 'save action',
+                    'for': id,
+                })
+                .text('COMMIT') // TODO translate
+                .click(function () {
+                    makeUserEditable(id, false);
+                });
+                $target.append($save);
+            }
+
             module.activeColumn = id;
             module.rt.proxy.table.colsOrder.forEach(function (coluid) {
                 if (coluid !== id) { makeUserEditable(coluid, false); }
             });
+        } else {
+            $('.save[for="' + id + '"]').remove();
         }
 
         return $sel;