Skip to content

Commit

Permalink
fix bug: now shows message if no related PDF file found
Browse files Browse the repository at this point in the history
  • Loading branch information
annyhe committed Jul 11, 2019
1 parent 7542280 commit d3716bf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<template>
<lightning-tabset variant="scoped">
<template for:each={tabs} for:item="tab">
<lightning-tab key={tab.value} label={tab.label} value={tab.value} onactive={setUrl}>
</lightning-tab>
</template>
</lightning-tabset>

<template if:true={fileID}>
<lightning-tabset variant="scoped">
<template for:each={tabs} for:item="tab">
<lightning-tab key={tab.value} label={tab.label} value={tab.value} onactive={setFileID}>
</lightning-tab>
</template>
</lightning-tabset>
<c-show-pdf-by-id
height-in-rem={heightInRem}
file-id={fileID}
></c-show-pdf-by-id>
</template>
<template if:false={pdfFiles}>
<lightning-card><p>No PDF File IDs found.</p></lightning-card>

<template if:false={fileID}>
<lightning-card><div class="slds-text-align_center">No related PDF file found.</div></lightning-card>
</template>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export default class ShowPdfRelatedToRecordId extends LightningElement {
}

get tabs() {
if (!this.fileID) return [];

const tabs = [];
const files = Object.entries(this.pdfFiles);
for (const [ID, title] of files) {
Expand All @@ -34,7 +36,7 @@ export default class ShowPdfRelatedToRecordId extends LightningElement {
return tabs;
}

setUrl(e) {
setFileID(e) {
this.fileID = e.target.value;
}
}

0 comments on commit d3716bf

Please sign in to comment.