update - chat inserted in member-chat view and nowhere else

This commit is contained in:
Alexandre Bourlier
2018-07-11 20:43:18 +02:00
parent f29e3c829d
commit ae0ab04570
5 changed files with 16 additions and 83 deletions

View File

@ -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; ?>/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 src="<?php echo $dn; ?>/dist/lib/sib-chat/3rdparty/sib-oidc-client.js?v=<?php echo $v ?>"></script>
<!-- Web components -->
<link rel="import" href="<?php echo $dn; ?>/dist/lib/sib-core/sib-display.html?v=<?php echo $v ?>" />

View File

@ -1,2 +1,12 @@
<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>

View File

@ -14,40 +14,13 @@
//}
//customElements.define("ldp-form-img-upload", LDPFormImgUpload);
//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>
<div id="member-edit-profile" style="display: none">
<!--<label for="avatar-input">-->
<!--<img id="avatar-preview" src="http://cdn.local/hdapp/members/alexandre-bourlier.jpg" style="width: 100%;"/>-->
<!--</label>-->
<!--<input type="file" accept="image/*" id="avatar-input" name="avatar" value="http://cdn.hd-app.local/members/alexandre-bourlier.jpg" />-->
<label for="avatar-input" class="d-none">
<img id="avatar-preview" src="http://cdn.local/hdapp/members/alexandre-bourlier.jpg" style="width: 100%;"/>
</label>
<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
class="edit-form"