Got the dashboard config section classes working with tests, now to add more tests
This commit is contained in:
@@ -18,7 +18,7 @@ namespace Umbraco.Core.Configuration.Dashboard
|
||||
|
||||
protected override object GetElementKey(ConfigurationElement element)
|
||||
{
|
||||
return ((ControlElement)element).Value;
|
||||
return ((ControlElement)element).ControlPath;
|
||||
}
|
||||
|
||||
IEnumerator<IControl> IEnumerable<IControl>.GetEnumerator()
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Umbraco.Core.Configuration.Dashboard
|
||||
{
|
||||
internal class ControlElement : InnerTextConfigurationElement<string>, IControl
|
||||
internal class ControlElement : RawXmlConfigurationElement, IControl
|
||||
{
|
||||
[ConfigurationProperty("showOnce", DefaultValue = false)]
|
||||
public bool ShowOnce
|
||||
@@ -22,9 +24,24 @@ namespace Umbraco.Core.Configuration.Dashboard
|
||||
get { return (string)this["panelCaption"]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("access")]
|
||||
public AccessElement Access
|
||||
{
|
||||
get { return (AccessElement)this["access"]; }
|
||||
}
|
||||
|
||||
public string ControlPath
|
||||
{
|
||||
get { return Value; }
|
||||
get
|
||||
{
|
||||
//we need to return the first (and only) text element of the children (wtf... who designed this configuration ! :P )
|
||||
var txt = RawXml.Nodes().OfType<XText>().FirstOrDefault();
|
||||
if (txt == null)
|
||||
{
|
||||
throw new ConfigurationErrorsException("The control element must contain a text node indicating the control path");
|
||||
}
|
||||
return txt.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,5 +9,7 @@ namespace Umbraco.Core.Configuration.Dashboard
|
||||
string Area { get; }
|
||||
|
||||
IEnumerable<ITab> Tabs { get; }
|
||||
|
||||
IAccess AccessRights { get; }
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,12 @@ namespace Umbraco.Core.Configuration.Dashboard
|
||||
{
|
||||
get { return (AreasElement)this["areas"]; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("access")]
|
||||
public AccessElement Access
|
||||
{
|
||||
get { return (AccessElement)this["access"]; }
|
||||
}
|
||||
|
||||
[ConfigurationCollection(typeof(SectionCollection), AddItemName = "tab")]
|
||||
[ConfigurationProperty("", IsDefaultCollection = true)]
|
||||
@@ -34,5 +40,10 @@ namespace Umbraco.Core.Configuration.Dashboard
|
||||
{
|
||||
get { return Area.AreaName; }
|
||||
}
|
||||
|
||||
IAccess ISection.AccessRights
|
||||
{
|
||||
get { return Access; }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user