Skip to content

Commit

Permalink
fix: APPS-2403 buttonurl is not required if the program URL behaviour…
Browse files Browse the repository at this point in the history
… is external (#731)

* fix: buttonurl is not required if the program URL behaviour is external

* fix: add buttonUrl check for search results too
  • Loading branch information
pghorpade authored Aug 24, 2023
1 parent 613983c commit 60c6215
Showing 1 changed file with 26 additions and 33 deletions.
59 changes: 26 additions & 33 deletions pages/about/programs/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@
@search-ready="getSearchData"
/>
<section-wrapper
v-show="
page &&
page.featuredPrograms &&
page.featuredPrograms.length &&
hits.length == 0 &&
!noResultsFound
v-show="page &&
page.featuredPrograms &&
page.featuredPrograms.length &&
hits.length == 0 &&
!noResultsFound
"
theme="divider"
>
Expand All @@ -39,12 +38,11 @@
</section-wrapper>

<section-wrapper
v-show="
page &&
page.featuredPrograms &&
page.featuredPrograms.length &&
hits.length == 0 &&
!noResultsFound
v-show="page &&
page.featuredPrograms &&
page.featuredPrograms.length &&
hits.length == 0 &&
!noResultsFound
"
class="section-no-top-margin"
>
Expand All @@ -53,17 +51,14 @@
:title="parsedBannerHeader.title"
:category="parsedBannerHeader.category"
breadcrumb="Featured"
:byline="parsedByline"
:description="parsedBannerHeader.text"
:to="parsedBannerHeader.to"
:align-right="true"
prompt="View Program"
class="banner section-featured-banner"
/>

<divider-general
v-if="parsedSectionHighlight && parsedSectionHighlight.length"
/>
<divider-general v-if="parsedSectionHighlight && parsedSectionHighlight.length" />

<section-teaser-highlight
v-if="parsedSectionHighlight && parsedSectionHighlight.length"
Expand All @@ -77,11 +72,10 @@
</section-wrapper>

<section-wrapper
v-show="
parsedProgramsList &&
parsedProgramsList.length > 0 &&
hits.length == 0 &&
!noResultsFound
v-show="parsedProgramsList &&
parsedProgramsList.length > 0 &&
hits.length == 0 &&
!noResultsFound
"
section-title="All Programs & Initiatives"
>
Expand Down Expand Up @@ -121,21 +115,19 @@
We can’t find the term you are looking for on this page,
but we're here to help. <br>
Try searching the whole site from
<a href="https://library.ucla.edu">UCLA Library Home</a>, or try one of the these regularly visited links:
<a href="https://library.ucla.edu">UCLA Library Home</a>, or try one of the these regularly visited
links:
</p>
<ul>
<li>
<a
href="https://www.library.ucla.edu/research-teaching-support/research-help"
>Research Help</a>
<a href="https://www.library.ucla.edu/research-teaching-support/research-help">Research Help</a>
</li>
<li>
<a href="/help/services-resources/ask-us">Ask Us</a>
</li>
<li>
<a
href="https://www.library.ucla.edu/use/access-privileges/disability-resources"
>Accessibility Resources</a>
<a href="https://www.library.ucla.edu/use/access-privileges/disability-resources">Accessibility
Resources</a>
</li>
</ul>
</rich-text>
Expand Down Expand Up @@ -220,7 +212,7 @@ export default {
"sectionHandle:program",
(this.$route.query.filters &&
JSON.parse(this.$route.query.filters)) ||
{},
{},
config.programsList.sortField,
config.programsList.orderBy,
config.programsList.resultFields,
Expand Down Expand Up @@ -299,11 +291,13 @@ export default {
},
parsedProgramsList() {
return this.programs.map((obj) => {
if( obj.programUrlBehavior === "externalSite")
console.log(obj.programUrlBehavior,obj)
return {
...obj,
to:
obj.programUrlBehavior === "externalSite"
? obj.buttonUrl[0].buttonUrl
? obj.buttonUrl && obj.buttonUrl.length > 0 && obj.buttonUrl[0].buttonUrl ? obj.buttonUrl[0].buttonUrl : null
: `/${obj.uri}`,
image: _get(obj, "heroImage[0].image[0]", null),
staffName: `${obj.fullName}`,
Expand Down Expand Up @@ -355,7 +349,7 @@ export default {
description: obj["_source"].text,
to:
obj["_source"].programUrlBehavior === "externalSite"
? obj["_source"].buttonUrl[0].buttonUrl
? obj["_source"].buttonUrl && obj["_source"].buttonUrl.length > 0 && obj["_source"].buttonUrl[0].buttonUrl ? obj["_source"].buttonUrl[0].buttonUrl : null
: `/${obj["_source"].uri}`,
image: _get(obj["_source"], "heroImage[0].image[0]", null),
category: _get(
Expand Down Expand Up @@ -386,6 +380,5 @@ export default {
</script>

<style lang="scss" scoped>
.page-programs {
}
.page-programs {}
</style>

4 comments on commit 60c6215

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.