@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.
@@ -280,7 +280,6 @@ export default class UcdThemeHeader extends LitElement {
280
280
  } else {
281
281
  this._brandingBarLinks = [];
282
282
  }
283
- console.log(ele.navItems);
284
283
  }
285
284
 
286
285
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ucd-lib/theme-elements",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Custom elements for the UCD brand theme",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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} domain - Specify the domain to choose from
9
+ * @property {String} host - Specify the host to choose from
10
10
  *
11
- * <ucdlib-theme-author-profile domain="sandbox" email='sabaggett@ucdavis.edu></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
- domain: {type: String},
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.domain = '';
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 domain changes
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('domain') ){
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 = "https://library.ucdavis.edu/wp-json/ucdlib-directory/person/" + String(email);
200
- if (this.domain != "")
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" href="">${this.nameFirst} ${this.nameLast}</a></h3>
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">&#124;</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">&#124;</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">&#124;</span>`:html`<span class="noApp-pipe">&#124;</span>`}`: html``}</p>