Skip to content

Commit 81fb4ea

Browse files
committed
Load media URL and bug fix to pagination control.
1 parent 62fc067 commit 81fb4ea

File tree

6 files changed

+27
-11
lines changed

6 files changed

+27
-11
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Integrations.PIM.Inriver.Models.ViewModels.InriverEntityViewModel>
22

3-
<p>@Model.DisplayName</p>
4-
<p>@Model.DisplayDescription</p>
5-
@if(Model.Fields.Any())
6-
{
7-
<ul>
8-
@foreach(var field in Model.Fields)
9-
{
10-
<li><b>@field.Key</b>: @field.Value</li>
11-
}
12-
</ul>
13-
}
3+
<div>
4+
<img src="@Model.ResourceUrl" alt="@Model.ResourceUrl" />
5+
<p>@Model.DisplayName</p>
6+
<p>@Model.DisplayDescription</p>
7+
@if (Model.Fields.Any())
8+
{
9+
<ul>
10+
@foreach (var field in Model.Fields)
11+
{
12+
<li><b>@field.Key</b>: @field.Value</li>
13+
}
14+
</ul>
15+
}
16+
</div>

src/Umbraco.Cms.Integrations.PIM.Inriver/App_Plugins/UmbracoCms.Integrations/PIM/Inriver/js/entitypickereditor.controller.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@
2222
if (inSearch.length == 0) return false;
2323

2424
let filteredArr = vm.entities.filter(obj => obj.summary.displayName.includes(inSearch.value));
25+
2526
vm.filteredEntities = filteredArr
2627
.slice((paginationCtrl.current - 1) * vm.pagination.itemsPerPage, paginationCtrl.current * vm.pagination.itemsPerPage);
2728

2829
vm.pagination.totalPages = Math.ceil(filteredArr.length / vm.pagination.itemsPerPage);
2930

31+
paginationCtrl.style.display = vm.pagination.totalPages === 0 ? "none" : "block";
32+
3033
paginationCtrl.total = vm.pagination.totalPages;
3134

3235
/**

src/Umbraco.Cms.Integrations.PIM.Inriver/App_Plugins/UmbracoCms.Integrations/PIM/Inriver/views/entitypickereditor.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<uui-table class="uui-text">
1818
<uui-table-column style="width: 120px !important"></uui-table-column>
1919
<uui-table-head>
20+
<uui-table-head-cell></uui-table-head-cell>
2021
<uui-table-head-cell>Name</uui-table-head-cell>
2122
<uui-table-head-cell>Description</uui-table-head-cell>
2223
<uui-table-head-cell ng-repeat="field in vm.filteredEntities[0].fields">
@@ -26,6 +27,9 @@
2627

2728
<uui-table-row ng-repeat="entity in vm.filteredEntities" selectable
2829
ng-on-selected="vm.save(entity.id)">
30+
<uui-table-cell>
31+
<img ng-if="entity.summary.resourceUrl.length > 0" ng-src="{{entity.summary.resourceUrl}}" width="100" />
32+
</uui-table-cell>
2933
<uui-table-cell>{{entity.summary.displayName}}</uui-table-cell>
3034
<uui-table-cell>{{entity.summary.displayDescription}}</uui-table-cell>
3135
<uui-table-cell ng-repeat="field in entity.fields">

src/Umbraco.Cms.Integrations.PIM.Inriver/Editors/EntityPickerValueConverter.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public override object ConvertSourceToIntermediate(IPublishedElement owner, IPub
5252
{
5353
DisplayName = entityData.Summary.DisplayName,
5454
DisplayDescription = entityData.Summary.Description,
55+
ResourceUrl = entityData.Summary.ResourceUrl,
5556
Fields = entityData.Fields.ToDictionary(
5657
x => displayFields.First(p => p["fieldTypeId"].GetValue<string>() == x.FieldTypeId)["fieldTypeDisplayName"].GetValue<string>(),
5758
x => x.Value)

src/Umbraco.Cms.Integrations.PIM.Inriver/Models/EntitySummary.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,8 @@ public class EntitySummary
1414

1515
[JsonPropertyName("description")]
1616
public string Description { get; set; }
17+
18+
[JsonPropertyName("resourceUrl")]
19+
public string ResourceUrl { get; set; }
1720
}
1821
}

src/Umbraco.Cms.Integrations.PIM.Inriver/Models/ViewModels/InriverEntityViewModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ public InriverEntityViewModel()
1414

1515
public string DisplayDescription { get; set; }
1616

17+
public string ResourceUrl { get; set; }
18+
1719
public Dictionary<string, object> Fields { get; set; }
1820
}
1921
}

0 commit comments

Comments
 (0)