Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Namespace injection token to LWC files #174

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,12 @@ import includeLogo from '@salesforce/apex/GGW_ApplicationCtrl.includeLogo';
import deleteLogo from '@salesforce/apex/GGW_ApplicationCtrl.deleteLogo';
import createContentDistribution from '@salesforce/apex/GGW_ApplicationCtrl.createContentDistribution';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import NAMESPACE_FIELD_CHECK from '@salesforce/schema/GGW_Grant_Application__c.Application_Name__c';

const GRANT_TITLE = 'Grant Application';
const GRANT_TITLE_HEADER = 'Grant Application:';
const GRANT_TITLE_ERROR = 'Grant Application do not exist, please create new or select existing grant.';
const GRANT_TITLE_LOOKUP_ERROR = 'Grant Application do not contain sections, please add sections to grant using Reorder.';
const GRANT_RECORD_PAGE_URL = '/lightning/r/GGW_Grant_Application__c/'; // Add record ID
const NAMESPACE_PFX = 'GCKit__';
const TAB_GRANT_PREVIEW = 'Grant_Preview';
const TAB_GRANT_PREVIEW_WORD = 'Grant_Preview_Word';
const TAB_GRANT_PREVIEW_PDF = 'Grant_Preview_PDF';

export default class GgwGrantApplication extends NavigationMixin(LightningElement) {
@api recordId;
Expand Down Expand Up @@ -203,51 +198,25 @@ export default class GgwGrantApplication extends NavigationMixin(LightningElemen
});
}

previewHTML(){
let tabName = 'Grant_Preview'; //TAB_GRANT_PREVIEW;
if(this.is2GPNamespace()){
tabName = 'GCKit__Grant_Preview'; //NAMESPACE_PFX + TAB_GRANT_PREVIEW;
}
console.log(`TAB Name HTML: ${tabName}`);
return tabName;
}
previewPDF(){
let tabName = TAB_GRANT_PREVIEW_PDF;
if(this.is2GPNamespace()){
tabName = NAMESPACE_PFX + TAB_GRANT_PREVIEW_PDF;
}
console.log(`TAB Name PDF: ${tabName}`);
return tabName;
}
previewWord(){
let tabName = TAB_GRANT_PREVIEW_WORD;
if(this.is2GPNamespace()){
tabName = NAMESPACE_PFX + TAB_GRANT_PREVIEW_WORD;
}
console.log(`TAB Name WORD: ${tabName}`);
return tabName;
}
handleExportMenuSelect(event){
const selectedItemValue = event.detail.value;
console.log(`## handleExportMenuSelect: ${selectedItemValue}`);
console.log(`### Derived name: ${JSON.stringify(NAMESPACE_FIELD_CHECK)}`);
const selectedItemValue = event.detail.value;

if(selectedItemValue === 'exportPDF'){
this.exportGrantVFPdf(this.previewPDF());
this.exportGrantVFPdf();
}
if(selectedItemValue === 'exportWORD'){
this.exportGrantVFWord(this.previewWord());
this.exportGrantVFWord();
}
if(selectedItemValue === 'exportHTML'){
this.exportGrantVFHTML(this.previewHTML());
this.exportGrantVFHTML();
}
}

exportGrantVFHTML(tabname){
exportGrantVFHTML(){
this[NavigationMixin.Navigate]({
type: 'standard__navItemPage',
attributes: {
apiName: tabname //'Grant_Preview'
apiName: '%%%NAMESPACED_ORG%%%Grant_Preview'
},
state: {
c__recordId: this.recordId,
Expand All @@ -256,12 +225,12 @@ export default class GgwGrantApplication extends NavigationMixin(LightningElemen
});
}

exportGrantVFWord(tabname){
exportGrantVFWord(){
// Tab name - Grant Preview Word
this[NavigationMixin.Navigate]({
type: 'standard__navItemPage',
attributes: {
apiName: tabname //'Grant_Preview_Word'
apiName: '%%%NAMESPACED_ORG%%%Grant_Preview_Word'
},
state: {
c__recordId: this.recordId, // Need this state object to pass parameters in LEX
Expand All @@ -270,11 +239,11 @@ export default class GgwGrantApplication extends NavigationMixin(LightningElemen
});
}

exportGrantVFPdf(tabname){
exportGrantVFPdf(){
this[NavigationMixin.Navigate]({
type: 'standard__navItemPage',
attributes: {
apiName: tabname //'Grant_Preview_PDF'
apiName: '%%%NAMESPACED_ORG%%%Grant_Preview_PDF'
},
state: {
c__recordId: this.recordId, // Need this state object to pass parameters in LEX
Expand Down
2 changes: 1 addition & 1 deletion force-app/main/default/lwc/ggwIntro/ggwIntro.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default class GgwIntro extends NavigationMixin(LightningElement) {
this[NavigationMixin.Navigate]({
type: 'standard__navItemPage',
attributes: {
apiName: 'GGW_Grant_Editor'
apiName: '%%%NAMESPACED_ORG%%%GGW_Grant_Editor'
},
state: {
c__recordId: 'a001D000005DsP7QAK'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default class GgwNewApplication extends NavigationMixin(LightningElement)
this[NavigationMixin.Navigate]({
type: 'standard__navItemPage',
attributes: {
apiName: 'GGW_Grant_Editor'
apiName: '%%%NAMESPACED_ORG%%%GGW_Grant_Editor'
},
state: {
c__recordId: recordId,
Expand Down
Loading