Implements HideLabel for property editor value editors for both c# and manifest declarations.
This commit is contained in:
24
src/Umbraco.Core/PropertyEditors/IParameterEditor.cs
Normal file
24
src/Umbraco.Core/PropertyEditors/IParameterEditor.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Core.PropertyEditors
|
||||
{
|
||||
public interface IParameterEditor
|
||||
{
|
||||
/// <summary>
|
||||
/// The id of the property editor
|
||||
/// </summary>
|
||||
string Alias { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the property editor
|
||||
/// </summary>
|
||||
string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Allows a parameter editor to be re-used based on the configuration specified.
|
||||
/// </summary>
|
||||
IDictionary<string, object> Configuration { get; }
|
||||
|
||||
IValueEditor ValueEditor { get; }
|
||||
}
|
||||
}
|
||||
@@ -5,26 +5,6 @@ using Umbraco.Core.IO;
|
||||
|
||||
namespace Umbraco.Core.PropertyEditors
|
||||
{
|
||||
public interface IParameterEditor
|
||||
{
|
||||
/// <summary>
|
||||
/// The id of the property editor
|
||||
/// </summary>
|
||||
string Alias { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the property editor
|
||||
/// </summary>
|
||||
string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Allows a parameter editor to be re-used based on the configuration specified.
|
||||
/// </summary>
|
||||
IDictionary<string, object> Configuration { get; }
|
||||
|
||||
IValueEditor ValueEditor { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Basic definition of a macro parameter editor
|
||||
/// </summary>
|
||||
|
||||
@@ -116,6 +116,7 @@ namespace Umbraco.Core.PropertyEditors
|
||||
|
||||
editor.View = _attribute.EditorView;
|
||||
editor.ValueType = _attribute.ValueType;
|
||||
editor.HideLabel = _attribute.HideLabel;
|
||||
return editor;
|
||||
|
||||
}
|
||||
|
||||
@@ -52,5 +52,10 @@ namespace Umbraco.Core.PropertyEditors
|
||||
public string EditorView { get; private set; }
|
||||
public string ValueType { get; set; }
|
||||
public bool IsParameterEditor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If this is is true than the editor will be displayed full width without a label
|
||||
/// </summary>
|
||||
public bool HideLabel { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -123,6 +123,12 @@ namespace Umbraco.Core.PropertyEditors
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If this is is true than the editor will be displayed full width without a label
|
||||
/// </summary>
|
||||
[JsonProperty("hideLabel")]
|
||||
public bool HideLabel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set this to true if the property editor is for display purposes only
|
||||
/// </summary>
|
||||
|
||||
@@ -450,6 +450,7 @@
|
||||
<Compile Include="Persistence\Repositories\TagsRepository.cs" />
|
||||
<Compile Include="PropertyEditors\BackwardsCompatibleData.cs" />
|
||||
<Compile Include="PropertyEditors\BackwardsCompatibleDataType.cs" />
|
||||
<Compile Include="PropertyEditors\IParameterEditor.cs" />
|
||||
<Compile Include="PropertyEditors\LegacyParameterEditorAliasConverter.cs" />
|
||||
<Compile Include="PropertyEditors\LegacyPropertyEditorIdToAliasConverter.cs" />
|
||||
<Compile Include="Persistence\Mappers\MapperForAttribute.cs" />
|
||||
|
||||
@@ -82,16 +82,19 @@ namespace Umbraco.Tests.Manifest
|
||||
},
|
||||
{
|
||||
alias: 'Test.Test2',
|
||||
name: 'Test 2',
|
||||
name: 'Test 2',
|
||||
defaultConfig: { key1: 'some default pre val' },
|
||||
editor: {
|
||||
view: '~/App_Plugins/MyPackage/PropertyEditors/CsvEditor.html'
|
||||
view: '~/App_Plugins/MyPackage/PropertyEditors/CsvEditor.html',
|
||||
hideLabel: true
|
||||
}
|
||||
}
|
||||
]");
|
||||
var parser = ManifestParser.GetPropertyEditors(a);
|
||||
|
||||
Assert.AreEqual(2, parser.Count());
|
||||
|
||||
Assert.AreEqual(false, parser.ElementAt(0).ValueEditor.HideLabel);
|
||||
Assert.AreEqual("Test.Test1", parser.ElementAt(0).Alias);
|
||||
Assert.AreEqual("Test 1", parser.ElementAt(0).Name);
|
||||
Assert.AreEqual("/App_Plugins/MyPackage/PropertyEditors/MyEditor.html", parser.ElementAt(0).ValueEditor.View);
|
||||
@@ -104,6 +107,7 @@ namespace Umbraco.Tests.Manifest
|
||||
Assert.IsNotNull(manifestValidator2);
|
||||
Assert.AreEqual("regex", manifestValidator2.Type);
|
||||
|
||||
Assert.AreEqual(true, parser.ElementAt(1).ValueEditor.HideLabel);
|
||||
Assert.AreEqual("Test.Test2", parser.ElementAt(1).Alias);
|
||||
Assert.AreEqual("Test 2", parser.ElementAt(1).Name);
|
||||
Assert.IsTrue(parser.ElementAt(1).DefaultPreValues.ContainsKey("key1"));
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
display.Alias = originalProp.Alias;
|
||||
display.Description = originalProp.PropertyType.Description;
|
||||
display.Label = originalProp.PropertyType.Name;
|
||||
display.HideLabel = display.PropertyEditor.ValueEditor.HideLabel;
|
||||
|
||||
var dataTypeService = _dataTypeService.Value;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ using Umbraco.Core.PropertyEditors;
|
||||
|
||||
namespace Umbraco.Web.PropertyEditors
|
||||
{
|
||||
[PropertyEditor(Constants.PropertyEditors.ListViewAlias, "List view", "listview")]
|
||||
[PropertyEditor(Constants.PropertyEditors.ListViewAlias, "List view", "listview", HideLabel = true)]
|
||||
public class ListViewPropertyEditor : PropertyEditor
|
||||
{
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace Umbraco.Web.PropertyEditors
|
||||
{
|
||||
public PropertyValueEditorWrapper(PropertyValueEditor wrapped)
|
||||
{
|
||||
this.HideLabel = wrapped.HideLabel;
|
||||
this.View = wrapped.View;
|
||||
this.ValueType = wrapped.ValueType;
|
||||
foreach (var v in wrapped.Validators)
|
||||
|
||||
@@ -5,7 +5,7 @@ using Umbraco.Core.PropertyEditors;
|
||||
|
||||
namespace Umbraco.Web.PropertyEditors
|
||||
{
|
||||
[PropertyEditor(Constants.PropertyEditors.TinyMCEv3Alias, "Rich Text Editor", "rte")]
|
||||
[PropertyEditor(Constants.PropertyEditors.TinyMCEv3Alias, "Rich Text Editor", "rte", HideLabel = true)]
|
||||
public class RichTextPropertyEditor : PropertyEditor
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user