-
Notifications
You must be signed in to change notification settings - Fork 1
/
fs-person-preferred-name.html
47 lines (44 loc) · 1.24 KB
/
fs-person-preferred-name.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<link rel="import" href="../polymer/polymer-element.html">
<link rel="import" href="../fs-person-mixin/fs-person-mixin.html">
<link rel="import" href="fs-person-name.html">
<dom-module id="fs-person-preferred-name">
<template>
<style>
:host {
display: block;
}
</style>
<fs-person-name name="{{name}}" editable="[[editable]]" save-url="[[_saveUrl]]"></fs-person-name>
</template>
<script>
/**
* `fs-person-preferred-name`
*
*
* @customElement
* @polymer
* @demo demo/index.html
*/
class FsPersonPreferredName extends FSPersonMixin(Polymer.Element) {
static get is() { return 'fs-person-preferred-name'; }
static get properties() {
return {
name: Object,
editable: {
type: Boolean,
value: false
}
};
}
_personChanged() {
if(this.person && this.person.names){
this._saveUrl = this._saveUrl = this.person.links.person.href;
this.name = this.person.names.find(n => n.preferred);
} else {
this.name = undefined;
}
}
}
window.customElements.define(FsPersonPreferredName.is, FsPersonPreferredName);
</script>
</dom-module>