update - chat inserted in member-chat view and nowhere else
This commit is contained in:
parent
f29e3c829d
commit
ae0ab04570
2
dist/lib/sib-chat
vendored
2
dist/lib/sib-chat
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 8793dea94c3be9c068ee3ee6a7a0dc5e084f442a
|
Subproject commit ab4fc15f5f4476e111dfb5bbdb43c7b88af18bf9
|
51
index.php
51
index.php
@ -40,56 +40,5 @@
|
|||||||
<?php require_once('src/html/channel-creation.html'); ?>
|
<?php require_once('src/html/channel-creation.html'); ?>
|
||||||
<?php require_once('src/html/search.html'); ?>
|
<?php require_once('src/html/search.html'); ?>
|
||||||
</main>
|
</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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
<script type="text/javascript" src="<?php echo $dn; ?>/node_modules/cropper/dist/cropper.min.js"></script>
|
<script type="text/javascript" src="<?php echo $dn; ?>/node_modules/cropper/dist/cropper.min.js"></script>
|
||||||
<script type="text/javascript" src="<?php echo $dn; ?>/dist/lib/webcomponentsjs/webcomponents-loader.js"></script>
|
<script type="text/javascript" src="<?php echo $dn; ?>/dist/lib/webcomponentsjs/webcomponents-loader.js"></script>
|
||||||
<script type="text/javascript" src="<?php echo $dn; ?>/src/js/hd-app.js?v=<?php echo $v ?>"></script>
|
<script type="text/javascript" src="<?php echo $dn; ?>/src/js/hd-app.js?v=<?php echo $v ?>"></script>
|
||||||
|
<script src="<?php echo $dn; ?>/dist/lib/sib-chat/3rdparty/sib-oidc-client.js?v=<?php echo $v ?>"></script>
|
||||||
|
|
||||||
<!-- Web components -->
|
<!-- Web components -->
|
||||||
<link rel="import" href="<?php echo $dn; ?>/dist/lib/sib-core/sib-display.html?v=<?php echo $v ?>" />
|
<link rel="import" href="<?php echo $dn; ?>/dist/lib/sib-core/sib-display.html?v=<?php echo $v ?>" />
|
||||||
|
@ -1,2 +1,12 @@
|
|||||||
<div id="member-chat" style="display: none">
|
<div id="member-chat" style="display: none">
|
||||||
|
<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/"
|
||||||
|
data-debug="true"
|
||||||
|
data-locales-url="node_modules/converse.js/locale/{{{locale}}}/LC_MESSAGES/converse.json"
|
||||||
|
bind-resources>
|
||||||
|
</sib-chat>
|
||||||
</div>
|
</div>
|
||||||
|
@ -14,40 +14,13 @@
|
|||||||
//}
|
//}
|
||||||
//customElements.define("ldp-form-img-upload", LDPFormImgUpload);
|
//customElements.define("ldp-form-img-upload", LDPFormImgUpload);
|
||||||
//widget-avatar="ldp-form-img-upload"
|
//widget-avatar="ldp-form-img-upload"
|
||||||
|
|
||||||
|
|
||||||
class HDAppUserInfo extends SIBDisplayLookupList {
|
|
||||||
get parentElement() {return "div"}
|
|
||||||
getTemplate(value, index) {
|
|
||||||
var firstname, lastname, email;
|
|
||||||
|
|
||||||
if(typeof value == "object")
|
|
||||||
if(value.first_name) {
|
|
||||||
firstname = value.first_name;
|
|
||||||
lastname = value.last_name;
|
|
||||||
email = value.email;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
store.get(value).then(resource => {
|
|
||||||
this.value.push(resource);
|
|
||||||
this.render();
|
|
||||||
});
|
|
||||||
if(Array.isArray(this.value))this.value.splice(this.value.indexOf(value), 1);
|
|
||||||
else this.value = [];
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
return `<div id="${firstname}-${lastname}">${firstname} ${lastname}</div>
|
|
||||||
<div id="${email}">${email}</div>`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
customElements.define('hdapp-userinfo', HDAppUserInfo);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="member-edit-profile" style="display: none">
|
<div id="member-edit-profile" style="display: none">
|
||||||
<!--<label for="avatar-input">-->
|
<label for="avatar-input" class="d-none">
|
||||||
<!--<img id="avatar-preview" src="http://cdn.local/hdapp/members/alexandre-bourlier.jpg" style="width: 100%;"/>-->
|
<img id="avatar-preview" src="http://cdn.local/hdapp/members/alexandre-bourlier.jpg" style="width: 100%;"/>
|
||||||
<!--</label>-->
|
</label>
|
||||||
<!--<input type="file" accept="image/*" id="avatar-input" name="avatar" value="http://cdn.hd-app.local/members/alexandre-bourlier.jpg" />-->
|
<input class="d-none" type="file" accept="image/*" id="avatar-input" name="avatar" value="http://cdn.hd-app.local/members/alexandre-bourlier.jpg" />
|
||||||
|
|
||||||
<sib-form
|
<sib-form
|
||||||
class="edit-form"
|
class="edit-form"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user