public override IEnumerable<TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel) {
            var model = new AgileUploaderFieldSettings();
            if (builder.FieldType != "AgileUploaderField")
            {
                yield break;
            } 
            if (updateModel.TryUpdateModel(model, "AgileUploaderFieldSettings", null, null))
            {
                builder.WithSetting("AgileUploaderFieldSettings.Hint", model.Hint);
                builder.WithSetting("AgileUploaderFieldSettings.MaxHeight", Convert.ToString(model.MaxHeight));
                builder.WithSetting("AgileUploaderFieldSettings.MaxWidth", Convert.ToString(model.MaxWidth));
                builder.WithSetting("AgileUploaderFieldSettings.AuthorCanSetAlternateText", Convert.ToString(model.AuthorCanSetAlternateText));
                builder.WithSetting("AgileUploaderFieldSettings.MediaFolder", model.MediaFolder);
                builder.WithSetting("AgileUploaderFieldSettings.FileLimit", Convert.ToString(model.FileLimit));
            }

            yield return DefinitionTemplate(model);
        }
Exemplo n.º 2
0
        public override IEnumerable <TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel)
        {
            var model = new AgileUploaderFieldSettings();

            if (builder.FieldType != "AgileUploaderField")
            {
                yield break;
            }
            if (updateModel.TryUpdateModel(model, "AgileUploaderFieldSettings", null, null))
            {
                builder.WithSetting("AgileUploaderFieldSettings.Hint", model.Hint);
                builder.WithSetting("AgileUploaderFieldSettings.MaxHeight", Convert.ToString(model.MaxHeight));
                builder.WithSetting("AgileUploaderFieldSettings.MaxWidth", Convert.ToString(model.MaxWidth));
                builder.WithSetting("AgileUploaderFieldSettings.AuthorCanSetAlternateText", Convert.ToString(model.AuthorCanSetAlternateText));
                builder.WithSetting("AgileUploaderFieldSettings.MediaFolder", model.MediaFolder);
                builder.WithSetting("AgileUploaderFieldSettings.FileLimit", Convert.ToString(model.FileLimit));
            }

            yield return(DefinitionTemplate(model));
        }