Gets the parameter editor resolver to resolve parameter editors from: c# parameter editors, c# property editors that have been flagged as a param editor, manifest parameter editors and manifest property editors flagged as param editor. Fixes more of the macro editor.
This commit is contained in:
@@ -16,6 +16,7 @@ namespace Umbraco.Core.Manifest
|
||||
|
||||
private const string ManifestKey = "manifests";
|
||||
private const string PropertyEditorsKey = "propertyeditors";
|
||||
private const string ParameterEditorsKey = "parametereditors";
|
||||
|
||||
/// <summary>
|
||||
/// Returns all property editors found in the manfifests
|
||||
@@ -50,7 +51,7 @@ namespace Umbraco.Core.Manifest
|
||||
get
|
||||
{
|
||||
return (IEnumerable<ParameterEditor>)StaticCache.GetOrAdd(
|
||||
PropertyEditorsKey,
|
||||
ParameterEditorsKey,
|
||||
s =>
|
||||
{
|
||||
var editors = new List<ParameterEditor>();
|
||||
|
||||
@@ -32,12 +32,15 @@ namespace Umbraco.Core.PropertyEditors
|
||||
//are filtered.
|
||||
var filtered = Values.Select(x => x as PropertyEditor)
|
||||
.WhereNotNull()
|
||||
.Where(x => x.IsParameterEditor == false)
|
||||
.ToArray();
|
||||
|
||||
//now we need to get all manifest property editors in here that are parameter editors!~
|
||||
|
||||
return Values.Except(filtered).Union(ManifestBuilder.ParameterEditors);
|
||||
.Where(x => x.IsParameterEditor == false);
|
||||
|
||||
return Values
|
||||
//exclude the non parameter editor c# property editors
|
||||
.Except(filtered)
|
||||
//include the manifest parameter editors
|
||||
.Union(ManifestBuilder.ParameterEditors)
|
||||
//include the manifest prop editors that are parameter editors
|
||||
.Union(ManifestBuilder.PropertyEditors.Where(x => x.IsParameterEditor));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -118,5 +118,27 @@ namespace Umbraco.Web.UI.Umbraco.Developer.Macros
|
||||
return files;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Binds the drop down list but ensures that the macro param type exists if it doesn't the drop down will be left blank
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void MacroPropertiesOnItemDataBound(object sender, RepeaterItemEventArgs e)
|
||||
{
|
||||
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
|
||||
{
|
||||
var propertyTypes = (DropDownList)e.Item.FindControl("macroPropertyType");
|
||||
|
||||
var editors = GetMacroParameterEditors();
|
||||
propertyTypes.DataSource = editors;
|
||||
propertyTypes.DataBind();
|
||||
var macroProp = (IMacroProperty)e.Item.DataItem;
|
||||
if (editors.Any(x => x.Alias == macroProp.EditorAlias))
|
||||
{
|
||||
propertyTypes.SelectedValue = macroProp.EditorAlias;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,13 +9,11 @@
|
||||
<CD:CssInclude ID="CssInclude1" runat="server" FilePath="Editors/EditMacro.css" PathNameAlias="UmbracoClient" />
|
||||
|
||||
<script type="text/javascript">
|
||||
function doSubmit() {
|
||||
document.forms.aspnetForm.submit();
|
||||
}
|
||||
|
||||
|
||||
//handles the change selection of the drop downs to populate the text box
|
||||
(function($) {
|
||||
$(document).ready(function () {
|
||||
|
||||
//on drop down change, update the text box and clear other text boxes
|
||||
$(".fileChooser select").change(function () {
|
||||
//update the txt box
|
||||
@@ -39,6 +37,25 @@
|
||||
ValidatorEnable($(this).get(0), true);
|
||||
});
|
||||
});
|
||||
|
||||
UmbClientMgr.appActions().bindSaveShortCut();
|
||||
|
||||
// U4-667: Make the "Render content in editor" checkbox dependent on the "Use in editor checkbox"
|
||||
var useInEditorCheckBox = $("#<%= macroEditor.ClientID %>");
|
||||
var renderInEditorCheckBox = $("#<%= macroRenderContent.ClientID %>");
|
||||
|
||||
function toggle() {
|
||||
var disabled = useInEditorCheckBox.is(":checked") == false;
|
||||
renderInEditorCheckBox.prop("disabled", disabled);
|
||||
}
|
||||
|
||||
toggle();
|
||||
|
||||
useInEditorCheckBox.on("change", function () {
|
||||
toggle();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
@@ -119,7 +136,7 @@
|
||||
</cc1:Pane>
|
||||
|
||||
<cc1:Pane ID="Panel2" runat="server">
|
||||
<asp:Repeater ID="macroProperties" runat="server">
|
||||
<asp:Repeater ID="macroProperties" runat="server" OnItemDataBound="MacroPropertiesOnItemDataBound">
|
||||
<HeaderTemplate>
|
||||
<table class="table">
|
||||
<thead>
|
||||
@@ -151,11 +168,10 @@
|
||||
<asp:TextBox runat="server" ID="macroPropertyName" Text='<%#Eval("Name")%>' />
|
||||
</td>
|
||||
<td>
|
||||
|
||||
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="macroPropertyType" Display="Dynamic" ForeColor="#b94a48">Required<br/></asp:RequiredFieldValidator>
|
||||
<asp:DropDownList OnPreRender="AddChooseList" runat="server" ID="macroPropertyType"
|
||||
DataTextFormatString="" DataTextField='Name' DataValueField="Alias"
|
||||
DataSource='<%# GetMacroParameterEditors()%>'
|
||||
SelectedValue='<%# Eval("EditorAlias") %>'>
|
||||
DataTextFormatString="" DataTextField='Name' DataValueField="Alias">
|
||||
</asp:DropDownList>
|
||||
</td>
|
||||
<td>
|
||||
@@ -191,28 +207,4 @@
|
||||
</asp:Repeater>
|
||||
</cc1:Pane>
|
||||
|
||||
<asp:PlaceHolder runat="server">
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
UmbClientMgr.appActions().bindSaveShortCut();
|
||||
|
||||
(function ($) {
|
||||
// U4-667: Make the "Render content in editor" checkbox dependent on the "Use in editor checkbox"
|
||||
var useInEditorCheckBox = $("#<%= macroEditor.ClientID %>");
|
||||
var renderInEditorCheckBox = $("#<%= macroRenderContent.ClientID %>");
|
||||
|
||||
toggle();
|
||||
|
||||
useInEditorCheckBox.on("change", function() {
|
||||
toggle();
|
||||
});
|
||||
|
||||
function toggle() {
|
||||
var disabled = useInEditorCheckBox.is(":checked") == false;
|
||||
renderInEditorCheckBox.prop("disabled", disabled);
|
||||
}
|
||||
})(jQuery);
|
||||
});
|
||||
</script>
|
||||
</asp:PlaceHolder>
|
||||
</asp:Content>
|
||||
|
||||
Reference in New Issue
Block a user