Skip to content

Commit

Permalink
Merge pull request #54 from sfdctaka/htmlPrettier
Browse files Browse the repository at this point in the history
Prettier html
  • Loading branch information
sfdctaka committed Nov 16, 2023
2 parents 3f1a5ed + 2eeb69d commit b7589f8
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 104 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
"lint": "eslint src --ext ts",
"test": "node ./out/test/runTest.js",
"test-coverage": "node ./out/test/runTest.js --coverage",
"prettier:write": "prettier --write \"src/**/*.{ts, js}\"",
"prettier:verify": "prettier --list-different \"src/**/*.{ts, js}\"",
"prettier:write": "prettier --write \"src/**/*.{ts, js}\" \"resources/instructions/**/*.html\"",
"prettier:verify": "prettier --list-different \"src/**/*.{ts, js}\" \"resources/instructions/**/*.html\"",
"bundle:extension": "esbuild ./src/extension.ts --bundle --outdir=out --format=cjs --target=es2020 --platform=node --external:vscode --external:@oclif/core --external:@salesforce/lwc-dev-mobile-core --minify --sourcemap",
"vscode:prepublish": "npm run clean && npm run bundle:extension"
},
Expand Down
203 changes: 101 additions & 102 deletions resources/instructions/createSObjectLwcQuickActions.html
Original file line number Diff line number Diff line change
@@ -1,39 +1,38 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Offline Starter Kit: Create sObject LWC Quick Actions</title>
</head>
<style>
h1 {
font-size: 16px;
}

h2 {
font-size: 14px;
}

table {
border-collapse: collapse;
}

table,
th,
td {
border-width: 1px;
border-style: solid;
}

th,
td {
text-align: center;
}
</style>

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Offline Starter Kit: Create sObject LWC Quick Actions</title>
</head>
<style>
h1 {
font-size: 16px;
}

h2 {
font-size: 14px;
}

table {
border-collapse: collapse;
}

table,
th,
td {
border-width: 1px;
border-style: solid;
}

th,
td {
text-align: center;
}
</style>

<body>
<h1>Create sObject LWC Quick Actions</h1>
<body>
<h1>Create sObject LWC Quick Actions</h1>

<p id="sobjectDiv">
The following sObjects are present in your configured landing page:
Expand All @@ -56,81 +55,81 @@ <h1>Create sObject LWC Quick Actions</h1>
</tbody>
</table>

<label style="display: block; margin-top: 10px; margin-bottom: 8px" for="generateLwcQuickActionsButton">
Click 'Generate LWC Quick Actions' to create the missing LWC Quick
Actions:
</label>

<button id="generateLwcQuickActionsButton">
Generate LWC Quick Actions
</button>

<button id="continueButton">
Continue
</button>

<script>
const generateQuickActionsButtonElement = document.getElementById(
'generateLwcQuickActionsButton'
);

const continueButtonElement = document.getElementById(
'continueButton'
);

const quickActionStatusTable = document.getElementById(
'quickActionStatusTable'
);

generateQuickActionsButtonElement.addEventListener('click', () => {
webviewMessaging.sendMessageRequest(
'generateLwcQuickActions',
{},
handleQuickActionStatusResponse
);
});

continueButtonElement.addEventListener('click', () => {
webviewMessaging.sendMessageRequest(
'continueButton'
);
});

// Wait until all scripts are loaded, before engaging with e.g.
// messaging functionality.
window.addEventListener('load', () => {
// What's the status of the various sobject quick actions in the landing_page.json?
webviewMessaging.sendMessageRequest(
'getQuickActionStatus',
{},
handleQuickActionStatusResponse
);
});
<label
style="display: block; margin-top: 10px; margin-bottom: 8px"
for="generateLwcQuickActionsButton"
>
Click 'Generate LWC Quick Actions' to create the missing LWC Quick
Actions:
</label>

function handleQuickActionStatusResponse(response) {
var tbody = quickActionStatusTable.getElementsByTagName('tbody')[0];
<button id="generateLwcQuickActionsButton">
Generate LWC Quick Actions
</button>

// remove all table rows first
while (tbody.firstChild) {
tbody.removeChild(tbody.firstChild);
}
<button id="continueButton">Continue</button>

// now re-populate the table body with updated results
for (const sobject in response.sobjects) {
const quickActions = response.sobjects[sobject];
<script>
const generateQuickActionsButtonElement = document.getElementById(
'generateLwcQuickActionsButton'
);

const continueButtonElement =
document.getElementById('continueButton');

const sobjectRow = tbody.insertRow();
const name = sobjectRow.insertCell(0);
const view = sobjectRow.insertCell(1);
const edit = sobjectRow.insertCell(2);
const create = sobjectRow.insertCell(3);
const quickActionStatusTable = document.getElementById(
'quickActionStatusTable'
);

name.innerText = sobject;
view.innerHTML = quickActions.view == true ? "✅" : "❌";
edit.innerHTML = quickActions.edit == true ? "✅" : "❌";
create.innerHTML = quickActions.create == true ? "✅" : "❌";
generateQuickActionsButtonElement.addEventListener('click', () => {
webviewMessaging.sendMessageRequest(
'generateLwcQuickActions',
{},
handleQuickActionStatusResponse
);
});

continueButtonElement.addEventListener('click', () => {
webviewMessaging.sendMessageRequest('continueButton');
});

// Wait until all scripts are loaded, before engaging with e.g.
// messaging functionality.
window.addEventListener('load', () => {
// What's the status of the various sobject quick actions in the landing_page.json?
webviewMessaging.sendMessageRequest(
'getQuickActionStatus',
{},
handleQuickActionStatusResponse
);
});

function handleQuickActionStatusResponse(response) {
var tbody =
quickActionStatusTable.getElementsByTagName('tbody')[0];

// remove all table rows first
while (tbody.firstChild) {
tbody.removeChild(tbody.firstChild);
}

// now re-populate the table body with updated results
for (const sobject in response.sobjects) {
const quickActions = response.sobjects[sobject];

const sobjectRow = tbody.insertRow();
const name = sobjectRow.insertCell(0);
const view = sobjectRow.insertCell(1);
const edit = sobjectRow.insertCell(2);
const create = sobjectRow.insertCell(3);

name.innerText = sobject;
view.innerHTML = quickActions.view == true ? '✅' : '❌';
edit.innerHTML = quickActions.edit == true ? '✅' : '❌';
create.innerHTML =
quickActions.create == true ? '✅' : '❌';
}
}
}
</script>
<script src="--- MESSAGING_SCRIPT_SRC ---"></script>
</body>
Expand Down

0 comments on commit b7589f8

Please sign in to comment.