Skip to content

Commit

Permalink
refactor: improve data type settings
Browse files Browse the repository at this point in the history
  • Loading branch information
jcdcdev committed Jul 11, 2024
1 parent c2bc1c5 commit 04a4d73
Show file tree
Hide file tree
Showing 15 changed files with 91 additions and 85 deletions.
2 changes: 1 addition & 1 deletion src/TestSite.14/Controllers/DropdownExampleController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public IActionResult Get()
"Tabby",
"Ragdoll",
"Persian",
"Siamese",
"Siamese"
};
return Ok(cats);
}
Expand Down
64 changes: 32 additions & 32 deletions src/TestSite.14/Views/home.cshtml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
@inherits UmbracoViewPage<Home>

@{
Layout = "_Layout";
}

<div class="container">
<div class="row">
<div class="col">
<h1 class="display-1">@Model.Name</h1>
<div>
@await Html.GetBlockGridHtmlAsync(Model.GridContent)
</div>
<div>
<h2>Extended Dropdown Editor</h2>
@foreach (var item in Model.ExtendedDropdown)
{
<div>@item</div>
}
</div>
<div>
<h2>Extended Dropdown Editor (Single)</h2>
<div>@Model.ExtendedDropdownSingle</div>

</div>
<div>
<h2>Extended Dropdown Editor by URL</h2>
<div>@Model.ExtendedDropdownByUrl</div>
</div>
</div>
</div>
</div>
@inherits UmbracoViewPage<Home>

@{
Layout = "_Layout";
}

<div class="container">
<div class="row">
<div class="col">
<h1 class="display-1">@Model.Name</h1>
<div>
@await Html.GetBlockGridHtmlAsync(Model.GridContent)
</div>
<div>
<h2>Extended Dropdown Editor</h2>
@foreach (var item in Model.ExtendedDropdown ?? [])
{
<div>@item</div>
}
</div>
<div>
<h2>Extended Dropdown Editor (Single)</h2>
<div>@Model.ExtendedDropdownSingle</div>

</div>
<div>
<h2>Extended Dropdown Editor by URL</h2>
<div>@Model.ExtendedDropdownByUrl</div>
</div>
</div>
</div>
</div>
9 changes: 9 additions & 0 deletions src/TestSite.14/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
"Earth",
"Mars",
"Jupiter",
"Saturn",
"Uranus",
"Neptune",
"Pluto"
]
33 changes: 7 additions & 26 deletions src/TestSite.14/uSync/v14/Content/home.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@
<CreateDate>2024-05-25T14:09:16</CreateDate>
<NodeName Default="Home">
<Name Culture="en-GB">Home</Name>
<Name Culture="sv">Home</Name>
</NodeName>
<SortOrder>0</SortOrder>
<Published Default="true">
<Published Culture="en-GB">true</Published>
<Published Culture="sv">true</Published>
</Published>
<Schedule />
<Template Key="90db0a7e-bfee-4808-ac56-4c6794c33559">home</Template>
<Template Key="dc1a98bb-ad81-4117-a40f-04bdbf341a2c">home</Template>
</Info>
<Properties>
<extendedDropdown>
Expand All @@ -26,10 +24,14 @@
]]]></Value>
</extendedDropdown>
<extendedDropdownByUrl>
<Value><![CDATA[]]></Value>
<Value><![CDATA[[
"Tabby"
]]]></Value>
</extendedDropdownByUrl>
<extendedDropdownSingle>
<Value><![CDATA[]]></Value>
<Value><![CDATA[[
"Cherry"
]]]></Value>
</extendedDropdownSingle>
<gridContent>
<Value Culture="en-GB"><![CDATA[{
Expand All @@ -52,27 +54,6 @@
}
]
}
}]]></Value>
<Value Culture="sv"><![CDATA[{
"contentData": [
{
"contentTypeKey": "870f5419-2326-4d17-9fc5-77e2216a6c66",
"udi": "umb://element/fa032696b38a4d388e7c27575e680c38",
"headline": "Hello"
}
],
"settingsData": [],
"Layout": {
"Umbraco.BlockGrid": [
{
"contentUdi": "umb://element/fa032696b38a4d388e7c27575e680c38",
"settingsUdi": null,
"columnSpan": 12,
"rowSpan": 1,
"areas": []
}
]
}
}]]></Value>
</gridContent>
</Properties>
Expand Down
6 changes: 3 additions & 3 deletions src/TestSite.14/uSync/v14/ContentTypes/basepage.config
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<Name>Extended Dropdown</Name>
<Alias>extendedDropdown</Alias>
<Definition>2e896ebc-8d71-4a93-b870-fc0812cce270</Definition>
<Type>Umbraco.Label</Type>
<Type>jcdcdev.Umbraco.ExtendedDropdown</Type>
<Mandatory>false</Mandatory>
<Validation></Validation>
<Description><![CDATA[]]></Description>
Expand All @@ -41,7 +41,7 @@
<Name>Extended Dropdown by URL</Name>
<Alias>extendedDropdownByUrl</Alias>
<Definition>b91963e2-baae-41ef-8f65-789ee4c54da9</Definition>
<Type>Umbraco.Label</Type>
<Type>jcdcdev.Umbraco.ExtendedDropdown</Type>
<Mandatory>false</Mandatory>
<Validation></Validation>
<Description><![CDATA[]]></Description>
Expand All @@ -57,7 +57,7 @@
<Name>Extended Dropdown Single</Name>
<Alias>extendedDropdownSingle</Alias>
<Definition>f6528d3c-9620-4056-adac-eefb85f763f3</Definition>
<Type>Umbraco.Label</Type>
<Type>jcdcdev.Umbraco.ExtendedDropdown</Type>
<Mandatory>false</Mandatory>
<Validation></Validation>
<Description><![CDATA[]]></Description>
Expand Down
2 changes: 1 addition & 1 deletion src/TestSite.14/uSync/v14/ContentTypes/home.config
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</Compositions>
<DefaultTemplate>home</DefaultTemplate>
<AllowedTemplates>
<Template Key="90db0a7e-bfee-4808-ac56-4c6794c33559">home</Template>
<Template Key="dc1a98bb-ad81-4117-a40f-04bdbf341a2c">home</Template>
</AllowedTemplates>
</Info>
<Structure />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<DataType Key="b91963e2-baae-41ef-8f65-789ee4c54da9" Alias="Base Page - Extended Dropdown by URL - Extended Dropdown Editor" Level="1">
<Info>
<Name>Base Page - Extended Dropdown by URL - Extended Dropdown Editor</Name>
<EditorAlias>Umbraco.Label</EditorAlias>
<EditorAlias>jcdcdev.Umbraco.ExtendedDropdown</EditorAlias>
<EditorUIAlias>jcdcdev.Umbraco.PropertyEditorUi.ExtendedDropdown</EditorUIAlias>
</Info>
<Config><![CDATA[{
"url": "/api/cats"
}]]></Config>
</DataType>
</DataType>
Original file line number Diff line number Diff line change
@@ -1,14 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<DataType Key="2e896ebc-8d71-4a93-b870-fc0812cce270" Alias="Base Page - - Extended Dropdown Editor" Level="1">
<Info>
<Name>Base Page - - Extended Dropdown Editor</Name>
<EditorAlias>Umbraco.Label</EditorAlias>
<EditorUIAlias>jcdcdev.Umbraco.PropertyEditorUi.ExtendedDropdown</EditorUIAlias>
</Info>
<Config><![CDATA[{
"file": [
"%2Fwwwroot%2Fdata%25dot%25json"
],
"multiple": true
}]]></Config>
</DataType>
<Empty Key="2e896ebc-8d71-4a93-b870-fc0812cce270" Alias="Base Page - - Extended Dropdown Editor" Change="Rename" />
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<DataType Key="f6528d3c-9620-4056-adac-eefb85f763f3" Alias="Base Page - Extended Dropdown Single - Extended Dropdown Editor" Level="1">
<Info>
<Name>Base Page - Extended Dropdown Single - Extended Dropdown Editor</Name>
<EditorAlias>Umbraco.Label</EditorAlias>
<EditorAlias>jcdcdev.Umbraco.ExtendedDropdown</EditorAlias>
<EditorUIAlias>jcdcdev.Umbraco.PropertyEditorUi.ExtendedDropdown</EditorUIAlias>
</Info>
<Config><![CDATA[{
"file": [
"%2FApp_Plugins%2Fdata%25dot%25json"
]
}]]></Config>
</DataType>
</DataType>
14 changes: 14 additions & 0 deletions src/TestSite.14/uSync/v14/DataTypes/ExtendedDropdownEditor.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<DataType Key="2e896ebc-8d71-4a93-b870-fc0812cce270" Alias="Extended Dropdown Editor" Level="1">
<Info>
<Name>Extended Dropdown Editor</Name>
<EditorAlias>jcdcdev.Umbraco.ExtendedDropdown</EditorAlias>
<EditorUIAlias>jcdcdev.Umbraco.PropertyEditorUi.ExtendedDropdown</EditorUIAlias>
</Info>
<Config><![CDATA[{
"file": [
"%2Fwwwroot%2Fdata%25dot%25json"
],
"multiple": true
}]]></Config>
</DataType>
2 changes: 2 additions & 0 deletions src/TestSite.14/uSync/v14/Languages/en-us.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<Empty Key="8f687492-637e-4279-b7b6-8914de004853" Alias="en-US" Change="Delete" />
2 changes: 1 addition & 1 deletion src/TestSite.14/uSync/v14/MediaTypes/folder.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Thumbnail>icon-folder</Thumbnail>
<Description></Description>
<AllowAtRoot>True</AllowAtRoot>
<ListView>00000000-0000-0000-0000-000000000000</ListView>
<ListView>3a0156c4-3b8c-4803-bdc1-6871faa83fff</ListView>
<Variations>Nothing</Variations>
<IsElement>false</IsElement>
<Compositions />
Expand Down
2 changes: 1 addition & 1 deletion src/TestSite.14/uSync/v14/Templates/home.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Template Key="90db0a7e-bfee-4808-ac56-4c6794c33559" Alias="home" Level="1">
<Template Key="dc1a98bb-ad81-4117-a40f-04bdbf341a2c" Alias="home" Level="1">
<Name>Home</Name>
<Parent />
</Template>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const manifest: ManifestPropertyEditorUi =
label: "Extended Dropdown",
icon: "icon-list",
group: "pickers",
propertyEditorSchemaAlias: "jcdcdev.Umbraco.ExtendedDropdownEditor",
propertyEditorSchemaAlias: "jcdcdev.Umbraco.ExtendedDropdown",
settings: {
properties: [
{
Expand All @@ -20,17 +20,29 @@ const manifest: ManifestPropertyEditorUi =
},
{
alias: "file",
label: "JSON File",
label: "File",
description: "Select a file from the wwwroot or App_Plugins folder",
propertyEditorUiAlias: "Umb.PropertyEditorUi.StaticFilePicker",
config: [
{
alias: 'validationLimit',
value: {
min: 0,
max: 1
}
},
]
},
{
alias: "filePathOverride",
label: "File Path Override",
description: "Provide a path relative to the root of the web project",
propertyEditorUiAlias: "Umb.PropertyEditorUi.TextBox",
},
{
alias: "url",
label: "URL",
description: "Works with GET requests with no authentication",
propertyEditorUiAlias: "Umb.PropertyEditorUi.TextBox",
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class PropertyEditors
{
public class Aliases
{
public const string ExtendedDropdownEditor = "jcdcdev.Umbraco.ExtendedDropdownEditor";
public const string ExtendedDropdownEditor = "jcdcdev.Umbraco.ExtendedDropdown";
}
}
}

0 comments on commit 04a4d73

Please sign in to comment.