Userlist in polls

pull/1/head
yflory 8 years ago
parent a11befaa0f
commit 684269fdda

@ -39,6 +39,7 @@
padding: 10px; padding: 10px;
box-sizing: border-box; box-sizing: border-box;
h2 { h2 {
color: inherit;
font-size: 1.2em; font-size: 1.2em;
font-weight: bold; font-weight: bold;
text-align: center; text-align: center;

@ -108,6 +108,7 @@
text-align: baseline; text-align: baseline;
} }
.userlist-drawer h2 { .userlist-drawer h2 {
color: inherit;
font-size: 1.2em; font-size: 1.2em;
font-weight: bold; font-weight: bold;
text-align: center; text-align: center;

@ -413,7 +413,7 @@ define([
}; };
common.setAttribute = function (attr, value, cb) { common.setAttribute = function (attr, value, cb) {
getStore().set(["cryptpad", attr].join('.'), value, function (err, data) { getStore().set(["cryptpad", attr].join('.'), value, function (err, data) {
cb(err, data); if (cb) { cb(err, data); }
}); });
}; };
common.setLSAttribute = function (attr, value) { common.setLSAttribute = function (attr, value) {

@ -70,7 +70,6 @@ define([
var parsed = Cryptpad.parsePadUrl(window.location.href); var parsed = Cryptpad.parsePadUrl(window.location.href);
if (typeof parsed.type === "string") { if (typeof parsed.type === "string") {
var b = config.$container.parents('body')[0];
config.$container.parents('body').addClass('app-' + parsed.type); config.$container.parents('body').addClass('app-' + parsed.type);
} }
@ -136,18 +135,15 @@ define([
var getOtherUsers = function(config) { var getOtherUsers = function(config) {
var userList = config.userList.list.users; var userList = config.userList.list.users;
var userData = config.userList.data; var userData = config.userList.data;
var userNetfluxId = config.userList.userNetfluxId;
var i = 0; // duplicates counter var i = 0; // duplicates counter
var list = []; var list = [];
// Display only one time each user (if he is connected in multiple tabs) // Display only one time each user (if he is connected in multiple tabs)
var myUid = userData[userNetfluxId] ? userData[userNetfluxId].uid : undefined;
var uids = []; var uids = [];
userList.forEach(function(user) { userList.forEach(function(user) {
//if (user !== userNetfluxId) { //if (user !== userNetfluxId) {
var data = userData[user] || {}; var data = userData[user] || {};
var userName = data.name;
var userId = data.uid; var userId = data.uid;
if (!data.uid) { return; } if (!data.uid) { return; }
if (uids.indexOf(userId) === -1) {// && (!myUid || userId !== myUid)) { if (uids.indexOf(userId) === -1) {// && (!myUid || userId !== myUid)) {
@ -268,13 +264,6 @@ define([
!config.userList.data || !config.userList.userNetfluxId) { !config.userList.data || !config.userList.userNetfluxId) {
throw new Error("You must provide a `userList` object to display the userlist"); throw new Error("You must provide a `userList` object to display the userlist");
} }
var dropdownConfig = {
options: [{
tag: 'p',
attributes: {'class': USERLIST_CLS},
}]
};
var $content = $('<div>', {'class': 'userlist-drawer'}); var $content = $('<div>', {'class': 'userlist-drawer'});
$('<p>', {'class': USERLIST_CLS}).appendTo($content); $('<p>', {'class': USERLIST_CLS}).appendTo($content);
toolbar.userlistContent = $content; toolbar.userlistContent = $content;
@ -291,7 +280,7 @@ define([
config.$contentContainer.prepend($content); config.$contentContainer.prepend($content);
} }
$button.click(function (e) { $button.click(function () {
$content.toggle(); $content.toggle();
Cryptpad.setAttribute('userlist-drawer', $content.is(':visible')); Cryptpad.setAttribute('userlist-drawer', $content.is(':visible'));
}); });

@ -17,31 +17,34 @@
<body> <body>
<div id="toolbar" class="toolbar-container"></div> <div id="toolbar" class="toolbar-container"></div>
<div id="content">
<div id="poll">
<div id="howItWorks">
<h1 id="mainTitle">CryptPoll</h1>
<h2 data-localization="poll_subtitle"></h2>
<div id="howItWorks"> <p data-localization="poll_p_save"></p>
<h1 id="mainTitle">CryptPoll</h1> <p data-localization="poll_p_encryption"></p>
<h2 data-localization="poll_subtitle"></h2> </div>
<p data-localization="poll_p_save"></p>
<p data-localization="poll_p_encryption"></p>
</div>
<div class="upper"> <div class="upper">
<button id="publish" data-localization-title="poll_publish_button" data-localization="poll_publish_button" style="display: none;">publish poll</button> <button id="publish" data-localization-title="poll_publish_button" data-localization="poll_publish_button" style="display: none;">publish poll</button>
<button id="admin" data-localization-title="poll_admin_button" data-localization="poll_admin_button" style="display: none;">admin</button> <button id="admin" data-localization-title="poll_admin_button" data-localization="poll_admin_button" style="display: none;">admin</button>
<button id="help" data-localization-title="poll_show_help_button" data-localization="poll_show_help_button">help</button> <button id="help" data-localization-title="poll_show_help_button" data-localization="poll_show_help_button">help</button>
</div> </div>
<div class="realtime"> <div class="realtime">
<br /> <br />
<center> <center>
<textarea rows=5 cols=50 disabled="disabled" id="description"></textarea><br /> <textarea rows=5 cols=50 disabled="disabled" id="description"></textarea><br />
</center> </center>
<div id="tableContainer"> <div id="tableContainer">
<div id="tableScroll"></div> <div id="tableScroll"></div>
<button data-localization-title="poll_create_user" id="create-user"><span class="fa fa-plus"></span></button> <button data-localization-title="poll_create_user" id="create-user"><span class="fa fa-plus"></span></button>
<button data-localization-title="poll_create_option" id="create-option"><span class="fa fa-plus"></span></button> <button data-localization-title="poll_create_option" id="create-option"><span class="fa fa-plus"></span></button>
<button data-localization-title="poll_commit" id="commit"><span class="fa fa-check"></span></button> <button data-localization-title="poll_commit" id="commit"><span class="fa fa-check"></span></button>
</div>
</div>
</div> </div>
</div> </div>

@ -692,7 +692,8 @@ var create = function (info) {
ifrw: window, ifrw: window,
realtime: info.realtime, realtime: info.realtime,
network: info.network, network: info.network,
$container: APP.$bar $container: APP.$bar,
$contentContainer: $('#content')
}; };
APP.toolbar = Toolbar.create(configTb); APP.toolbar = Toolbar.create(configTb);

@ -6,6 +6,17 @@ body {
padding: 0px; padding: 0px;
border: 0px; border: 0px;
} }
body {
display: flex;
flex-flow: column;
}
#content {
display: flex;
flex: 1;
}
#content #poll {
flex: 1;
}
.cryptpad-toolbar h2 { .cryptpad-toolbar h2 {
font: normal normal normal 12px Arial, Helvetica, Tahoma, Verdana, Sans-Serif; font: normal normal normal 12px Arial, Helvetica, Tahoma, Verdana, Sans-Serif;
color: #000; color: #000;

@ -19,6 +19,17 @@ html, body {
padding: 0px; padding: 0px;
border: 0px; border: 0px;
} }
body {
display: flex;
flex-flow: column;
}
#content {
display: flex;
flex: 1;
#poll {
flex: 1;
}
}
.cryptpad-toolbar h2 { .cryptpad-toolbar h2 {
font: normal normal normal 12px Arial, Helvetica, Tahoma, Verdana, Sans-Serif; font: normal normal normal 12px Arial, Helvetica, Tahoma, Verdana, Sans-Serif;

Loading…
Cancel
Save