V8: Allow nested content without blueprints (#4777)

* Don't assume there is at least one NC blueprint
* NC disabled icon styling (hover pointer type)
* Allow and handle NC configs without blueprints
This commit is contained in:
Kenn Jacobsen
2019-04-23 16:14:26 +02:00
committed by Niels Lyngsø
parent aba409600b
commit 67e046e477
4 changed files with 11 additions and 8 deletions

View File

@@ -127,6 +127,9 @@
border-radius: 200px;
text-decoration: none !important;
}
.umb-nested-content__icon.umb-nested-content__icon--disabled:hover {
cursor: default;
}
.umb-nested-content__icon:hover,
.umb-nested-content__icon--active

View File

@@ -34,7 +34,7 @@
<input type="text" ng-model="config.nameTemplate" />
</td>
<td>
<a class="btn btn-danger" ng-click="remove($index)" ng-show="model.value.length > 1">
<a class="btn btn-danger" ng-click="remove($index)">
<localize key="general_delete">Delete</localize>
</a>
</td>

View File

@@ -37,7 +37,7 @@
</div>
<div class="umb-nested-content__footer-bar" ng-hide="nodes.length >= maxItems">
<a href class="umb-nested-content__icon" ng-click="openNodeTypePicker($event)" prevent-default>
<a href class="umb-nested-content__icon" ng-class="{ 'umb-nested-content__icon--disabled': !scaffolds.length }" ng-click="openNodeTypePicker($event)" prevent-default>
<i class="icon icon-add"></i>
</a>
</div>

View File

@@ -35,9 +35,9 @@ namespace Umbraco.Web.PropertyEditors.ValueConverters
public override Type GetPropertyValueType(PublishedPropertyType propertyType)
{
var contentTypes = propertyType.DataType.ConfigurationAs<NestedContentConfiguration>().ContentTypes;
return contentTypes.Length > 1
? typeof (IEnumerable<IPublishedElement>)
: typeof (IEnumerable<>).MakeGenericType(ModelType.For(contentTypes[0].Alias));
return contentTypes.Length == 1
? typeof (IEnumerable<>).MakeGenericType(ModelType.For(contentTypes[0].Alias))
: typeof (IEnumerable<IPublishedElement>);
}
/// <inheritdoc />
@@ -57,9 +57,9 @@ namespace Umbraco.Web.PropertyEditors.ValueConverters
{
var configuration = propertyType.DataType.ConfigurationAs<NestedContentConfiguration>();
var contentTypes = configuration.ContentTypes;
var elements = contentTypes.Length > 1
? new List<IPublishedElement>()
: PublishedModelFactory.CreateModelList(contentTypes[0].Alias);
var elements = contentTypes.Length == 1
? PublishedModelFactory.CreateModelList(contentTypes[0].Alias)
: new List<IPublishedElement>();
var value = (string)inter;
if (string.IsNullOrWhiteSpace(value)) return elements;