feature : members name displayed in list

This commit is contained in:
Alexandre Bourlier 2018-07-03 16:54:41 +02:00
parent c1b8980db8
commit 4f7c8b23c6
6 changed files with 67 additions and 43 deletions

2
dist/lib/sib-core vendored

@ -1 +1 @@
Subproject commit cbba4db47150bcac8e86a364e2a4b20ad27fb387 Subproject commit 444d258357cc525300c291e45f7be7f920f972e1

2
dist/lib/sib-router vendored

@ -1 +1 @@
Subproject commit 488ca64e9aafd20bbdb15c2d087f4771d135d681 Subproject commit 6109962852d523b23d47fb344083e77917ec1a9c

View File

@ -1,5 +1,6 @@
<script> <script>
class LDPDisplayMember extends LDPWidget { document.addEventListener("WebComponentsReady", function(event) {
class LDPDisplayMember extends SIBWidget {
get template() { get template() {
return ` return `
<div name="${this.name}"> <div name="${this.name}">
@ -17,6 +18,7 @@
} }
} }
customElements.define("ldp-display-member", LDPDisplayMember); customElements.define("ldp-display-member", LDPDisplayMember);
});
</script> </script>
<div id="channel" class="view-with-vertical-menu" style="display: none"> <div id="channel" class="view-with-vertical-menu" style="display: none">

View File

@ -19,7 +19,7 @@
<div id="edit-profile" style="display: none"> <div id="edit-profile" style="display: none">
<label for="avatar-input"> <label for="avatar-input">
<img id="avatar-preview" src="http://cdn.hd-app.local/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" id="avatar-input" name="avatar" value="http://cdn.hd-app.local/members/alexandre-bourlier.jpg" />`; <input type="file" id="avatar-input" name="avatar" value="http://cdn.hd-app.local/members/alexandre-bourlier.jpg" />`;

View File

@ -1,23 +1,43 @@
<script> <script>
class LDPDisplayCell extends SIBDisplayLookupList { document.addEventListener("WebComponentsReady", function(event) {
get template() { class UserInfo extends SIBDisplayLookupList {
return `<div name="${this.name}">${this.value.city} - ${this.value.country}</div>`; get parentElement() {return "div"}
getTemplate(value, index) {
var firstname, lastname;
if(typeof value == "object")
if(value.first_name) {
firstname = value.first_name;
lastname = value.last_name;
}
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 `<span id="${firstname}-${lastname}">${firstname} ${lastname}</span>`;
} }
} }
customElements.define("ldp-display-cell", LDPDisplayCell); customElements.define('hdapp-userinfo', UserInfo);
});
// class LDPDisplayCell extends SIBDisplayLookupList {
// get template() {
// return `<div name="${this.name}">${this.value.city} - ${this.value.country}</div>`;
// }
// }
// customElements.define("ldp-display-cell", LDPDisplayCell);
</script> </script>
<div id="members" class="view" style="display: none"> <div id="members" class="view" style="display: none">
<sib-display <sib-display
id="profiles-list" id="profiles-list"
data-src="<?php echo $sdn; ?>/members/" data-src="<?php echo $sdn; ?>/members/"
set-name="firstname, name-separator, lastname" data-fields="user"
value-name-separator="&nbsp;" widget-user="hdapp-userinfo"
value-city-separator=",&nbsp;"
data-fields="avatar, name, cell"
widget-avatar="sib-display-img"
widget-cell="ldp-display-cell"
search-fields="firstname, lastname"
next="member"
></sib-display> ></sib-display>
</div> </div>

View File

@ -1,5 +1,6 @@
<script> <script>
class LDPDisplayClient extends LDPWidget { document.addEventListener("WebComponentsReady", function(event) {
class LDPDisplayClient extends SIBWidget {
get template() { get template() {
return `<img name="${this.name}" src="${this.value.logo}"/>`; return `<img name="${this.name}" src="${this.value.logo}"/>`;
} }
@ -12,6 +13,7 @@
} }
} }
customElements.define("ldp-display-client", LDPDisplayClient); customElements.define("ldp-display-client", LDPDisplayClient);
});
</script> </script>
<div id="projects" style="display: none"> <div id="projects" style="display: none">