generated from gethinode/mod-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from gethinode/develop
Initial release
- Loading branch information
Showing
18 changed files
with
195 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// load the HubScript if at least one form is defined | ||
if (document.querySelector('.form') !== null) { | ||
const script = document.createElement("script"); | ||
script.setAttribute('src', 'https://js.hsforms.net/forms/embed/v2.js') | ||
script.async = false | ||
document.body.appendChild(script) | ||
|
||
// create and embed each form within the designated div element | ||
script.onload = () => { | ||
document.querySelectorAll('.form').forEach(form => { | ||
hbspt.forms.create({ | ||
region: form.getAttribute('data-region'), | ||
portalId: form.getAttribute('data-portal-id'), | ||
formId: form.getAttribute('data-form-id'), | ||
target: `#${form.id}` | ||
}) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
comment: >- | ||
Creates an embedded form hosted by an external provider such as HubSpot. | ||
arguments: | ||
id: | ||
type: string | ||
position: 0 | ||
optional: false | ||
comment: >- | ||
The form's ID, which is used to retrieve the form definition. | ||
portal: | ||
type: int | ||
optional: true | ||
comment: >- | ||
The portal ID of the HubSpot account where you created the form. This is | ||
used to retrieve the form definition. | ||
region: | ||
type: select | ||
optional: true | ||
comment: >- | ||
The region of the portal where the form was created. This is used to | ||
retrieve the form definition. | ||
options: | ||
values: | ||
- eu1 | ||
- na1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
--- | ||
title: Test site | ||
description: Site to test module shortcode(s). | ||
date: 2023-07-10 | ||
date: 2024-09-28 | ||
--- | ||
|
||
TODO: placeholder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
module github.com/gethinode/mod-template/exampleSite | ||
module github.com/gethinode/mod-hubspot/exampleSite | ||
|
||
go 1.19 | ||
|
||
require github.com/gethinode/mod-template v0.0.0-20240912031743-7fd02bc201de // indirect |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,29 @@ | ||
baseURL = 'http://example.org/' | ||
languageCode = 'en-us' | ||
title = 'Test site for mod-template' | ||
title = 'Test site for mod-hubspot' | ||
|
||
[module] | ||
# Build and serve using local mod-template clone declared in the named Hugo workspace: | ||
workspace = "mod-template.work" | ||
# Build and serve using local mod-hubspot clone declared in the named Hugo workspace: | ||
workspace = "mod-hubspot.work" | ||
[[module.mounts]] | ||
source = "content" | ||
target = "content" | ||
[[module.mounts]] | ||
source = "data" | ||
target = "data" | ||
[[module.mounts]] | ||
source = "layouts" | ||
target = "layouts" | ||
[[module.imports]] | ||
path = "github.com/gethinode/mod-template" | ||
path = "github.com/gethinode/mod-hubspot" | ||
[[module.imports.mounts]] | ||
source = "assets/js/modules/hubspot/hubspot.js" | ||
target = "assets/js/hubspot.js" | ||
[[module.imports.mounts]] | ||
source = "dist" | ||
target = "static" | ||
source = "data" | ||
target = "data" | ||
[[module.imports.mounts]] | ||
source = "layouts" | ||
target = "layouts" | ||
target = "layouts" | ||
[[module.imports]] | ||
path = "github.com/gethinode/mod-utils/v2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
module github.com/gethinode/mod-template | ||
module github.com/gethinode/mod-hubspot | ||
|
||
go 1.19 | ||
|
||
require github.com/gethinode/mod-utils/v2 v2.8.1 // indirect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
github.com/gethinode/mod-utils/v2 v2.8.1 h1:u7sFbgJ5sBEMYC/GwcMRyjRAd5NxTjBnbld5b0V5n98= | ||
github.com/gethinode/mod-utils/v2 v2.8.1/go.mod h1:GTYeknoLujNjfDxI+V9Dcug26CYJSTJ0B/U2dagw9oY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<!-- | ||
Copyright © 2024 The Hinode Team / Mark Dumay. All rights reserved. | ||
Use of this source code is governed by The MIT License (MIT) that can be found in the LICENSE file. | ||
Visit gethinode.com/license for more details. | ||
--> | ||
|
||
{{ $error := false }} | ||
|
||
<!-- Initialize arguments --> | ||
{{ $args := partial "utilities/InitArgs.html" (dict "structure" "form" "args" .) }} | ||
{{ if $args.err }} | ||
{{ partial "utilities/LogErr.html" (dict | ||
"partial" "partials/form.html" | ||
"msg" "Invalid arguments" | ||
"details" $args.errmsg | ||
"file" page.File | ||
)}} | ||
{{ $error = true }} | ||
{{ end }} | ||
|
||
<!-- Initialize local arguments --> | ||
{{ $portal := $args.portal | default site.Params.modules.hubspot.portal }} | ||
{{ $region := $args.region | default site.Params.modules.hubspot.region }} | ||
|
||
{{ if not $region }} | ||
{{ partial "utilities/LogErr.html" (dict | ||
"partial" "partials/form.html" | ||
"msg" "Form is missing region argument" | ||
"file" page.File | ||
)}} | ||
{{ $error = true }} | ||
{{ end }} | ||
|
||
{{ if not $portal }} | ||
{{ partial "utilities/LogErr.html" (dict | ||
"partial" "partials/form.html" | ||
"msg" "Form is missing portal argument" | ||
"file" page.File | ||
)}} | ||
{{ $error = true }} | ||
{{ end }} | ||
|
||
<!-- Main code --> | ||
{{ if not $error }} | ||
<div class="form" id="form-{{ $args.id }}" | ||
{{- with $args.id }} data-form-id="{{ . }}"{{ end -}} | ||
{{- with $portal }} data-portal-id="{{ . }}"{{ end -}} | ||
{{- with $region }} data-region="{{ . }}"{{ end -}}> | ||
</div> | ||
{{ end }} |
Oops, something went wrong.