Skip to content

Commit 6e37d8a

Browse files
committed
Initial commit for Hubspot Forms integration.
1 parent fa5ee4e commit 6e37d8a

File tree

23 files changed

+472
-1
lines changed

23 files changed

+472
-1
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ This repository houses open-source extensions, created for Umbraco CMS, that int
77
### Commerce
88

99
[CommerceTools](./src/Umbraco.Cms.Integrations.Commerce.CommerceTools/) - a product and category picker that can be added as a property editor for content, with a value converter providing a strongly typed model for rendering.
10+
11+
### CRM
12+
13+
[Hubspot](./src/Umbraco.Cms.Integrations.Crm.Hubspot/) - a extension for Umbraco CMS providing a form picker and rendering component for Hubspot forms.

src/Umbraco.Cms.Integrations.Commerce.CommerceTools/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This integration provides a product and category picker, with data sourced from
44

55
## Prerequisites
66

7-
Requires minimum versions of Umbraco CMS: 8.5.0
7+
Requires minimum version of Umbraco CMS: 8.5.4.
88

99
## How To Use
1010

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@using System.Configuration
2+
@inherits Umbraco.Web.Mvc.UmbracoViewPage<Umbraco.Cms.Integrations.Crm.Hubspot.Models.ViewModels.HubspotFormViewModel>
3+
4+
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/shell.js"></script>
5+
<script>
6+
hbspt.forms.create({
7+
portalId: "@Model.PortalId",
8+
formId: "@Model.Id"
9+
});
10+
</script>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.hsOverlayGroup {
2+
margin-bottom: 1rem;
3+
}
4+
5+
.hsFormsList {
6+
list-style-type: none;
7+
margin: 0;
8+
}
9+
10+
.hsFormsList a {
11+
display: block;
12+
position: relative;
13+
padding: .25rem .375rem .25rem 1.5rem;
14+
}
15+
16+
.hsFormsList a:hover {
17+
text-decoration: none;
18+
background-color: #eee;
19+
}
20+
21+
.hsFormsList a i {
22+
position: absolute;
23+
top: .25rem;
24+
left: .25rem;
25+
}
26+
27+
.hsFormsList .formLine {
28+
display: block;
29+
}
30+
31+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
angular.module("umbraco")
2+
.controller("Umbraco.Cms.Integrations.Crm.Hubspot.FormPickerController",
3+
function ($scope, hubspotResources) {
4+
var vm = this;
5+
vm.loading = true;
6+
vm.hubspotFormsList = [];
7+
vm.searchTerm = "";
8+
vm.error = "";
9+
10+
hubspotResources.getHubspotFormsList().then(function (data) {
11+
vm.hubspotFormsList = data;
12+
vm.loading = false;
13+
//errorcheck
14+
console.log(data);
15+
});
16+
17+
vm.remove = function() {
18+
$scope.model.value = null;
19+
};
20+
21+
vm.saveForm = function(form) {
22+
$scope.model.value = form;
23+
};
24+
25+
vm.openHubspotFormPickerOverlay = function () {
26+
vm.hubspotFormPickerOverlay = {
27+
view: "/App_Plugins/UmbracoCms.Integrations/Crm/Hubspot/views/formpickeroverlay.html",
28+
show: true,
29+
title: "Hubspot forms",
30+
subtitle: "Select a form",
31+
hideSubmitButton: true,
32+
pickForm: function (form) {
33+
vm.saveForm(form);
34+
vm.hubspotFormPickerOverlay.show = false;
35+
vm.hubspotFormPickerOverlay = null;
36+
},
37+
close: function () {
38+
vm.hubspotFormPickerOverlay.show = false;
39+
vm.hubspotFormPickerOverlay = null;
40+
}
41+
};
42+
};
43+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
angular.module('umbraco.resources').factory('umbracoCmsIntegrationsCrmHubspotResource',
2+
function ($q, $http, umbRequestHelper) {
3+
return {
4+
getHubspotFormsList: function (id) {
5+
return umbRequestHelper.resourcePromise(
6+
$http.get("backoffice/UmbracoCmsIntegrationsCrmHubspot/Forms/GetAll"), "");
7+
}
8+
};
9+
}
10+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"propertyEditors": [
3+
{
4+
"alias": "Umbraco.Cms.Integrations.Crm.Hubspot.FormPicker",
5+
"name": "Hubspot Form Picker",
6+
"isParameterEditor": true,
7+
"group": "Pickers",
8+
"icon": "icon-handshake",
9+
"editor": {
10+
"view": "~/App_Plugins/UmbracoCms.Integrations/Crm/Hubspot/views/formpicker.html"
11+
}
12+
}
13+
],
14+
"css": [
15+
"~/App_Plugins/UmbracoCms.Integrations/Crm/Hubspot/css/styles.css"
16+
],
17+
"javascript": [
18+
"~/App_Plugins/UmbracoCms.Integrations/Crm/Hubspot/js/formpicker.controller.js",
19+
"~/App_Plugins/UmbracoCms.Integrations/Crm/Hubspot/js/hubspot.resource.js"
20+
]
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<div ng-controller="Umbraco.Cms.Integrations.Crm.Hubspot.FormPickerController as vm">
2+
3+
<umb-load-indicator ng-if="vm.loading">
4+
</umb-load-indicator>
5+
6+
<umb-node-preview ng-if="model.value"
7+
name="model.value.name"
8+
icon="model.icon"
9+
description="model.value.fields"
10+
allow-remove="true",
11+
12+
on-remove="vm.remove()">
13+
</umb-node-preview>
14+
15+
<a ng-if="!model.value && !vm.loading"
16+
class="umb-node-preview-add"
17+
href=""
18+
ng-click="vm.openHubspotFormPickerOverlay()"
19+
prevent-default>
20+
<localize key="general_add">Add</localize>
21+
</a>
22+
23+
<div ng-if="vm.error" class="alert alert-warning">
24+
{{ vm.error }}
25+
</div>
26+
27+
<umb-overlay ng-if="vm.hubspotFormPickerOverlay.show"
28+
model="vm.hubspotFormPickerOverlay"
29+
view="vm.hubspotFormPickerOverlay.view"
30+
position="right">
31+
</umb-overlay>
32+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<div ng-controller="Umbraco.Cms.Integrations.Crm.Hubspot.FormPickerController as vm">
2+
3+
<div class="hsOverlayGroup">
4+
<div class="form-search">
5+
<i class="icon-search"></i>
6+
<input type="text" class="-full-width-input" ng-model="vm.searchTerm" placeholder="Type to search..." umb-auto-focus="" aria-invalid="false">
7+
</div>
8+
</div>
9+
<div class="hsOverlayGroup">
10+
<ul class="hsFormsList">
11+
<li ng-repeat="form in vm.hubspotFormsList | orderBy:'name' | filter:vm.searchTerm" ng-click="model.pickForm(form)" class="ng-scope" role="button" tabindex="0">
12+
<a href="" ng-attr-title="form.name">
13+
<i class="icon-umb-contour"></i>
14+
<span class="formLine">{{form.name}}</span>
15+
<small class="formLine">{{form.fields}}</small>
16+
</a>
17+
</li>
18+
</ul>
19+
</div>
20+
</div>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
namespace Umbraco.Cms.Integrations.Crm.Hubspot.Models
2+
{
3+
using Newtonsoft.Json;
4+
using Newtonsoft.Json.Converters;
5+
using System.Globalization;
6+
7+
public static class Constants
8+
{
9+
internal static readonly JsonSerializerSettings SerializationSettings = new JsonSerializerSettings
10+
{
11+
MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
12+
DateParseHandling = DateParseHandling.None,
13+
Converters =
14+
{
15+
new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal }
16+
},
17+
};
18+
}
19+
}

0 commit comments

Comments
 (0)