Skip to content
This repository was archived by the owner on Dec 13, 2021. It is now read-only.

Commit a421109

Browse files
authored
Merge pull request #26 from umco/develop
Preparing v1.1.1 release
2 parents 6e30f41 + 296f450 commit a421109

File tree

4 files changed

+28
-31
lines changed

4 files changed

+28
-31
lines changed

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
image: Visual Studio 2017
22

33
# version format
4-
version: 1.1.0.{build}
4+
version: 1.1.1.{build}
55

66
# UMBRACO_PACKAGE_PRERELEASE_SUFFIX if a rtm release build this should be blank, otherwise if empty will default to alpha
77
# example UMBRACO_PACKAGE_PRERELEASE_SUFFIX=beta

src/Our.Umbraco.InnerContent/PropertyEditors/InnerContentPropertyValueEditorWrapper.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ public override void ConfigureForDisplay(PreValueCollection preValues)
2222
{
2323
base.ConfigureForDisplay(preValues);
2424

25-
var asDictionary = preValues.PreValuesAsDictionary.ToDictionary(x => x.Key, x => x.Value.Value);
26-
if (asDictionary.ContainsKey("hideLabel"))
25+
if (preValues.PreValuesAsDictionary.ContainsKey("hideLabel"))
2726
{
28-
var boolAttempt = asDictionary["hideLabel"].TryConvertTo<bool>();
27+
var boolAttempt = preValues.PreValuesAsDictionary["hideLabel"].Value.TryConvertTo<bool>();
2928
if (boolAttempt.Success)
3029
{
3130
HideLabel = boolAttempt.Result;

src/Our.Umbraco.InnerContent/PropertyEditors/SimpleInnerContentPropertyValueEditor.cs

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,19 @@ public override string ConvertDbToString(Property property, PropertyType propert
2929
return string.Empty;
3030

3131
// Process value
32-
ConvertDbToStringRecursive(value, property, propertyType, dataTypeService);
32+
ConvertDbToStringRecursive(value, dataTypeService);
3333

34-
// Update the value on the property
35-
property.Value = JsonConvert.SerializeObject(value);
36-
37-
// Pass the call down
38-
return base.ConvertDbToString(property, propertyType, dataTypeService);
34+
// Return the serialized value
35+
return JsonConvert.SerializeObject(value);
3936
}
4037

41-
protected void ConvertDbToStringRecursive(JToken token, Property property, PropertyType propertyType, IDataTypeService dataTypeService)
38+
protected void ConvertDbToStringRecursive(JToken token, IDataTypeService dataTypeService)
4239
{
4340
if (token is JArray jArr)
4441
{
4542
foreach (var item in jArr)
4643
{
47-
ConvertDbToStringRecursive(item, property, propertyType, dataTypeService);
44+
ConvertDbToStringRecursive(item, dataTypeService);
4845
}
4946
}
5047

@@ -60,7 +57,7 @@ protected void ConvertDbToStringRecursive(JToken token, Property property, Prope
6057
{
6158
if (kvp.Value is JArray || kvp.Value is JObject)
6259
{
63-
ConvertDbToStringRecursive(kvp.Value, property, propertyType, dataTypeService);
60+
ConvertDbToStringRecursive(kvp.Value, dataTypeService);
6461
}
6562
}
6663
}
@@ -82,22 +79,19 @@ public override object ConvertDbToEditor(Property property, PropertyType propert
8279
return string.Empty;
8380

8481
// Process value
85-
ConvertDbToEditorRecursive(value, property, propertyType, dataTypeService);
82+
ConvertDbToEditorRecursive(value, dataTypeService);
8683

87-
// Update the value on the property
88-
property.Value = JsonConvert.SerializeObject(value);
89-
90-
// Pass the call down
91-
return base.ConvertDbToEditor(property, propertyType, dataTypeService);
84+
// Return the JObject, Angular can handle it directly
85+
return value;
9286
}
9387

94-
protected void ConvertDbToEditorRecursive(JToken token, Property property, PropertyType propertyType, IDataTypeService dataTypeService)
88+
protected void ConvertDbToEditorRecursive(JToken token, IDataTypeService dataTypeService)
9589
{
9690
if (token is JArray jArr)
9791
{
9892
foreach (var item in jArr)
9993
{
100-
ConvertDbToEditorRecursive(item, property, propertyType, dataTypeService);
94+
ConvertDbToEditorRecursive(item, dataTypeService);
10195
}
10296
}
10397

@@ -113,7 +107,7 @@ protected void ConvertDbToEditorRecursive(JToken token, Property property, Prope
113107
{
114108
if (kvp.Value is JArray || kvp.Value is JObject)
115109
{
116-
ConvertDbToEditorRecursive(kvp.Value, property, propertyType, dataTypeService);
110+
ConvertDbToEditorRecursive(kvp.Value, dataTypeService);
117111
}
118112
}
119113
}
@@ -123,27 +117,31 @@ protected void ConvertDbToEditorRecursive(JToken token, Property property, Prope
123117
public override object ConvertEditorToDb(ContentPropertyData editorValue, object currentValue)
124118
{
125119
// Convert / validate value
126-
if (editorValue.Value == null || string.IsNullOrWhiteSpace(editorValue.Value.ToString()))
127-
return null;
120+
if (editorValue.Value == null)
121+
return string.Empty;
128122

129-
var value = JsonConvert.DeserializeObject<JToken>(editorValue.Value.ToString());
123+
var dbValue = editorValue.Value.ToString();
124+
if (string.IsNullOrWhiteSpace(dbValue))
125+
return string.Empty;
126+
127+
var value = JsonConvert.DeserializeObject<JToken>(dbValue);
130128
if (value == null || (value is JArray && ((JArray)value).Count == 0))
131-
return null;
129+
return string.Empty;
132130

133131
// Process value
134-
ConvertEditorToDbRecursive(value, editorValue, currentValue);
132+
ConvertEditorToDbRecursive(value, currentValue);
135133

136134
// Return value
137135
return JsonConvert.SerializeObject(value);
138136
}
139137

140-
protected void ConvertEditorToDbRecursive(JToken token, ContentPropertyData editorValue, object currentValue)
138+
protected void ConvertEditorToDbRecursive(JToken token, object currentValue)
141139
{
142140
if (token is JArray jArr)
143141
{
144142
foreach (var item in jArr)
145143
{
146-
ConvertEditorToDbRecursive(item, editorValue, currentValue);
144+
ConvertEditorToDbRecursive(item, currentValue);
147145
}
148146
}
149147

@@ -159,7 +157,7 @@ protected void ConvertEditorToDbRecursive(JToken token, ContentPropertyData edit
159157
{
160158
if (kvp.Value is JArray || kvp.Value is JObject)
161159
{
162-
ConvertEditorToDbRecursive(kvp.Value, editorValue, currentValue);
160+
ConvertEditorToDbRecursive(kvp.Value, currentValue);
163161
}
164162
}
165163
}

src/Our.Umbraco.InnerContent/Web/UI/App_Plugins/InnerContent/views/innercontent.dialog.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<umb-tab id="tab{{tab.id}}" ng-repeat="tab in item.tabs" rel="{{tab.id}}">
88

99
<umb-property ng-repeat="property in tab.properties" property="property">
10-
<umb-editor model="property"></umb-editor>
10+
<umb-property-editor model="property"></umb-property-editor>
1111
</umb-property>
1212

1313
</umb-tab>

0 commit comments

Comments
 (0)