diff --git a/src/Umbraco.Web/Editors/Binders/BlueprintItemBinder.cs b/src/Umbraco.Web/Editors/Binders/BlueprintItemBinder.cs new file mode 100644 index 0000000000..eb4d482b14 --- /dev/null +++ b/src/Umbraco.Web/Editors/Binders/BlueprintItemBinder.cs @@ -0,0 +1,24 @@ +using Umbraco.Core.Logging; +using Umbraco.Core.Models; +using Umbraco.Core.Services; +using Umbraco.Web.Models.ContentEditing; + +namespace Umbraco.Web.Editors.Binders +{ + internal class BlueprintItemBinder : ContentItemBinder + { + public BlueprintItemBinder() + { + } + + public BlueprintItemBinder(ILogger logger, ServiceContext services, IUmbracoContextAccessor umbracoContextAccessor) + : base(logger, services, umbracoContextAccessor) + { + } + + protected override IContent GetExisting(ContentItemSave model) + { + return Services.ContentService.GetBlueprintById(model.Id); + } + } +} diff --git a/src/Umbraco.Web/Editors/Binders/ContentItemBinder.cs b/src/Umbraco.Web/Editors/Binders/ContentItemBinder.cs index a3cb1d229a..fd8951993b 100644 --- a/src/Umbraco.Web/Editors/Binders/ContentItemBinder.cs +++ b/src/Umbraco.Web/Editors/Binders/ContentItemBinder.cs @@ -1,23 +1,15 @@ using System; -using System.Collections.Generic; using System.Linq; -using System.Net; -using System.Net.Http; -using System.Web.Http; using System.Web.Http.Controllers; using System.Web.Http.ModelBinding; using AutoMapper; using Umbraco.Core; using Umbraco.Core.Logging; using Umbraco.Core.Models; -using Umbraco.Core.Models.Editors; using Umbraco.Core.Services; using Umbraco.Web.Composing; -using Umbraco.Web.Editors.Filters; using Umbraco.Web.Models.ContentEditing; using Umbraco.Web.Models.Mapping; -using Umbraco.Web.WebApi; -using Umbraco.Web.WebApi.Filters; namespace Umbraco.Web.Editors.Binders { @@ -26,7 +18,6 @@ namespace Umbraco.Web.Editors.Binders /// internal class ContentItemBinder : IModelBinder { - private readonly ServiceContext _services; private readonly ContentModelBinderHelper _modelBinderHelper; public ContentItemBinder() : this(Current.Logger, Current.Services, Current.UmbracoContextAccessor) @@ -35,10 +26,12 @@ namespace Umbraco.Web.Editors.Binders public ContentItemBinder(ILogger logger, ServiceContext services, IUmbracoContextAccessor umbracoContextAccessor) { - _services = services; + Services = services; _modelBinderHelper = new ContentModelBinderHelper(); } + protected ServiceContext Services { get; } + /// /// Creates the model from the request and binds it to the context /// @@ -78,14 +71,14 @@ namespace Umbraco.Web.Editors.Binders return true; } - private IContent GetExisting(ContentItemSave model) + protected virtual IContent GetExisting(ContentItemSave model) { - return _services.ContentService.GetById(model.Id); + return Services.ContentService.GetById(model.Id); } private IContent CreateNew(ContentItemSave model) { - var contentType = _services.ContentTypeService.Get(model.ContentTypeAlias); + var contentType = Services.ContentTypeService.Get(model.ContentTypeAlias); if (contentType == null) { throw new InvalidOperationException("No content type found with alias " + model.ContentTypeAlias); diff --git a/src/Umbraco.Web/PropertyEditors/EmailAddressPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/EmailAddressPropertyEditor.cs index ea3dbc7144..d55d3327e1 100644 --- a/src/Umbraco.Web/PropertyEditors/EmailAddressPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/EmailAddressPropertyEditor.cs @@ -5,7 +5,7 @@ using Umbraco.Core.PropertyEditors.Validators; namespace Umbraco.Web.PropertyEditors { - [DataEditor(Constants.PropertyEditors.Aliases.EmailAddress, "Email address", "email", IsParameterEditor = true, Icon="icon-message")] + [DataEditor(Constants.PropertyEditors.Aliases.EmailAddress, EditorType.PropertyValue | EditorType.MacroParameter, "Email address", "email", Icon="icon-message")] public class EmailAddressPropertyEditor : DataEditor { /// diff --git a/src/Umbraco.Web/PropertyEditors/TrueFalseConfiguration.cs b/src/Umbraco.Web/PropertyEditors/TrueFalseConfiguration.cs index 2dfbf9b0b6..6d962c42f1 100644 --- a/src/Umbraco.Web/PropertyEditors/TrueFalseConfiguration.cs +++ b/src/Umbraco.Web/PropertyEditors/TrueFalseConfiguration.cs @@ -9,5 +9,8 @@ namespace Umbraco.Web.PropertyEditors { [ConfigurationField("default", "Default Value", "boolean")] public string Default { get; set; } // fixme - well, true or false?! + + [ConfigurationField("labelOn", "Write a label text", "textstring")] + public string Label { get; set; } } -} \ No newline at end of file +} diff --git a/src/Umbraco.Web/PropertyEditors/TrueFalsePropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/TrueFalsePropertyEditor.cs index 27c72d213b..ccd3bee744 100644 --- a/src/Umbraco.Web/PropertyEditors/TrueFalsePropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/TrueFalsePropertyEditor.cs @@ -20,15 +20,5 @@ namespace Umbraco.Web.PropertyEditors /// protected override IConfigurationEditor CreateConfigurationEditor() => new TrueFalseConfigurationEditor(); - public TrueFalsePreValueEditor() - { - Fields.Add(new PreValueField() - { - Description = "Write a label text", - Key = "labelOn", - Name = "Label", - View = "textstring" - }); - } } } diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index faf08849ce..cb645f0b34 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -179,6 +179,7 @@ + @@ -200,7 +201,6 @@ - diff --git a/src/Umbraco.Web/WebApi/Binders/BlueprintItemBinder.cs b/src/Umbraco.Web/WebApi/Binders/BlueprintItemBinder.cs deleted file mode 100644 index 825c5b01c3..0000000000 --- a/src/Umbraco.Web/WebApi/Binders/BlueprintItemBinder.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using Umbraco.Core; -using Umbraco.Core.Models; -using Umbraco.Web.Models.ContentEditing; - -namespace Umbraco.Web.WebApi.Binders -{ - internal class BlueprintItemBinder : ContentItemBinder - { - public BlueprintItemBinder(ApplicationContext applicationContext) - : base(applicationContext) - { - } - - /// - /// Constructor - /// - public BlueprintItemBinder() - : this(ApplicationContext.Current) - { - } - - protected override IContent GetExisting(ContentItemSave model) - { - return ApplicationContext.Services.ContentService.GetBlueprintById(Convert.ToInt32(model.Id)); - } - } -} \ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.cs index 98396f6609..e3fc136bad 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.cs @@ -417,7 +417,7 @@ namespace umbraco.presentation.umbraco.dialogs var content = Services.ContentService.GetById(pageId); var text = content == null ? "" : content.Name; - feedback.Text = Services.TextService.Localize("publicAccess/paIsProtected", new[] { text }); + feedback_text.Text = Services.TextService.Localize("publicAccess/paIsProtected", new[] { text }); p_setup.Visible = false; p_feedback.Visible = true;