Improve stability and UI in poll and its comments

pull/1/head
yflory 7 years ago
parent 26dfc65c25
commit 1c4f1c785d

@ -666,16 +666,18 @@ define([
}, h('span.fa.fa-plus')), }, h('span.fa.fa-plus')),
]), ]),
h('div#cp-app-poll-comments', [ h('div#cp-app-poll-comments', [
h('h2#cp-app-poll-comments-add-title', "TODO: add comment"), h('h2#cp-app-poll-comments-add-title', Msg.poll_comment_add),
h('div#cp-app-poll-comments-add', [ h('div#cp-app-poll-comments-add', [
h('input.cp-app-poll-comments-add-name', { h('input.cp-app-poll-comments-add-name', {
type: 'text' type: 'text'
}), }),
h('textarea.cp-app-poll-comments-add-msg'), h('textarea.cp-app-poll-comments-add-msg'),
h('button.cp-app-poll-comments-add-submit', "TODO: SUBMIT"), h('button.cp-app-poll-comments-add-submit.btn.btn-secondary',
h('button.cp-app-poll-comments-add-cancel', "TODO: CANCEL") Msg.poll_comment_submit),
h('button.cp-app-poll-comments-add-cancel.btn.btn-secondary',
Msg.cancel)
]), ]),
h('h2#cp-app-poll-comments-list-title', "TODO: comments"), h('h2#cp-app-poll-comments-list-title', Msg.poll_comment_list),
h('div#cp-app-poll-comments-list') h('div#cp-app-poll-comments-list')
]) ])
]) ])

@ -262,6 +262,11 @@ define(function () {
out.poll_bookmarked_col = "Voici votre colonne favorite; elle sera toujours dévérouillée et affichée en première position."; out.poll_bookmarked_col = "Voici votre colonne favorite; elle sera toujours dévérouillée et affichée en première position.";
out.poll_total = 'TOTAL'; out.poll_total = 'TOTAL';
out.poll_comment_list = "Commentaires";
out.poll_comment_add = "Ajouter un commentaire";
out.poll_comment_submit = "Envoyer";
out.poll_comment_remove = "Supprimer ce commentaire";
// Canvas // Canvas
out.canvas_clear = "Nettoyer"; out.canvas_clear = "Nettoyer";
out.canvas_delete = "Supprimer la sélection"; out.canvas_delete = "Supprimer la sélection";

@ -264,6 +264,11 @@ define(function () {
out.poll_bookmarked_col = 'This is your bookmarked column. It will always be unlocked and displayed at the beginning for you.'; out.poll_bookmarked_col = 'This is your bookmarked column. It will always be unlocked and displayed at the beginning for you.';
out.poll_total = 'TOTAL'; out.poll_total = 'TOTAL';
out.poll_comment_list = "Comments";
out.poll_comment_add = "Add a comment";
out.poll_comment_submit = "Send";
out.poll_comment_remove = "Delete this comment";
// Canvas // Canvas
out.canvas_clear = "Clear"; out.canvas_clear = "Clear";
out.canvas_delete = "Delete selection"; out.canvas_delete = "Delete selection";

@ -45,6 +45,7 @@ overflow-x: hidden;
#cp-app-poll-content { #cp-app-poll-content {
display: flex; display: flex;
flex: 1; flex: 1;
min-height: 0;
#cp-app-poll-form { #cp-app-poll-form {
flex: 1; flex: 1;
overflow-y: auto; overflow-y: auto;
@ -373,6 +374,7 @@ div.cp-app-poll-realtime {
.tools_unselectable(); .tools_unselectable();
} }
thead { thead {
height: 52px;
td { td {
padding: 0px 5px; padding: 0px 5px;
background: @poll-th-bg; background: @poll-th-bg;
@ -492,6 +494,10 @@ div.cp-app-poll-realtime {
width: 50%; width: 50%;
margin: 20px auto; margin: 20px auto;
min-width: 400px; min-width: 400px;
padding-bottom: 5px;
button {
border-radius: 0;
}
#cp-app-poll-comments-add { #cp-app-poll-comments-add {
input, textarea { input, textarea {
border: 1px solid black; border: 1px solid black;
@ -510,6 +516,9 @@ div.cp-app-poll-realtime {
height: 8em; height: 8em;
line-height: 1.5em; line-height: 1.5em;
} }
button {
padding: 10px;
}
text-align: center; text-align: center;
} }
#cp-app-poll-comments-list { #cp-app-poll-comments-list {
@ -527,9 +536,8 @@ div.cp-app-poll-realtime {
} }
.cp-app-poll-comments-list-msg-actions { .cp-app-poll-comments-list-msg-actions {
button { button {
border-radius: 0;
width: 25px;
padding: 0; padding: 0;
width: 25px;
line-height: 20px; line-height: 20px;
} }
} }

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html class="cp-app-noscroll">
<head> <head>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/> <meta content="text/html; charset=utf-8" http-equiv="content-type"/>

@ -183,7 +183,7 @@ define([
if (commit) { if (commit) {
newObj = proxy; newObj = proxy;
} else { } else {
newObj = $.extend(true, {}, proxy); newObj = copyObject(proxy);
} }
// Merge uncommitted into the proxy // Merge uncommitted into the proxy
@ -221,14 +221,40 @@ define([
return newObj; return newObj;
}; };
var enableColumn = function (id) {
var $input = $('input[disabled="disabled"][data-rt-id^="' + id + '"]')
.removeAttr('disabled');
$input.closest('td').addClass('cp-app-poll-table-editing');
$('.cp-app-poll-table-lock[data-rt-id="' + id + '"]').addClass('fa-unlock')
.removeClass('fa-lock').attr('title', Messages.poll_unlocked);
};
var disableColumn = function (id) {
var $input = $('input[data-rt-id^="' + id + '"]')
.attr('disabled', 'disabled');
$input.closest('td').removeClass('cp-app-poll-table-editing');
$('.cp-app-poll-table-lock[data-rt-id="' + id + '"]').addClass('fa-lock')
.removeClass('fa-unlock').attr('title', Messages.poll_locked);
};
var enableRow = function (id) {
var $input = $('input[type="text"][disabled="disabled"][data-rt-id="' + id + '"]').removeAttr('disabled');
$input.closest('td').addClass('cp-app-poll-table-editing');
$('span.cp-app-poll-table-edit[data-rt-id="' + id + '"]').css('visibility', 'hidden');
};
var disableRow = function (id) {
var $input = $('input[type="text"][data-rt-id="' + id + '"]')
.attr('disabled', 'disabled');
$input.closest('td').removeClass('cp-app-poll-table-editing');
$('span.cp-app-poll-table-edit[data-rt-id="' + id + '"]').css('visibility', 'visible');
};
var styleUserColumn = function () { var styleUserColumn = function () {
var userid = APP.userid; var userid = APP.userid;
if (!userid) { return; } if (!userid) { return; }
// Enable input for the userid column // Enable input for the userid column
$('input[disabled="disabled"][data-rt-id^="' + userid + '"]').removeAttr('disabled') enableColumn(userid);
$('input[disabled="disabled"][data-rt-id^="' + userid + '"]')
.attr('placeholder', Messages.poll_userPlaceholder); .attr('placeholder', Messages.poll_userPlaceholder);
$('input[type="number"][data-rt-id^="' + userid + '"]').addClass('enabled');
$('.cp-app-poll-table-lock[data-rt-id="' + userid + '"]').remove(); $('.cp-app-poll-table-lock[data-rt-id="' + userid + '"]').remove();
$('[data-rt-id^="' + userid + '"]').closest('td') $('[data-rt-id^="' + userid + '"]').closest('td')
.addClass("cp-app-poll-table-own"); .addClass("cp-app-poll-table-own");
@ -241,10 +267,8 @@ define([
var hasScroll = $scroll.width() < $scroll[0].scrollWidth; var hasScroll = $scroll.width() < $scroll[0].scrollWidth;
APP.uncommitted.content.colsOrder.forEach(function(id) { APP.uncommitted.content.colsOrder.forEach(function(id) {
// Enable the checkboxes for the uncommitted column // Enable the checkboxes for the uncommitted column
$('input[disabled="disabled"][data-rt-id^="' + id + '"]').removeAttr('disabled'); enableColumn(id);
$('input[type="number"][data-rt-id^="' + id + '"]').addClass('enabled');
$('.cp-app-poll-table-lock[data-rt-id="' + id + '"]').remove(); $('.cp-app-poll-table-lock[data-rt-id="' + id + '"]').remove();
//.addClass('fa-unlock').removeClass('fa-lock').attr('title', Messages.poll_unlocked);
$('.cp-app-poll-table-remove[data-rt-id="' + id + '"]').remove(); $('.cp-app-poll-table-remove[data-rt-id="' + id + '"]').remove();
$('.cp-app-poll-table-bookmark[data-rt-id="' + id + '"]').remove(); $('.cp-app-poll-table-bookmark[data-rt-id="' + id + '"]').remove();
@ -258,29 +282,16 @@ define([
}); });
APP.uncommitted.content.rowsOrder.forEach(function(id) { APP.uncommitted.content.rowsOrder.forEach(function(id) {
// Enable the checkboxes for the uncommitted column // Enable the checkboxes for the uncommitted column
$('input[disabled="disabled"][data-rt-id="' + id + '"]').removeAttr('disabled'); enableRow(id);
$('.cp-app-poll-table-edit[data-rt-id="' + id + '"]').remove(); $('.cp-app-poll-table-edit[data-rt-id="' + id + '"]').remove();
$('.cp-app-poll-table-remove[data-rt-id="' + id + '"]').remove(); $('.cp-app-poll-table-remove[data-rt-id="' + id + '"]').remove();
$('[data-rt-id="' + id + '"]').closest('tr').addClass("cp-app-poll-table-uncommitted"); $('[data-rt-id="' + id + '"]').closest('tr').addClass("cp-app-poll-table-uncommitted");
//$('td.uncommitted .cover').addClass("uncommitted");
//$('.uncommitted input[type="text"]').attr("placeholder", Messages.poll_userPlaceholder);
}); });
}; };
var unlockElements = function () { var unlockElements = function () {
APP.unlocked.row.forEach(function (id) { APP.unlocked.row.forEach(enableRow);
var $input = $('input[type="text"][disabled="disabled"][data-rt-id="' + id + '"]').removeAttr('disabled'); APP.unlocked.col.forEach(enableColumn);
$input.parent().parent().addClass('cp-app-poll-table-editing');
$('span.cp-app-poll-table-edit[data-rt-id="' + id + '"]').css('visibility', 'hidden');
});
APP.unlocked.col.forEach(function (id) {
var $input = $('input[disabled="disabled"][data-rt-id^="' + id + '"]')
.removeAttr('disabled');
$input.parent().addClass('cp-app-poll-table-editing');
$('input[type="number"][data-rt-id^="' + id + '"]').addClass('enabled');
$('.cp-app-poll-table-lock[data-rt-id="' + id + '"]').addClass('fa-unlock')
.removeClass('fa-lock').attr('title', Messages.poll_unlocked);
});
}; };
var updateTableButtons = function () { var updateTableButtons = function () {
var uncomColId = APP.uncommitted.content.colsOrder[0]; var uncomColId = APP.uncommitted.content.colsOrder[0];
@ -377,35 +388,31 @@ define([
if (APP.unlocked.col.indexOf(id) === -1) { if (APP.unlocked.col.indexOf(id) === -1) {
APP.unlocked.col.push(id); APP.unlocked.col.push(id);
} }
if (typeof(cb) === "function") { enableColumn(id);
cb(); if (typeof(cb) === "function") { cb(); }
}
}; };
var unlockRow = function (id, cb) { var unlockRow = function (id, cb) {
if (APP.unlocked.row.indexOf(id) === -1) { if (APP.unlocked.row.indexOf(id) === -1) {
APP.unlocked.row.push(id); APP.unlocked.row.push(id);
} }
if (typeof(cb) === "function") { enableRow(id);
cb(); if (typeof(cb) === "function") { cb(); }
}
}; };
var lockColumn = function (id, cb) { var lockColumn = function (id, cb) {
var idx = APP.unlocked.col.indexOf(id); var idx = APP.unlocked.col.indexOf(id);
if (idx !== -1) { if (idx !== -1) {
APP.unlocked.col.splice(idx, 1); APP.unlocked.col.splice(idx, 1);
} }
if (typeof(cb) === "function") { disableColumn(id);
cb(); if (typeof(cb) === "function") { cb(); }
}
}; };
var lockRow = function (id, cb) { var lockRow = function (id, cb) {
var idx = APP.unlocked.row.indexOf(id); var idx = APP.unlocked.row.indexOf(id);
if (idx !== -1) { if (idx !== -1) {
APP.unlocked.row.splice(idx, 1); APP.unlocked.row.splice(idx, 1);
} }
if (typeof(cb) === "function") { disableRow(id);
cb(); if (typeof(cb) === "function") { cb(); }
}
}; };
/* Any time the realtime object changes, call this function */ /* Any time the realtime object changes, call this function */
@ -420,14 +427,6 @@ define([
var table = APP.$table[0]; var table = APP.$table[0];
var displayedObj = mergeUncommitted(APP.proxy, APP.uncommitted);
var colsOrder = sortColumns(displayedObj.content.colsOrder, APP.userid);
var conf = {
cols: colsOrder,
readOnly: APP.readOnly
};
common.notify(); common.notify();
var getFocus = function () { var getFocus = function () {
@ -453,18 +452,23 @@ define([
}; };
var updateTable = function () { var updateTable = function () {
var displayedObj2 = mergeUncommitted(APP.proxy, APP.uncommitted); var displayedObj = mergeUncommitted(APP.proxy, APP.uncommitted);
var colsOrder = sortColumns(displayedObj.content.colsOrder, APP.userid);
var conf = {
cols: colsOrder,
readOnly: APP.readOnly
};
var f = getFocus(); var f = getFocus();
APP.$createRow.detach(); APP.$createRow.detach();
APP.$createCol.detach(); APP.$createCol.detach();
Render.updateTable(table, displayedObj2, conf); Render.updateTable(table, displayedObj, conf);
// Fix autocomplete bug: // Fix autocomplete bug:
displayedObj2.content.rowsOrder.forEach(function (rowId) { displayedObj.content.rowsOrder.forEach(function (rowId) {
$('input[data-rt-id="' + rowId +'"]').val(displayedObj2.content.rows[rowId] || ''); $('input[data-rt-id="' + rowId +'"]').val(displayedObj.content.rows[rowId] || '');
}); });
displayedObj2.content.colsOrder.forEach(function (rowId) { displayedObj.content.colsOrder.forEach(function (rowId) {
$('input[data-rt-id="' + rowId +'"]') $('input[data-rt-id="' + rowId +'"]')
.val(displayedObj2.content.cols[rowId] || ''); .val(displayedObj.content.cols[rowId] || '');
}); });
updateDisplayedTable(); updateDisplayedTable();
setFocus(f); setFocus(f);
@ -475,9 +479,8 @@ define([
if (throttle) { if (throttle) {
if (APP.throttled) { window.clearTimeout(APP.throttled); } if (APP.throttled) { window.clearTimeout(APP.throttled); }
updateTable();
APP.throttled = window.setTimeout(function () { APP.throttled = window.setTimeout(function () {
updateDisplayedTable(); updateTable();
}, throttle); }, throttle);
return; return;
} }
@ -509,7 +512,7 @@ define([
case 'text': case 'text':
debug("text[rt-id='%s'] [%s]", id, input.value); debug("text[rt-id='%s'] [%s]", id, input.value);
Render.setValue(object, id, input.value); Render.setValue(object, id, input.value);
change(null, null, null, 50); change(null, null, null, 250);
break; break;
case 'number': case 'number':
debug("checkbox[tr-id='%s'] %s", id, input.value); debug("checkbox[tr-id='%s'] %s", id, input.value);
@ -537,14 +540,29 @@ define([
if (APP.readOnly) { return; } if (APP.readOnly) { return; }
if (id) { if (id) {
var type = Render.typeofId(id); var type = Render.typeofId(id);
console.log(type); if (type === 'col') { return void lockColumn(id); }
if (type === 'col') { return void lockColumn(id, change); } if (type === 'row') { return void lockRow(id); }
if (type === 'row') { return void lockRow(id, change); }
return; return;
} }
APP.unlocked.col = Cryptpad.deduplicateString([APP.userid].concat(APP.uncommitted.content.colsOrder).slice()); var keepColUnlocked = [APP.userid, APP.uncommitted.content.colsOrder[0]];
var keepRowUnlocked = APP.uncommitted.content.rowsOrder.slice();
var toLock = [];
APP.unlocked.col.forEach(function (id) {
if (keepColUnlocked.indexOf(id) !== -1) { return; }
toLock.push(id);
});
toLock.forEach(lockColumn);
toLockR = [];
APP.unlocked.row.forEach(function (id) {
if (keepRowUnlocked.indexOf(id) !== -1) { return; }
toLockR.push(id);
});
toLockR.forEach(lockRow);
/*APP.unlocked.col = Cryptpad.deduplicateString([APP.userid].concat(APP.uncommitted.content.colsOrder).slice());
APP.unlocked.row = APP.uncommitted.content.rowsOrder.slice(); APP.unlocked.row = APP.uncommitted.content.rowsOrder.slice();
change(); change();*/
}; };
/* Called whenever an event is fired on a span */ /* Called whenever an event is fired on a span */
@ -571,10 +589,8 @@ define([
}); });
} else if (isEdit) { } else if (isEdit) {
unlockRow(id, function () { unlockRow(id, function () {
change(null, null, null, null, function() {
$('input[data-rt-id="' + id + '"]').focus(); $('input[data-rt-id="' + id + '"]').focus();
}); });
});
} }
} else if (type === 'col') { } else if (type === 'col') {
if (isRemove) { if (isRemove) {
@ -589,15 +605,10 @@ define([
handleBookmark(id); handleBookmark(id);
} else if (isLock && isLocked) { } else if (isLock && isLocked) {
unlockColumn(id, function () { unlockColumn(id, function () {
change(null, null, null, null, function() {
$('input[data-rt-id="' + id + '"]').focus(); $('input[data-rt-id="' + id + '"]').focus();
}); });
});
} else if (isLock) { } else if (isLock) {
lockColumn(id, function () { lockColumn(id);
change(null, null, null, null, function() {
});
});
} }
} else if (type === 'cell') { } else if (type === 'cell') {
change(); change();
@ -754,17 +765,7 @@ define([
var getCommentId = Render.Uid('c'); var getCommentId = Render.Uid('c');
var removeComment = function (uid) { var removeComment = function (uid) {
var idx; delete APP.proxy.comments[uid];
APP.proxy.comments.some(function (c, i) {
if (c.uid === uid) {
console.log('found');
idx = i;
return true;
}
});
if (idx) {
APP.proxy.comments.splice(idx, 1);
}
APP.updateComments(); APP.updateComments();
}; };
/*var editComment = function (id) { /*var editComment = function (id) {
@ -772,7 +773,7 @@ define([
};*/ };*/
var avatars = {}; var avatars = {};
var updateComments = APP.updateComments = function () { var updateComments = APP.updateComments = function () {
if (!APP.proxy.comments) { APP.proxy.comments = []; } if (!APP.proxy.comments) { APP.proxy.comments = {}; }
var profile; var profile;
if (common.isLoggedIn()) { if (common.isLoggedIn()) {
@ -781,7 +782,10 @@ define([
var $comments = APP.$comments.html(''); var $comments = APP.$comments.html('');
var comments = APP.proxy.comments; var comments = APP.proxy.comments;
comments.forEach(function (c) { Object.keys(copyObject(comments)).sort(function (a, b) {
return comments[a].time > comments[b].time;
}).forEach(function (k) {
var c = comments[k];
var $c = $('<div>', { var $c = $('<div>', {
'class': 'cp-app-poll-comments-list-el' 'class': 'cp-app-poll-comments-list-el'
}).prependTo($comments); }).prependTo($comments);
@ -824,10 +828,10 @@ define([
// Actions // Actions
if (!c.profile || c.profile === profile) { if (!c.profile || c.profile === profile) {
$('<button>', { $('<button>', {
'class': 'fa fa-times', 'class': 'btn btn-secondary fa fa-times',
'title': 'TODO: remove comment', 'title': Messages.poll_comment_remove,
'data-rt-id': c.uid 'data-rt-id': k
}).appendTo($actions).click(function () { removeComment(c.uid); }); }).appendTo($actions).click(function () { removeComment(k); });
/*$('<button>', { /*$('<button>', {
'class': 'fa fa-pencil', 'class': 'fa fa-pencil',
'title': 'TODO: edit comment', 'title': 'TODO: edit comment',
@ -838,11 +842,12 @@ define([
common.notify(); common.notify();
}; };
var resetComment = function () { var resetComment = function () {
APP.$addComment.find('.cp-app-poll-comments-add-name').val(''); APP.$addComment.find('.cp-app-poll-comments-add-name')
.val(metadataMgr.getUserData().name || '');
APP.$addComment.find('.cp-app-poll-comments-add-msg').val(''); APP.$addComment.find('.cp-app-poll-comments-add-msg').val('');
}; };
var addComment = function () { var addComment = function () {
if (!APP.proxy.comments) { APP.proxy.comments = []; } if (!APP.proxy.comments) { APP.proxy.comments = {}; }
var name = APP.$addComment.find('.cp-app-poll-comments-add-name').val(); var name = APP.$addComment.find('.cp-app-poll-comments-add-name').val();
var msg = APP.$addComment.find('.cp-app-poll-comments-add-msg').val(); var msg = APP.$addComment.find('.cp-app-poll-comments-add-msg').val();
var time = +new Date(); var time = +new Date();
@ -853,14 +858,14 @@ define([
avatar = metadataMgr.getUserData().avatar; avatar = metadataMgr.getUserData().avatar;
} }
APP.proxy.comments.push({ var uid = getCommentId();
APP.proxy.comments[uid] = {
msg: msg, msg: msg,
name: name, name: name,
time: time, time: time,
uid: getCommentId(),
profile: profile, profile: profile,
avatar: avatar avatar: avatar
}); };
resetComment(); resetComment();
updateComments(); updateComments();
}; };
@ -872,7 +877,6 @@ define([
c = Render.getCoordinates(k); c = Render.getCoordinates(k);
if (APP.proxy.content.colsOrder.indexOf(c[0]) === -1 || if (APP.proxy.content.colsOrder.indexOf(c[0]) === -1 ||
APP.proxy.content.rowsOrder.indexOf(c[1]) === -1) { APP.proxy.content.rowsOrder.indexOf(c[1]) === -1) {
console.log('deleting ' + k);
delete APP.proxy.content.cells[k]; delete APP.proxy.content.cells[k];
} }
} }
@ -934,7 +938,7 @@ define([
var rowuid = Render.rowuid(); var rowuid = Render.rowuid();
uncommitted.content.rowsOrder.push(rowuid); uncommitted.content.rowsOrder.push(rowuid);
unlockRow(coluid); unlockRow(rowuid);
} }
var displayedObj = mergeUncommitted(proxy, uncommitted, false); var displayedObj = mergeUncommitted(proxy, uncommitted, false);
@ -943,6 +947,9 @@ define([
var $table = APP.$table = $(Render.asHTML(displayedObj, null, colsOrder, APP.readOnly)); var $table = APP.$table = $(Render.asHTML(displayedObj, null, colsOrder, APP.readOnly));
/*
Extract uncommitted data (row or column) and create a new uncommitted row or column
*/
var getUncommitted = function (type) { var getUncommitted = function (type) {
var ret = {}, toRemove; var ret = {}, toRemove;
var uncommitted = APP.uncommitted.content; var uncommitted = APP.uncommitted.content;
@ -979,7 +986,6 @@ define([
}); });
uncommitted.rowsOrder = [Render.rowuid()]; uncommitted.rowsOrder = [Render.rowuid()];
uncommitted.rows = {}; uncommitted.rows = {};
console.log(JSON.stringify(ret, 0, 2));
return ret; return ret;
}; };
APP.$createCol = $('#cp-app-poll-create-user').click(function () { APP.$createCol = $('#cp-app-poll-create-user').click(function () {
@ -988,7 +994,8 @@ define([
if (!APP.userid) { setUserId(id); } if (!APP.userid) { setUserId(id); }
mergeUncommitted(proxy, uncommittedCopy, true); mergeUncommitted(proxy, uncommittedCopy, true);
change(null, null, null, null, function() { change(null, null, null, null, function() {
handleSpan($('.cp-app-poll-table-lock[data-rt-id="' + id + '"]')[0]); unlockColumn(id);
unlockColumn(APP.uncommitted.content.colsOrder[0]);
}); });
}); });
APP.$createRow = $('#cp-app-poll-create-option').click(function () { APP.$createRow = $('#cp-app-poll-create-option').click(function () {
@ -1032,10 +1039,17 @@ define([
.on('change', ['metadata'], function () { .on('change', ['metadata'], function () {
metadataMgr.updateMetadata(proxy.metadata); metadataMgr.updateMetadata(proxy.metadata);
}) })
.on('change', ['content'], change) .on('change', ['content'], function () {
change(null, null, null, 100);
})
.on('change', ['description'], updateDescription) .on('change', ['description'], updateDescription)
.on('change', ['comments'], updateComments) .on('change', ['comments'], updateComments)
.on('remove', [], change); .on('change', ['published'], function () {
publish(proxy.published);
})
.on('remove', [], function () {
change(null, null, null, 100);
});
// If the user's column is not committed, add his username // If the user's column is not committed, add his username
var $userInput = $('.cp-app-poll-table-uncommitted > input[data-rt-id^='+ APP.userid +']'); var $userInput = $('.cp-app-poll-table-uncommitted > input[data-rt-id^='+ APP.userid +']');

@ -12,7 +12,7 @@ define([
userData: {} userData: {}
}, },
description: '', description: '',
comments: [], comments: {},
content: { content: {
/* TODO /* TODO

Loading…
Cancel
Save