Search matches:
${this.result.numberOfGrants} grants
diff --git a/services/base-service/spa/client/public/elements/components/ucdlib-browse-az.js b/services/base-service/spa/client/public/elements/components/ucdlib-browse-az.js
index a6ab162e..076691de 100644
--- a/services/base-service/spa/client/public/elements/components/ucdlib-browse-az.js
+++ b/services/base-service/spa/client/public/elements/components/ucdlib-browse-az.js
@@ -11,6 +11,7 @@ export default class UcdlibBrowseAZ extends Mixin(LitElement)
return {
url : { type : String },
keySort : { type : String },
+ browseType : { type : String },
selectedLetter : { type : String, attribute : 'selected-letter' },
noResult : { type : String, attribute : 'no-result' },
sort : { state : true },
@@ -29,6 +30,7 @@ export default class UcdlibBrowseAZ extends Mixin(LitElement)
this.render = render.bind(this);
this.alpha = [
+ {display: '#', value: '1', exists: true},
{display: 'A', value: 'a', exists: true},
{display: 'B', value: 'b', exists: true},
{display: 'C', value: 'c', exists: true},
@@ -57,10 +59,11 @@ export default class UcdlibBrowseAZ extends Mixin(LitElement)
{display: 'Z', value: 'z', exists: true}
];
- this.selectedLetter = 'a';
+ this.selectedLetter = '';
+ this.browseType = '';
this.sort = this.defaultSort;
- this.parseLocation();
+ // this.parseLocation();
}
async firstUpdated() {
@@ -69,14 +72,18 @@ export default class UcdlibBrowseAZ extends Mixin(LitElement)
async _onAppStateUpdate(e) {
if( e.location.page !== 'browse' ) return;
- if( e.location.path.length < 2 ) {
- this.selectedLetter = 'a';
+ if( e.location.path.length < 3 ) {
+ this.selectedLetter = '';
} else {
this.selectedLetter = e.location.path[2]?.toLowerCase();
}
- // to get active filters/a-z
- await this.BrowseByModel.browseExpertsAZ();
+ this.browseType = e.location.path[1];
+ if( this.browseType === 'expert' ) {
+ this._onBrowseExpertsAzUpdate(await this.BrowseByModel.browseAZBy(this.browseType));
+ } else if( this.browseType === 'grant' ) {
+ this._onBrowseGrantsAzUpdate(await this.BrowseByModel.browseAZBy(this.browseType));
+ }
this.requestUpdate();
}
@@ -85,26 +92,46 @@ export default class UcdlibBrowseAZ extends Mixin(LitElement)
if( e.state !== 'loaded' ) return;
let az = e.payload || [];
+ this._updateAz(az);
+ }
+
+ _onBrowseGrantsAzUpdate(e) {
+ if( e.state !== 'loaded' ) return;
+
+ let az = e.payload || [];
+ this._updateAz(az);
+ }
+
+ _updateAz(az) {
az.forEach(item => {
// disable if no results for letter
let matchedLetter = this.alpha.find(l => l.value.toUpperCase() === item.params?.p.toUpperCase());
if( matchedLetter ) matchedLetter.exists = item.total > 0;
});
+
+ // set letter to first letter with results
+ if( this.alpha.find(l => l.exists) && !this.selectedLetter ) {
+ this.selectedLetter = this.alpha.find(l => l.exists).value;
+ } else if( !this.selectedLetter ) {
+ this.selectedLetter = this.alpha[0]?.value;
+ }
+
+ this.AppStateModel.setLocation(`/browse/${this.browseType}/${this.selectedLetter}`);
this.requestUpdate();
}
- parseLocation() {
- let selectedLetter = this.AppStateModel.location.pathname.split('/browse/expert/')?.[1];
- if( !selectedLetter ) return;
+ // parseLocation() {
+ // let selectedLetter = this.AppStateModel.location.pathname.split('/browse/expert/')?.[1];
+ // if( !selectedLetter ) return;
- this.onAlphaInput({ value : selectedLetter });
- }
+ // this.onAlphaInput({ value : selectedLetter });
+ // }
onAlphaInput(v) {
if( !v || v.value === this.selectedLetter || !v.exists ) return;
this.selectedLetter = v.value;
- this.AppStateModel.setLocation(`/browse/expert/${this.selectedLetter}`);
+ this.AppStateModel.setLocation(`/browse/${this.browseType}/${this.selectedLetter}`);
}
}
diff --git a/services/base-service/spa/client/public/elements/fin-app.tpl.js b/services/base-service/spa/client/public/elements/fin-app.tpl.js
index c568aaf0..6f5ad717 100644
--- a/services/base-service/spa/client/public/elements/fin-app.tpl.js
+++ b/services/base-service/spa/client/public/elements/fin-app.tpl.js
@@ -154,7 +154,7 @@ return html`
Experts
-
+
Grants
diff --git a/services/base-service/spa/client/public/elements/pages/browse/app-browse-by.js b/services/base-service/spa/client/public/elements/pages/browse/app-browse-by.js
index 5f001684..d74be16e 100644
--- a/services/base-service/spa/client/public/elements/pages/browse/app-browse-by.js
+++ b/services/base-service/spa/client/public/elements/pages/browse/app-browse-by.js
@@ -13,7 +13,8 @@ export default class AppBrowseBy extends Mixin(LitElement)
static get properties() {
return {
- id : { type : String },
+ browseType : { type : String, attribute : 'browse-type' },
+ letter : { type : String },
displayedResults : { type : Array },
resultsPerPage : { type : Number },
currentPage : { type : Number },
@@ -26,7 +27,8 @@ export default class AppBrowseBy extends Mixin(LitElement)
super();
this.render = render.bind(this);
- this.id = '';
+ this.browseType = '';
+ this.letter = '';
this.displayedResults = [];
this.resultsPerPage = 25;
this.currentPage = 1;
@@ -60,19 +62,24 @@ export default class AppBrowseBy extends Mixin(LitElement)
*/
async _onAppStateUpdate(e) {
if( e.location.page !== 'browse' ) return;
- if( e.location.path.length < 3 ) {
- this.AppStateModel.setLocation('/browse/expert/a');
- return;
- }
- this.id = e.location.path[2];
+ this.browseType = e.location.path[1];
+ this.letter = e.location.path[2];
+
+ this.displayedResults = [];
+
let page = e.location.path[3];
let resultsPerPage = e.location.path[4];
- if( this.id ) {
+ if( this.letter ) {
this.currentPage = parseInt(page) ? page : 1;
this.resultsPerPage = parseInt(resultsPerPage) ? resultsPerPage : 25;
- this._onBrowseExpertsUpdate(await this.BrowseByModel.browseExperts(this.id, this.currentPage, this.resultsPerPage));
+
+ if( this.browseType === 'expert' ) {
+ this._onBrowseExpertsUpdate(await this.BrowseByModel.browseBy('expert', this.letter, this.currentPage, this.resultsPerPage));
+ } else if( this.browseType === 'grant' ) {
+ this._onBrowseGrantsUpdate(await this.BrowseByModel.browseBy('grant', this.letter, this.currentPage, this.resultsPerPage));
+ }
}
}
@@ -110,6 +117,39 @@ export default class AppBrowseBy extends Mixin(LitElement)
this.paginationTotal = Math.ceil(this.totalResultsCount / this.resultsPerPage);
}
+ /**
+ * @method _onBrowseGrantsUpdate
+ * @description bound to BrowseByModel browse-grants-update event
+ *
+ * @param {Object} e
+ * @returns {Promise}
+ */
+ _onBrowseGrantsUpdate(e) {
+ if( e.state !== 'loaded' ) return;
+ if( !e.payload?.hits?.length ) {
+ this.displayedResults = [];
+ return;
+ }
+
+ // parse hits
+ this.displayedResults = (e.payload?.hits || []).map((r, index) => {
+ let id = r['@id'];
+ if( Array.isArray(r.name) ) r.name = r.name[0];
+ let name = r.name?.split('§')?.shift()?.trim();
+ let subtitle = ((r.name?.split('§') || [])[1] || '').trim().replaceAll('•', '•');
+
+ return {
+ position: index+1,
+ id: 'grant/'+id,
+ name,
+ subtitle
+ }
+ });
+
+ this.totalResultsCount = e.payload.total;
+ this.paginationTotal = Math.ceil(this.totalResultsCount / this.resultsPerPage);
+ }
+
/**
* @method _onPaginationChange
* @description bound to click events of the pagination element
@@ -119,9 +159,10 @@ export default class AppBrowseBy extends Mixin(LitElement)
_onPaginationChange(e) {
this.currentPage = e.detail.page;
- let path = '/browse/expert/' + this.id;
+ let path = `/browse/${this.browseType}/${this.letter}`;
if( this.currentPage > 1 || this.resultsPerPage > 25 ) path += `/${this.currentPage}`;
if( this.resultsPerPage > 25 ) path += `/${this.resultsPerPage}`;
+
this.AppStateModel.setLocation(path);
window.scrollTo(0, 0);
diff --git a/services/base-service/spa/client/public/elements/pages/browse/app-browse-by.tpl.js b/services/base-service/spa/client/public/elements/pages/browse/app-browse-by.tpl.js
index 8132a9b9..e0832301 100644
--- a/services/base-service/spa/client/public/elements/pages/browse/app-browse-by.tpl.js
+++ b/services/base-service/spa/client/public/elements/pages/browse/app-browse-by.tpl.js
@@ -131,7 +131,7 @@ return html`
diff --git a/services/base-service/spa/client/public/elements/pages/expert/app-expert-grants-list.tpl.js b/services/base-service/spa/client/public/elements/pages/expert/app-expert-grants-list.tpl.js
index 17d4f73b..cf8c4fe8 100644
--- a/services/base-service/spa/client/public/elements/pages/expert/app-expert-grants-list.tpl.js
+++ b/services/base-service/spa/client/public/elements/pages/expert/app-expert-grants-list.tpl.js
@@ -92,15 +92,6 @@ return html`
.grant-details .dot {
padding: 0 0.25rem;
- color: var(--black, #000);
- font-family: Proxima Nova;
- font-size: 1.1875rem;
- font-style: normal;
- font-weight: 700;
- line-height: 1.92125rem;
- text-transform: uppercase;
- position: relative;
- bottom: 0.25rem;
}
.grant-item ucdlib-icon {
@@ -157,9 +148,9 @@ return html`
${grant.start} - ${grant.end}
- .
+ •
${grant.role}
- .
+ •
Awarded by ${grant.awardedBy}