Skip to content

Commit 6842f50

Browse files
committed
Feedback updates
1 parent 95051b0 commit 6842f50

File tree

15 files changed

+74
-42
lines changed

15 files changed

+74
-42
lines changed

src/Umbraco.Cms.Integrations.Crm.Dynamics/App_Plugins/UmbracoCms.Integrations/Crm/Dynamics/Render/DynamicsForm.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
var id = Guid.NewGuid();
77
}
88

9-
@if (Model.IFrameEmbedded)
9+
@if (Model.IframeEmbedded)
1010
{
11-
<iframe frameBorder="0" style="width:100%" id=@id></iframe>
11+
<iframe frameBorder="0" style="width:100%;height:100%;" id=@id></iframe>
1212
<script>
1313
var sandboxSrc = "https://@(Model.Hostname)/t/formsandbox/@(Model.WebsiteId)/@(Model.FormBlockId)?ad="
1414
+ encodeURIComponent(document.location.toString()); document.getElementById('@id').setAttribute('src', sandboxSrc);

src/Umbraco.Cms.Integrations.Crm.Dynamics/App_Plugins/UmbracoCms.Integrations/Crm/Dynamics/Render/DynamicsFormV8.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
var id = Guid.NewGuid();
77
}
88

9-
@if (Model.IFrameEmbedded)
9+
@if (Model.IframeEmbedded)
1010
{
11-
<iframe frameBorder="0" style="width:100%" id=@id></iframe>
11+
<iframe frameBorder="0" style="width:100%;height:100%;" id=@id></iframe>
1212
<script>
1313
var sandboxSrc = "https://@(Model.Hostname)/t/formsandbox/@(Model.WebsiteId)/@(Model.FormBlockId)?ad="
1414
+ encodeURIComponent(document.location.toString()); document.getElementById('@id').setAttribute('src', sandboxSrc);

src/Umbraco.Cms.Integrations.Crm.Dynamics/App_Plugins/UmbracoCms.Integrations/Crm/Dynamics/css/styles.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,8 @@
3131

3232
.dynSettings {
3333
padding-top: 4px;
34+
}
35+
36+
.dynFormSelected {
37+
background: #fee4e1;
3438
}

src/Umbraco.Cms.Integrations.Crm.Dynamics/App_Plugins/UmbracoCms.Integrations/Crm/Dynamics/js/configuration.controller.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@
2525

2626
umbracoCmsIntegrationsCrmDynamicsResource.revokeAccessToken().then(function () {
2727
vm.oauthConfig.isConnected = false;
28-
notificationsService.success("Dynamics Configuration", "OAuth connection revoked.");
28+
29+
// if directive runs from property editor, the notifications should be hidden, because they will not be displayed properly behind the overlay window.
30+
// if directive runs from data type, the notifications are displayed
31+
if (typeof $scope.connected === "undefined")
32+
notificationsService.success("Dynamics Configuration", "OAuth connection revoked.");
2933

3034
if (typeof $scope.revoked === "function")
3135
$scope.revoked();
@@ -38,11 +42,18 @@
3842

3943
umbracoCmsIntegrationsCrmDynamicsResource.getAccessToken(event.data.code).then(function (response) {
4044
if (response.startsWith("Error:")) {
41-
notificationsService.error("Dynamics Configuration", response);
45+
46+
// if directive runs from property editor, the notifications should be hidden, because they will not be displayed properly behind the overlay window.
47+
// if directive runs from data type, the notifications are displayed
48+
if (typeof $scope.connected === "undefined")
49+
notificationsService.error("Dynamics Configuration", response);
4250
} else {
4351
vm.oauthConfig.isConnected = true;
44-
45-
notificationsService.success("Dynamics Configuration", "OAuth connected.");
52+
53+
// if directive runs from property editor, the notifications should be hidden, because they will not be displayed properly behind the overlay window.
54+
// if directive runs from data type, the notifications are displayed
55+
if (typeof $scope.connected === "undefined")
56+
notificationsService.success("Dynamics Configuration", "OAuth connected.");
4657

4758
umbracoCmsIntegrationsCrmDynamicsResource.getSystemUserFullName().then(function(response) {
4859
vm.oauthConfig.fullName = response;

src/Umbraco.Cms.Integrations.Crm.Dynamics/App_Plugins/UmbracoCms.Integrations/Crm/Dynamics/js/formpicker.controller.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44

55
vm.loading = false;
66
vm.dynamicsFormsList = [];
7+
78
vm.searchTerm = "";
8-
vm.iFrameEmbedded = false;
9+
10+
vm.selectedForm = {};
11+
vm.iframeEmbedded = false;
12+
913
vm.isConnected = false;
1014

1115
umbracoCmsIntegrationsCrmDynamicsResource.checkOAuthConfiguration().then(function (response) {
@@ -33,7 +37,7 @@
3337
}
3438

3539
vm.toggleRenderMode = function () {
36-
vm.iFrameEmbedded = !vm.iFrameEmbedded;
40+
vm.iframeEmbedded = !vm.iframeEmbedded;
3741
}
3842

3943
vm.openDynamicsFormPickerOverlay = function () {
@@ -43,9 +47,9 @@
4347
subtitle: "Select a form",
4448
view: "/App_Plugins/UmbracoCms.Integrations/Crm/Dynamics/views/formpickereditor.html",
4549
size: "medium",
46-
selectForm: function (form, iFrameEmbedded) {
50+
selectForm: function (form, iframeEmbedded) {
4751

48-
form.iFrameEmbedded = iFrameEmbedded;
52+
form.iframeEmbedded = iframeEmbedded;
4953

5054
vm.saveForm(form);
5155

@@ -68,7 +72,7 @@
6872
id: item.msdyncrm_marketingformid,
6973
name: item.msdyncrm_name,
7074
embedCode: "",
71-
iFrameEmbedded: vm.iFrameEmbedded
75+
iframeEmbedded: vm.iframeEmbedded
7276
});
7377
});
7478
}

src/Umbraco.Cms.Integrations.Crm.Dynamics/App_Plugins/UmbracoCms.Integrations/Crm/Dynamics/views/formpickereditor.html

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
<umb-box>
55
<umb-box-header title="{{ model.title }}" description="{{ model.subtitle }}"></umb-box-header>
66
<umb-box-content>
7-
<div class="dynOverlayGroup">
8-
<oauth-configuration on-connected="connected()" on-revoked="revoked()"></oauth-configuration>
9-
</div>
107
<div class="dynOverlayGroup" ng-if="vm.isConnected">
118
<div class="form-search">
129
<i class="icon-search"></i>
@@ -15,8 +12,8 @@
1512
</div>
1613
<div class="dynOverlayGroup" ng-if="vm.isConnected">
1714
<ul class="dynFormsList">
18-
<li ng-repeat="form in vm.dynamicsFormsList | orderBy:'name' | filter:vm.searchTerm" ng-click="model.selectForm(form, vm.iFrameEmbedded)"
19-
class="ng-scope" role="button" tabindex="0">
15+
<li ng-repeat="form in vm.dynamicsFormsList | orderBy:'name' | filter:vm.searchTerm" ng-click="vm.selectedForm = form"
16+
ng-class="{ 'dynFormSelected': vm.selectedForm == form }" role="button" tabindex="0">
2017
<a href="" ng-attr-title="form.name">
2118
<i class="icon-umb-contour"></i>
2219
<span class="formLine">{{form.name}}</span>
@@ -25,7 +22,7 @@
2522
</ul>
2623
</div>
2724
<div class="dynOverlayGroup" ng-if="vm.isConnected">
28-
<umb-toggle checked="vm.iFrameEmbedded"
25+
<umb-toggle checked="vm.iframeEmbedded"
2926
on-click="vm.toggleRenderMode()"
3027
show-labels="true"
3128
label-on="Render with iFrame"
@@ -36,10 +33,24 @@
3633
</div>
3734
</umb-box-content>
3835
</umb-box>
36+
<umb-box>
37+
<umb-box-header title="Dynamics - OAuth Status" description="Please connect with your Microsoft account."></umb-box-header>
38+
<umb-box-content>
39+
<div class="dynOverlayGroup">
40+
<oauth-configuration on-connected="connected()" on-revoked="revoked()"></oauth-configuration>
41+
</div>
42+
</umb-box-content>
43+
</umb-box>
3944
</umb-editor-container>
4045

4146
<umb-editor-footer>
4247
<umb-editor-footer-content-right>
48+
<umb-button type="button"
49+
button-style="success"
50+
label-key="general_submit"
51+
shortcut="ctrl+s"
52+
action="model.selectForm(vm.selectedForm, vm.iframeEmbedded)">
53+
</umb-button>
4354
<umb-button type="button"
4455
button-style="link"
4556
label-key="general_close"

src/Umbraco.Cms.Integrations.Crm.Dynamics/Configuration/DynamicsSettings.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ public DynamicsSettings() { }
88

99
public DynamicsSettings(NameValueCollection appSettings)
1010
{
11-
InstanceUrl = appSettings[Constants.UmbracoCmsIntegrationsCrmDynamicsInstanceUrlKey];
11+
HostUrl = appSettings[Constants.UmbracoCmsIntegrationsCrmDynamicsHostUrlKey];
1212

13-
InstanceWebApiUrl = appSettings[Constants.UmbracoCmsIntegrationsCrmDynamicsInstanceWebApiUrlKey];
13+
ApiPath = appSettings[Constants.UmbracoCmsIntegrationsCrmDynamicsApiPathKey];
1414
}
1515

16-
public string InstanceUrl { get; set; }
16+
public string HostUrl { get; set; }
1717

18-
public string InstanceWebApiUrl { get; set; }
18+
public string ApiPath { get; set; }
1919
}
2020
}

src/Umbraco.Cms.Integrations.Crm.Dynamics/Constants.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ public class Constants
99

1010
public const string TargetStateName = "dynamicsOAuthConfiguration-db";
1111

12-
public const string UmbracoCmsIntegrationsCrmDynamicsInstanceUrlKey = "Umbraco.Cms.Integrations.Crm.Dynamics.InstanceUrl";
12+
public const string UmbracoCmsIntegrationsCrmDynamicsHostUrlKey = "Umbraco.Cms.Integrations.Crm.Dynamics.HostUrl";
1313

14-
public const string UmbracoCmsIntegrationsCrmDynamicsInstanceWebApiUrlKey = "Umbraco.Cms.Integrations.Crm.Dynamics.InstanceWebApiUrl";
14+
public const string UmbracoCmsIntegrationsCrmDynamicsApiPathKey = "Umbraco.Cms.Integrations.Crm.Dynamics.ApiPath";
1515

1616
public const string AppPluginFolderPath = "~/App_Plugins/UmbracoCms.Integrations/Crm/Dynamics";
1717

src/Umbraco.Cms.Integrations.Crm.Dynamics/Controllers/FormsController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public async Task<ResponseDto<FormDto>> GetForms()
138138
var requestMessage = new HttpRequestMessage
139139
{
140140
Method = HttpMethod.Get,
141-
RequestUri = new Uri($"{_settings.InstanceWebApiUrl}msdyncrm_marketingforms")
141+
RequestUri = new Uri($"{_settings.HostUrl}{_settings.ApiPath}msdyncrm_marketingforms")
142142
};
143143
requestMessage.Headers.Authorization =
144144
new AuthenticationHeaderValue("Bearer", oauthConfiguration.AccessToken);

src/Umbraco.Cms.Integrations.Crm.Dynamics/Editors/DynamicsFormPickerValueConverter.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ public override object ConvertSourceToIntermediate(IPublishedElement owner, IPub
3131
var jObject = JObject.Parse(source.ToString());
3232

3333
var embedCode = jObject["embedCode"].ToString();
34-
var iFrameEmbedd = (bool)jObject["iFrameEmbedded"];
34+
var iframeEmbedd = (bool)jObject["iframeEmbedded"];
3535

3636
var vm = new FormViewModel
3737
{
38-
IFrameEmbedded = iFrameEmbedd,
39-
FormBlockId = embedCode.ParseAttributeValue(Constants.EmbedAttribute.DataFormBlockId),
40-
ContainerId = embedCode.ParseAttributeValue(Constants.EmbedAttribute.ContainerId),
41-
ContainerClass = embedCode.ParseAttributeValue(Constants.EmbedAttribute.ContainerClass),
42-
WebsiteId = embedCode.ParseAttributeValue(Constants.EmbedAttribute.DataWebsiteId),
43-
Hostname = embedCode.ParseAttributeValue(Constants.EmbedAttribute.DataHostname)
38+
IframeEmbedded = iframeEmbedd,
39+
FormBlockId = embedCode.ParseDynamicsEmbedCodeAttributeValue(Constants.EmbedAttribute.DataFormBlockId),
40+
ContainerId = embedCode.ParseDynamicsEmbedCodeAttributeValue(Constants.EmbedAttribute.ContainerId),
41+
ContainerClass = embedCode.ParseDynamicsEmbedCodeAttributeValue(Constants.EmbedAttribute.ContainerClass),
42+
WebsiteId = embedCode.ParseDynamicsEmbedCodeAttributeValue(Constants.EmbedAttribute.DataWebsiteId),
43+
Hostname = embedCode.ParseDynamicsEmbedCodeAttributeValue(Constants.EmbedAttribute.DataHostname)
4444
};
4545

4646
return vm;

0 commit comments

Comments
 (0)