96 lines
3.2 KiB
PHP
96 lines
3.2 KiB
PHP
<?php
|
|
// Some useful variables
|
|
$v = rand();// Used to avoid abusive caching by the browser
|
|
require_once("config.php");// Use "config-sample.php" to create your own
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
|
|
<title>Happy Dev App</title>
|
|
|
|
<?php
|
|
// Prod/Dev setup
|
|
if (in_array($dn, array('https://app.happy-dev.fr', 'https://staging-app.happy-dev.fr'))) {
|
|
require_once("src/html/dependencies-prod.php");
|
|
} else {
|
|
require_once("src/html/dependencies-dev.php");
|
|
}
|
|
?>
|
|
</head>
|
|
|
|
<body>
|
|
<?php require_once('src/html/menu.html'); ?>
|
|
|
|
<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.php'); ?>
|
|
<?php require_once('src/html/projects.html'); ?>
|
|
<?php require_once('src/html/project.html'); ?>
|
|
<?php require_once('src/html/project-creation.html'); ?>
|
|
<?php require_once('src/html/project-edition.html'); ?>
|
|
<?php require_once('src/html/client-creation.html'); ?>
|
|
<?php require_once('src/html/channels.html'); ?>
|
|
<?php require_once('src/html/channel.html'); ?>
|
|
<?php require_once('src/html/channel-edition.html'); ?>
|
|
<?php require_once('src/html/channel-creation.html'); ?>
|
|
<?php require_once('src/html/search.html'); ?>
|
|
</main>
|
|
|
|
<!-- This is a hack : https://git.happy-dev.fr/happy-dev/xmpp-chat-component/issues/24 -->
|
|
<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"
|
|
bind-resources>
|
|
</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[pathnameSegments.length - 1];
|
|
}
|
|
|
|
// Listen for changes
|
|
setInterval(function() {
|
|
previousRoute = currentRoute;
|
|
currentRoute = getCurrentRoute();
|
|
|
|
if (previousRoute !== currentRoute) {
|
|
insertChatIfNeeded();
|
|
}
|
|
}, 250);
|
|
|
|
// Inserts a chat in the current view if needed
|
|
function insertChatIfNeeded() {
|
|
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);
|
|
}
|
|
}
|
|
else {
|
|
body.appendChild(chatSingleton);
|
|
}
|
|
}
|
|
insertChatIfNeeded();
|
|
</script>
|
|
</body>
|
|
</html>
|