@ucd-lib/theme-elements 1.1.1 → 1.1.3
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;
|
|
@@ -45,6 +45,10 @@ export function render() {
|
|
|
45
45
|
grid-template-columns: 15% 85%;
|
|
46
46
|
width:100%;
|
|
47
47
|
}
|
|
48
|
+
|
|
49
|
+
.side-bar .contact-list{
|
|
50
|
+
display: block;
|
|
51
|
+
}
|
|
48
52
|
.container {
|
|
49
53
|
display: inline-grid;
|
|
50
54
|
grid-template-columns: 15% 85%;
|
|
@@ -98,7 +102,7 @@ export function render() {
|
|
|
98
102
|
}
|
|
99
103
|
.contact-list{
|
|
100
104
|
display:inline-block;
|
|
101
|
-
margin
|
|
105
|
+
margin: 5px 0;
|
|
102
106
|
}
|
|
103
107
|
.pipe {
|
|
104
108
|
font-size:30px;
|
|
@@ -121,7 +125,6 @@ export function render() {
|
|
|
121
125
|
|
|
122
126
|
.contact-list {
|
|
123
127
|
display:block;
|
|
124
|
-
margin-bottom:5px;
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
.contact-list .pipe {
|
|
@@ -166,7 +169,7 @@ ${this.eController ? html`
|
|
|
166
169
|
<div class="${this.sidebar ? 'side-bar':'container'}">
|
|
167
170
|
<div class="photo"><img src="${this.photo.link}" alt="${this.photoAlt}"></div>
|
|
168
171
|
<div class="text_container">
|
|
169
|
-
<
|
|
172
|
+
<h4 class="name"><a class="name" href="${this.link}">${this.nameFirst} ${this.nameLast}</a></h4>
|
|
170
173
|
<p class="title">${this.positionTitle} <span class="pipe">|</span> ${this.department}</p>
|
|
171
174
|
<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
175
|
<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>
|
|
@@ -177,7 +180,7 @@ ${this.eController ? html`
|
|
|
177
180
|
:html`
|
|
178
181
|
<div class="container-no-image">
|
|
179
182
|
<div class="text_container">
|
|
180
|
-
<
|
|
183
|
+
<h4 class="name"><a class="name" href="${this.link}">${this.nameFirst} ${this.nameLast}</a></h4>
|
|
181
184
|
<p class="title">${this.positionTitle} <span class="pipe">|</span> ${this.department}</p>
|
|
182
185
|
<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>
|
|
183
186
|
<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>
|