@ucd-lib/theme-elements 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -6,9 +6,9 @@ import {TaskController} from '../../utils/controllers/task.js';
|
|
|
6
6
|
* @class AuthorProfile
|
|
7
7
|
* @description This author profile hydrates with the website wordpress api and goes into a profile block.
|
|
8
8
|
* @property {String} email - Email to reference person
|
|
9
|
-
* @property {String}
|
|
9
|
+
* @property {String} host - Specify the host to choose from
|
|
10
10
|
*
|
|
11
|
-
* <ucdlib-theme-author-profile
|
|
11
|
+
* <ucdlib-theme-author-profile host="sandbox" email='sabaggett@ucdavis.edu></ucdlib-theme-author-profile>
|
|
12
12
|
*/
|
|
13
13
|
export default class UcdlibAuthorProfile extends LitElement {
|
|
14
14
|
static get properties() {
|
|
@@ -16,20 +16,21 @@ export default class UcdlibAuthorProfile extends LitElement {
|
|
|
16
16
|
results : {type: Object, attribute:false},
|
|
17
17
|
email : {type: String},
|
|
18
18
|
id: {type: Number},
|
|
19
|
-
nameLast: {type: String},
|
|
20
|
-
nameFirst: {type: String},
|
|
19
|
+
nameLast: {type: String, attribute: 'name-last'},
|
|
20
|
+
nameFirst: {type: String, attribute: 'name-first'},
|
|
21
21
|
link: {type: String},
|
|
22
|
-
contactWebsite: {type: String},
|
|
23
|
-
contactEmail: {type: String},
|
|
24
|
-
contactPhone: {type: String},
|
|
25
|
-
contactWebsiteLabel: {type: String},
|
|
26
|
-
contactEmailLabel: {type: String},
|
|
27
|
-
contactPhoneLabel: {type: String},
|
|
28
|
-
contactAppointmentUrl: {type: String},
|
|
29
|
-
positionTitle: {type: String},
|
|
22
|
+
contactWebsite: {type: String, attribute: 'contact-website'},
|
|
23
|
+
contactEmail: {type: String, attribute: 'contact-email'},
|
|
24
|
+
contactPhone: {type: String, attribute: 'contact-phone'},
|
|
25
|
+
contactWebsiteLabel: {type: String, attribute: 'contact-website-label'},
|
|
26
|
+
contactEmailLabel: {type: String, attribute: 'contact-email-label'},
|
|
27
|
+
contactPhoneLabel: {type: String, attribute: 'contact-phone-label'},
|
|
28
|
+
contactAppointmentUrl: {type: String, attribute: 'contact-appointment-url'},
|
|
29
|
+
positionTitle: {type: String, attribute: 'position-title'},
|
|
30
30
|
photo: {type: Object},
|
|
31
31
|
department: {type: String},
|
|
32
|
-
|
|
32
|
+
host: {type: String},
|
|
33
|
+
apiPath: {type: String, attribute: 'api-path'},
|
|
33
34
|
sidebar: {type: Boolean}
|
|
34
35
|
};
|
|
35
36
|
}
|
|
@@ -46,7 +47,9 @@ export default class UcdlibAuthorProfile extends LitElement {
|
|
|
46
47
|
this.ERROR = false;
|
|
47
48
|
this.results = {};
|
|
48
49
|
this.email = '';
|
|
49
|
-
this.
|
|
50
|
+
this.host = window.location.origin;
|
|
51
|
+
this.apiPath = '/wp-json/ucdlib-directory/person/';
|
|
52
|
+
|
|
50
53
|
|
|
51
54
|
this.errorMessage = 'This is not an email.';
|
|
52
55
|
|
|
@@ -77,13 +80,13 @@ export default class UcdlibAuthorProfile extends LitElement {
|
|
|
77
80
|
/**
|
|
78
81
|
* @method updated
|
|
79
82
|
*
|
|
80
|
-
* @description request user data when email or
|
|
83
|
+
* @description request user data when email or host changes
|
|
81
84
|
*
|
|
82
85
|
* @param {Object} props
|
|
83
86
|
*
|
|
84
87
|
*/
|
|
85
88
|
updated(props){
|
|
86
|
-
if( props.has('email') || props.has('
|
|
89
|
+
if( props.has('email') || props.has('host') || props.has('apiPath')){
|
|
87
90
|
if( !this.email ) return;
|
|
88
91
|
this.eController = new TaskController(this, this._requestUrl());
|
|
89
92
|
}
|
|
@@ -194,11 +197,9 @@ export default class UcdlibAuthorProfile extends LitElement {
|
|
|
194
197
|
let email =this.email;
|
|
195
198
|
let validate = this.validationLink(email);
|
|
196
199
|
if(!validate) console.error(email);
|
|
197
|
-
let url;
|
|
198
200
|
|
|
199
|
-
url =
|
|
200
|
-
|
|
201
|
-
url = "https://" + this.domain + ".library.ucdavis.edu/wp-json/ucdlib-directory/person/" + String(email);
|
|
201
|
+
let url = (this.host || window.location.origin) + this.apiPath + String(email);
|
|
202
|
+
|
|
202
203
|
this.requestUpdate();
|
|
203
204
|
|
|
204
205
|
return url;
|
|
@@ -166,7 +166,7 @@ ${this.eController ? html`
|
|
|
166
166
|
<div class="${this.sidebar ? 'side-bar':'container'}">
|
|
167
167
|
<div class="photo"><img src="${this.photo.link}" alt="${this.photoAlt}"></div>
|
|
168
168
|
<div class="text_container">
|
|
169
|
-
<h3 class="name"><a class="name"
|
|
169
|
+
<h3 class="name"><a class="name" href="${this.link}">${this.nameFirst} ${this.nameLast}</a></h3>
|
|
170
170
|
<p class="title">${this.positionTitle} <span class="pipe">|</span> ${this.department}</p>
|
|
171
171
|
<p class="contact-list">${this.contactPhone ? html`${this.svgIcon.phone} <a class="info" href="tel:${this.contactPhone}">${this.contactPhone}</a> <span class="pipe">|</span>`: html``}</p>
|
|
172
172
|
<p class="contact-list">${this.contactEmail ? html`${this.svgIcon.email} <a class="info" href="mailto:${this.contactEmail}">${this.contactEmail}</a> ${this.contactAppointmentUrl ? html`<span class="pipe">|</span>`:html`<span class="noApp-pipe">|</span>`}`: html``}</p>
|