feature - members pages done for alpha-1

This commit is contained in:
Alexandre Bourlier
2018-07-08 17:19:26 +02:00
parent 3259183299
commit 49e1418e93
11 changed files with 76 additions and 77 deletions

View File

@ -28,8 +28,7 @@
<main id="mainContainer" class="container-fluid">
<?php require_once('src/html/dashboard.html'); ?>
<?php require_once('src/html/members.html'); ?>
<?php require_once('src/html/member.html'); ?>
<?php require_once('src/html/edit-profile.html'); ?>
<?php require_once('src/html/member.php'); ?>
<?php require_once('src/html/projects.html'); ?>
<?php require_once('src/html/project.html'); ?>
<?php require_once('src/html/project-creation.html'); ?>
@ -43,52 +42,53 @@
</main>
<!-- This is a hack : https://git.happy-dev.fr/happy-dev/xmpp-chat-component/issues/24 -->
<!--sib-chat
<sib-chat
id="chat-singleton"
data-src="https://djangoldp.happy-dev.fr/users/1"
data-authentication="login"
data-auto-login="true"
data-bosh-service-url="http://jabber.happy-dev.fr/http-bind/" // FIXME: make HTTPS
data-debug="false"
data-locales-url="node_modules/converse.js/locale/{{{locale}}}/LC_MESSAGES/converse.json">
</sib-chat-->
</sib-chat>
<script>
// Store url on load
var currentRoute = getCurrentRoute();
var previousRoute = "";
var chatSingleton = document.querySelector("#chat-singleton");
var body = document.querySelector("body");
function getCurrentRoute() {
var pathnameSegments = window.location.pathname.split("/");
return pathnameSegments[1];
return pathnameSegments[pathnameSegments.length - 1];
}
// Listen for changes
//setInterval(function() {
//if (currentRoute != window.location.href) {
//currentRoute = getCurrentRoute();
setInterval(function() {
previousRoute = currentRoute;
currentRoute = getCurrentRoute();
//insertChatIfNeeded();
//}
//}, 250);
if (previousRoute !== currentRoute) {
insertChatIfNeeded();
}
}, 250);
// Inserts a chat in the current view if needed
function insertChatIfNeeded() {
if (["project", "project-chat", "channel", "channel-chat", "member", "member-chat"].indexOf(currentRoute) > -1) {
if (currentRoute.indexOf("chat") == -1) {
currentRoute += "-chat";
}
console.log(currentRoute);
if (["project-chat", "channel-chat", "member-chat"].indexOf(currentRoute) > -1) {
var currentView = document.querySelector("#" + currentRoute);
if (currentView.querySelector("sib-chat") == null) {
currentView.appendChild(chatSingleton);
currentView.style.display = 'block';
}
}
else {
body.appendChild(chatSingleton);
}
}
insertChatIfNeeded();
</script>
</body>
</html>