From 684269fdda34873b121791f693f5f8d12611e8cb Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 22 Jun 2017 16:14:54 +0200 Subject: [PATCH] Userlist in polls --- customize.dist/src/less/toolbar.less | 1 + customize.dist/toolbar.css | 1 + www/common/cryptpad-common.js | 2 +- www/common/toolbar2.js | 13 +------- www/poll/index.html | 47 +++++++++++++++------------- www/poll/main.js | 3 +- www/poll/poll.css | 11 +++++++ www/poll/poll.less | 11 +++++++ 8 files changed, 53 insertions(+), 36 deletions(-) diff --git a/customize.dist/src/less/toolbar.less b/customize.dist/src/less/toolbar.less index 534341f99..ed598f7e8 100644 --- a/customize.dist/src/less/toolbar.less +++ b/customize.dist/src/less/toolbar.less @@ -39,6 +39,7 @@ padding: 10px; box-sizing: border-box; h2 { + color: inherit; font-size: 1.2em; font-weight: bold; text-align: center; diff --git a/customize.dist/toolbar.css b/customize.dist/toolbar.css index b50c7c0a3..bf38c56a0 100644 --- a/customize.dist/toolbar.css +++ b/customize.dist/toolbar.css @@ -108,6 +108,7 @@ text-align: baseline; } .userlist-drawer h2 { + color: inherit; font-size: 1.2em; font-weight: bold; text-align: center; diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 492bb06d6..35a41e18c 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -413,7 +413,7 @@ define([ }; common.setAttribute = function (attr, value, cb) { getStore().set(["cryptpad", attr].join('.'), value, function (err, data) { - cb(err, data); + if (cb) { cb(err, data); } }); }; common.setLSAttribute = function (attr, value) { diff --git a/www/common/toolbar2.js b/www/common/toolbar2.js index 92395c89f..065526c05 100644 --- a/www/common/toolbar2.js +++ b/www/common/toolbar2.js @@ -70,7 +70,6 @@ define([ var parsed = Cryptpad.parsePadUrl(window.location.href); if (typeof parsed.type === "string") { - var b = config.$container.parents('body')[0]; config.$container.parents('body').addClass('app-' + parsed.type); } @@ -136,18 +135,15 @@ define([ var getOtherUsers = function(config) { var userList = config.userList.list.users; var userData = config.userList.data; - var userNetfluxId = config.userList.userNetfluxId; var i = 0; // duplicates counter var list = []; // Display only one time each user (if he is connected in multiple tabs) - var myUid = userData[userNetfluxId] ? userData[userNetfluxId].uid : undefined; var uids = []; userList.forEach(function(user) { //if (user !== userNetfluxId) { var data = userData[user] || {}; - var userName = data.name; var userId = data.uid; if (!data.uid) { return; } if (uids.indexOf(userId) === -1) {// && (!myUid || userId !== myUid)) { @@ -268,13 +264,6 @@ define([ !config.userList.data || !config.userList.userNetfluxId) { throw new Error("You must provide a `userList` object to display the userlist"); } - var dropdownConfig = { - options: [{ - tag: 'p', - attributes: {'class': USERLIST_CLS}, - }] - }; - var $content = $('
', {'class': 'userlist-drawer'}); $('

', {'class': USERLIST_CLS}).appendTo($content); toolbar.userlistContent = $content; @@ -291,7 +280,7 @@ define([ config.$contentContainer.prepend($content); } - $button.click(function (e) { + $button.click(function () { $content.toggle(); Cryptpad.setAttribute('userlist-drawer', $content.is(':visible')); }); diff --git a/www/poll/index.html b/www/poll/index.html index 091086f5c..09a92aa1f 100644 --- a/www/poll/index.html +++ b/www/poll/index.html @@ -17,31 +17,34 @@

+
+
+
+

CryptPoll

+

-
-

CryptPoll

-

- -

-

-
+

+

+
-
- - - -
+
+ + + +
-
-
-
-
-
-
-
- - - +
+
+
+
+
+
+
+ + + +
+
diff --git a/www/poll/main.js b/www/poll/main.js index 0948ec8b4..e3f934b70 100644 --- a/www/poll/main.js +++ b/www/poll/main.js @@ -692,7 +692,8 @@ var create = function (info) { ifrw: window, realtime: info.realtime, network: info.network, - $container: APP.$bar + $container: APP.$bar, + $contentContainer: $('#content') }; APP.toolbar = Toolbar.create(configTb); diff --git a/www/poll/poll.css b/www/poll/poll.css index 979f7f2b8..620cf8710 100644 --- a/www/poll/poll.css +++ b/www/poll/poll.css @@ -6,6 +6,17 @@ body { padding: 0px; border: 0px; } +body { + display: flex; + flex-flow: column; +} +#content { + display: flex; + flex: 1; +} +#content #poll { + flex: 1; +} .cryptpad-toolbar h2 { font: normal normal normal 12px Arial, Helvetica, Tahoma, Verdana, Sans-Serif; color: #000; diff --git a/www/poll/poll.less b/www/poll/poll.less index 95b5cfa52..b4315c297 100644 --- a/www/poll/poll.less +++ b/www/poll/poll.less @@ -19,6 +19,17 @@ html, body { padding: 0px; border: 0px; } +body { + display: flex; + flex-flow: column; +} +#content { + display: flex; + flex: 1; + #poll { + flex: 1; + } +} .cryptpad-toolbar h2 { font: normal normal normal 12px Arial, Helvetica, Tahoma, Verdana, Sans-Serif;