Userlist in polls
This commit is contained in:
@@ -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,7 +17,8 @@
|
|||||||
<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">
|
<div id="howItWorks">
|
||||||
<h1 id="mainTitle">CryptPoll</h1>
|
<h1 id="mainTitle">CryptPoll</h1>
|
||||||
<h2 data-localization="poll_subtitle"></h2>
|
<h2 data-localization="poll_subtitle"></h2>
|
||||||
@@ -44,6 +45,8 @@
|
|||||||
<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>
|
||||||
|
|
||||||
<div id="loading">
|
<div id="loading">
|
||||||
<div class="loadingContainer">
|
<div class="loadingContainer">
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user