Skip to content

Commit

Permalink
Bind checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
auxves committed Jul 18, 2019
1 parent 60663e6 commit 7e37e49
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/service/github.oauth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class GitHubOAuthService {

const gists: any[] = await this.getGists(token, user, host);

state.commons.webviewService.OpenGistSelectionpage(gists, cmd)
state.commons.webviewService.OpenGistSelectionpage(gists, cmd);
} catch (err) {
const error = new Error(err);
Commons.LogException(error, state.commons.ERROR_MESSAGE, true);
Expand Down
21 changes: 11 additions & 10 deletions src/service/webview.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ export class WebviewService {
{
find: "@RELEASE_NOTES",
replace: "releaseNotes"
},
{
find: "@CHECKED",
replace: "checked"
}
]
},
Expand Down Expand Up @@ -310,14 +314,9 @@ export class WebviewService {
}

public IsLandingPageEnabled(): boolean {
const dontShowThisAgain = state.context.globalState.get<boolean>(
return !state.context.globalState.get<boolean>(
"landingPage.dontShowThisAgain"
);
if (dontShowThisAgain) {
return false;
} else {
return true;
}
}

public OpenLandingPage(cmd?: string) {
Expand All @@ -326,7 +325,8 @@ export class WebviewService {
const content: string = this.GenerateContent({
content: webview.htmlContent,
items: webview.replaceables,
releaseNotes
releaseNotes,
checked: this.IsLandingPageEnabled()
});
if (webview.webview) {
webview.webview.webview.html = content;
Expand Down Expand Up @@ -408,9 +408,10 @@ export class WebviewService {
content: webview.htmlContent,
items: webview.replaceables,
gists,
skip: cmd !== "extension.downloadSettings"
? `<a href="#" onclick="vscode.postMessage({close: true});" title="Skip (new one will be created upon first upload)" class="btn btn-primary mt-4">Skip (new one will be created upon first upload)</a>`
: ""
skip:
cmd !== "extension.downloadSettings"
? `<a href="#" onclick="vscode.postMessage({close: true});" title="Skip (new one will be created upon first upload)" class="btn btn-primary mt-4">Skip (new one will be created upon first upload)</a>`
: ""
});
if (webview.webview) {
webview.webview.webview.html = content;
Expand Down
5 changes: 3 additions & 2 deletions ui/landing-page/landing-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ <h3 class="mx-auto mb-3 text-white-50a">
>Questions & Issues</a
>
<br />
<a href="https://github.com/shanalikhan/code-settings-sync/blob/master/CONTRIBUTING.md"
<a
href="https://github.com/shanalikhan/code-settings-sync/blob/master/CONTRIBUTING.md"
>Contribute</a
>
<br />
Expand All @@ -154,7 +155,6 @@ <h3 class="mb-3">Sponsors</h3>
class="custom-control-input checkbox"
type="checkbox"
id="customCheck1"
checked="true"
onclick="sendCommand('dontShowThisAgain', !this.checked)"
/>
<label for="customCheck1" class="custom-control-label">
Expand All @@ -167,6 +167,7 @@ <h3 class="mb-3">Sponsors</h3>
<font-injector></font-injector>
<script defer>
const releaseNotes = JSON.parse(`@RELEASE_NOTES`);
const checked = "@CHECKED";
</script>
<script defer src="@PWD/ui/landing-page/landing-page.js"></script>
</body>
Expand Down
2 changes: 2 additions & 0 deletions ui/landing-page/landing-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ releaseNotes.changes.forEach(change => {

const currentVersionElement = document.querySelector("#current-version");
currentVersionElement.innerHTML = releaseNotes.currentVersion;

document.querySelector("#customCheck1").checked = checked === "true";

0 comments on commit 7e37e49

Please sign in to comment.