public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != TerritoryHierarchyPart.PartName)
            {
                yield break;
            }

            var vm = new TerritoryHierarchyPartSettingsViewModel();

            if (updateModel.TryUpdateModel(vm, "TerritoryHierarchyPartSettingsViewModel", null, null))
            {
                var settings = vm.Settings;
                if (!_territoriesService.GetTerritoryTypes().Select(tt => tt.Name).Contains(settings.TerritoryType))
                {
                    // we are not allowed to manage the type we are trying to assign so error things out
                    updateModel.AddModelError("TerritoryType", T("The type {0} is not allowed.", settings.TerritoryType));
                }
                else
                {
                    builder
                    .WithSetting("TerritoryHierarchyPartSettings.TerritoryType",
                                 settings.TerritoryType);
                }
                builder
                .WithSetting("TerritoryHierarchyPartSettings.MayChangeTerritoryTypeOnItem",
                             settings.MayChangeTerritoryTypeOnItem.ToString(CultureInfo.InvariantCulture));
            }
        }
Exemple #2
0
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "ProductAttributesPart")
            {
                yield break;
            }

            if (ShouldProcessSettings(_contentDefinitionManager.GetTypeDefinition(builder.TypeName)))
            {
                var settings = new ProductAttributeLocalizationSettings();
                if (updateModel.TryUpdateModel(settings, "ProductAttributeLocalizationSettings", null, null))
                {
                    builder
                    .WithSetting("ProductAttributeLocalizationSettings.TryToLocalizeAttributes",
                                 settings.TryToLocalizeAttributes.ToString(CultureInfo.InvariantCulture));
                    builder
                    .WithSetting("ProductAttributeLocalizationSettings.RemoveAttributesWithoutLocalization",
                                 settings.RemoveAttributesWithoutLocalization.ToString(CultureInfo.InvariantCulture));
                    builder
                    .WithSetting("ProductAttributeLocalizationSettings.AssertAttributesHaveSameCulture",
                                 settings.AssertAttributesHaveSameCulture.ToString(CultureInfo.InvariantCulture));
                    builder
                    .WithSetting("ProductAttributeLocalizationSettings.HideAttributesFromEditor",
                                 settings.HideAttributesFromEditor.ToString(CultureInfo.InvariantCulture));
                }
                yield return(DefinitionTemplate(settings));
            }
        }
Exemple #3
0
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "OutputCachePart")
            {
                yield break;
            }

            var settings = new OutputCachePartSettings
            {
            };

            if (updateModel.TryUpdateModel(settings, "OutputCachePartSettings", null, null))
            {
                builder.WithSetting("OutputCachePartSettings.EnableCache", settings.EnableCache.ToString(CultureInfo.InvariantCulture));
                builder.WithSetting("OutputCachePartSettings.CacheDuration", settings.CacheDuration.ToString(CultureInfo.InvariantCulture));
                builder.WithSetting("OutputCachePartSettings.CacheGraceTime", settings.CacheGraceTime.ToString(CultureInfo.InvariantCulture));
                builder.WithSetting("OutputCachePartSettings.AllowOverride", settings.AllowOverride.ToString(CultureInfo.InvariantCulture));
                builder.WithSetting("OutputCachePartSettings.VaryByQueryStringParameters", settings.VaryByQueryStringParameters);
                builder.WithSetting("OutputCachePartSettings.VaryByRequestHeaders", settings.VaryByRequestHeaders);
                builder.WithSetting("OutputCachePartSettings.VaryByCulture", settings.VaryByCulture.ToString(CultureInfo.InvariantCulture));
                builder.WithSetting("OutputCachePartSettings.VaryByAuthenticationState", settings.VaryByAuthenticationState.ToString(CultureInfo.InvariantCulture));
                builder.WithSetting("OutputCachePartSettings.VaryByUser", settings.VaryByUser.ToString(CultureInfo.InvariantCulture));
                builder.WithSetting("OutputCachePartSettings.VaryByUrl", settings.VaryByUrl.ToString(CultureInfo.InvariantCulture));
            }

            yield return(DefinitionTemplate(settings));
        }
Exemple #4
0
        private void BuildSettings(ItemLevelCacheContentDefinitionSettingsVm settings, ContentTypePartDefinitionBuilder builder)
        {
            //// TODO: Add the ability to delete settings.
            //var typeDefinition = _contentDefinitionManager.GetTypeDefinition(builder.TypeName);
            //var part = typeDefinition.Parts.FirstOrDefault(p => p.PartDefinition.Name == builder.Name);

            //if (part != null && part.Settings != null) // part will probably never be null, but it's always good to check first just in case
            //{
            //    foreach (var setting in part.Settings.Where(s=>s.Key.StartsWith($"{mModelPrefix}.Settings[")))
            //    {
            //        part.Settings.Remove(setting.Key);
            //    }
            //}

            foreach (var setting in settings.Settings)
            {
                builder.WithSetting($"{Constants.ContentTypeDefinitionSettingsKey}[{setting.Key}].Mode", setting.Value.Mode.ToString());
                builder.WithSetting($"{Constants.ContentTypeDefinitionSettingsKey}[{setting.Key}].InvalidationAction", setting.Value.InvalidationAction.ToString());
                builder.WithSetting($"{Constants.ContentTypeDefinitionSettingsKey}[{setting.Key}].CacheDurationSeconds", setting.Value.CacheDurationSeconds.ToString(CultureInfo.InvariantCulture));
                builder.WithSetting($"{Constants.ContentTypeDefinitionSettingsKey}[{setting.Key}].CacheGraceTimeSeconds", setting.Value.CacheGraceTimeSeconds.ToString(CultureInfo.InvariantCulture));

                foreach (var compositeCacheKeyProvider in setting.Value.CompositeCacheKeyProviders)
                {
                    builder.WithSetting($"{Constants.ContentTypeDefinitionSettingsKey}[{setting.Key}].CompositeCacheKeyProviders[{compositeCacheKeyProvider.Key}]", compositeCacheKeyProvider.Value.ToString(CultureInfo.InvariantCulture));
                }
            }
        }
Exemple #5
0
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(
            ContentTypePartDefinitionBuilder builder,
            IUpdateModel updateModel)
        {
            if (builder.Name != "MailchimpSubscriptionPart")
            {
                yield break;
            }

            var model = new MailchimpSubscriptionPartSettings();

            updateModel.TryUpdateModel(model, PREFIX, null, null);
            builder.WithSetting("MailchimpSubscriptionPartSettings.AudienceId",
                                model.AudienceId);
            builder.WithSetting("MailchimpSubscriptionPartSettings.PutPayload",
                                model.PutPayload);
            builder.WithSetting("MailchimpSubscriptionPartSettings.MemberEmail",
                                model.MemberEmail);
            builder.WithSetting("MailchimpSubscriptionPartSettings.PolicyTextReferences",
                                model.PolicyTextReferences != null && model.PolicyTextReferences.Count() > 0 ? string.Join(",", model.PolicyTextReferences) : null);
            builder.WithSetting("MailchimpSubscriptionPartSettings.NotifySubscriptionResult",
                                model.NotifySubscriptionResult.ToString());


            yield return(DefinitionTemplate(model, TEMPLATE_NAME, PREFIX));
        }
Exemple #6
0
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(
            ContentTypePartDefinitionBuilder builder,
            IUpdateModel updateModel)
        {
            if (builder.Name != "PolicyPart")
            {
                yield break;
            }

            var model = new PolicyPartSettings();

            updateModel.TryUpdateModel(model, "PolicyPartSettings", null, null);
            if (model.PolicyTextReferences == null || model.PolicyTextReferences.Length == 0)
            {
                model.PolicyTextReferences = new string[] { "{All}" };
            }
            else if (model.PolicyTextReferences.Contains("{All}"))
            {
                model.PolicyTextReferences = new string[] { "{All}" };
            }
            else if (model.PolicyTextReferences.Contains("{DependsOnContent}"))
            {
                model.PolicyTextReferences = new string[] { "{DependsOnContent}" };
            }

            builder.WithSetting("PolicyPartSettings.IncludePendingPolicy",
                                ((IncludePendingPolicyOptions)model.IncludePendingPolicy).ToString());
            builder.WithSetting("PolicyPartSettings.PolicyTextReferences",
                                String.Join(",", model.PolicyTextReferences));
            yield return(DefinitionTemplate(model));
        }
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "BundlePart")
            {
                yield break;
            }

            if (ShouldProcessSettings(_contentDefinitionManager.GetTypeDefinition(builder.TypeName)))
            {
                var settings = new BundleProductLocalizationSettings();
                if (updateModel.TryUpdateModel(settings, "BundleProductLocalizationSettings", null, null))
                {
                    builder
                    .WithSetting("BundleProductLocalizationSettings.TryToLocalizeProducts",
                                 settings.TryToLocalizeProducts.ToString(CultureInfo.InvariantCulture));
                    builder
                    .WithSetting("BundleProductLocalizationSettings.RemoveProductsWithoutLocalization",
                                 settings.RemoveProductsWithoutLocalization.ToString(CultureInfo.InvariantCulture));
                    builder
                    .WithSetting("BundleProductLocalizationSettings.AddProductQuantitiesWhenLocalizing",
                                 settings.AddProductQuantitiesWhenLocalizing.ToString(CultureInfo.InvariantCulture));
                    builder
                    .WithSetting("BundleProductLocalizationSettings.AssertProductsHaveSameCulture",
                                 settings.AssertProductsHaveSameCulture.ToString(CultureInfo.InvariantCulture));
                    builder
                    .WithSetting("BundleProductLocalizationSettings.HideProductsFromEditor",
                                 settings.HideProductsFromEditor.ToString(CultureInfo.InvariantCulture));
                }
            }
        }
 public void Build(ContentTypePartDefinitionBuilder builder)
 {
     builder.WithSetting("AutorouteSettings.PerItemConfiguration", PerItemConfiguration.ToString(CultureInfo.InvariantCulture));
     builder.WithSetting("AutorouteSettings.AllowCustomPattern", AllowCustomPattern.ToString(CultureInfo.InvariantCulture));
     builder.WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", AutomaticAdjustmentOnEdit.ToString(CultureInfo.InvariantCulture));
     builder.WithSetting("AutorouteSettings.PatternDefinitions", PatternDefinitions);
     builder.WithSetting("AutorouteSettings.DefaultPatternIndex", DefaultPatternIndex.ToString(CultureInfo.InvariantCulture));
 }
 public static void SetValues(ContentTypePartDefinitionBuilder builder, GDPRPartTypeSettings settings)
 {
     builder.WithSetting(
         "GDPRPartTypeSettings.IsProfileItemType",
         settings.IsProfileItemType.ToString(CultureInfo.InvariantCulture));
     builder.WithSetting(
         "GDPRPartTypeSettings.DeleteItemsAfterErasure",
         settings.DeleteItemsAfterErasure.ToString(CultureInfo.InvariantCulture));
 }
Exemple #10
0
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "CacheEvictorPart")
            {
                yield break;
            }
            var model = new CacheEvictorPartSettings();

            updateModel.TryUpdateModel(model, "CacheEvictorPartSettings", null, null);

            // validate the inserted id
            if (!string.IsNullOrEmpty(model.EvictItem))
            {
                int    id;
                string identityItems = string.Empty;
                foreach (var item in model.EvictItem.Split(';'))
                {
                    if (!string.IsNullOrWhiteSpace(item))
                    {
                        if (int.TryParse(item, out id))
                        {
                            var content = _contentManager.Get(id);
                            if (content != null)
                            {
                                var identity = _contentManager.GetItemMetadata(content).Identity;
                                if (identity != null)
                                {
                                    identityItems += identity.ToString() + ";";
                                }
                                else
                                {
                                    Services.Notifier.Error(T("CacheEvictorPart - The loaded id {0} does not exist", item));
                                }
                            }
                            else
                            {
                                Services.Notifier.Error(T("CacheEvictorPart - The loaded id {0} does not exist", item));
                            }
                        }
                        else
                        {
                            Services.Notifier.Error(T("CacheEvictorPart - {0} is not an id", item));
                        }
                    }
                }
                // if the validation was successful check the property the identity list
                model.IdentityEvictItem = identityItems;
            }

            // loads each settings field
            builder.WithSetting("CacheEvictorPartSettings.EvictItem", model.EvictItem);
            builder.WithSetting("CacheEvictorPartSettings.IdentityEvictItem", model.IdentityEvictItem);
        }
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "DataProtectionContextPart")
            {
                yield break;
            }
            var model = new DataProtectionContextPartSettings();

            updateModel.TryUpdateModel(model, "DataProtectionContextPartSettings", null, null);
            builder.WithSetting("DataProtectionContextPartSettings.ContextDefault", model.ContextDefault);
            builder.WithSetting("DataProtectionContextPartSettings.ForceDefault", ((bool)model.ForceDefault).ToString());
            yield return(DefinitionTemplate(model));
        }
Exemple #12
0
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "ContainablePart")
            {
                yield break;
            }

            var model = new ContainableTypePartSettings();

            updateModel.TryUpdateModel(model, "ContainableTypePartSettings", null, null);
            builder.WithSetting("ContainableTypePartSettings.ShowContainerPicker", model.ShowContainerPicker.ToString());
            builder.WithSetting("ContainableTypePartSettings.ShowPositionEditor", model.ShowPositionEditor.ToString());
            yield return(DefinitionTemplate(model));
        }
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "JsonDataTablePart")
            {
                yield break;
            }
            var model = new JsonDataTablePartSettings();

            updateModel.TryUpdateModel(model, "JsonDataTablePartSettings", null, null);
            // carica ogni campo dei settings
            builder.WithSetting("JsonDataTablePartSettings.ColumnsDefinition", model.ColumnsDefinition);
            builder.WithSetting("JsonDataTablePartSettings.MaxRows", Convert.ToString(model.MaxRows));
            yield return(DefinitionTemplate(model));
        }
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "QrCodePart")
            {
                yield break;
            }

            var model = new QrCodeTypePartSettings();

            updateModel.TryUpdateModel(model, "QrCodeTypePartSettings", null, null);
            builder.WithSetting("QrCodeTypePartSettings.Value", model.Value);
            builder.WithSetting("QrCodeTypePartSettings.Size", model.Size.ToString());
            yield return(DefinitionTemplate(model));
        }
Exemple #15
0
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "HeroPart")
            {
                yield break;
            }

            var model = new HeroTypePartSettings();

            updateModel.TryUpdateModel(model, "HeroTypePartSettings", null, null);
            builder.WithSetting("HeroTypePartSettings.Hint", !string.IsNullOrWhiteSpace(model.Hint) ? model.Hint : DefaultHint);
            builder.WithSetting("HeroTypePartSettings.Breakpoints", !string.IsNullOrWhiteSpace(model.Breakpoints) ? model.Breakpoints : DefaultBreakpoints);
            yield return(DefinitionTemplate(model));
        }
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "LayoutPart")
            {
                yield break;
            }

            var model = new LayoutTypePartSettings();

            updateModel.TryUpdateModel(model, "LayoutTypePartSettings", null, null);
            builder.WithSetting("LayoutTypePartSettings.IsTemplate", model.IsTemplate.ToString());
            builder.WithSetting("LayoutTypePartSettings.DefaultLayoutData", model.DefaultLayoutData);
            yield return(DefinitionTemplate(model));
        }
Exemple #17
0
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "VoteUpDownPart")
            {
                yield break;
            }

            var model = new VoteUpDownTypePartSettings();

            updateModel.TryUpdateModel(model, "VoteUpDownTypePartSettings", null, null);
            builder.WithSetting("VoteUpDownTypePartSettings.ShowVoter", model.ShowVoter.ToString());
            builder.WithSetting("VoteUpDownTypePartSettings.AllowAnonymousRatings", model.AllowAnonymousRatings.ToString());

            yield return(DefinitionTemplate(model));
        }
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "ReviewsPart")
            {
                yield break;
            }

            var model = new ReviewTypePartSettings();

            updateModel.TryUpdateModel(model, "ReviewTypePartSettings", null, null);
            builder.WithSetting("ReviewTypePartSettings.ShowStars", model.ShowStars.ToString());
            builder.WithSetting("ReviewTypePartSettings.ShowReviews", model.ShowReviews.ToString());

            yield return(DefinitionTemplate(model));
        }
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "TableOfContentsPart")
            {
                yield break;
            }

            var model = new TableOfContentsSettings();

            updateModel.TryUpdateModel(model, "TableOfContentsSettings", null, null);
            builder.WithSetting("TableOfContentsSettings.OptIn", model.OptIn.ToString());
            builder.WithSetting("TableOfContentsSettings.Generate", model.Generate.ToString());
            builder.WithSetting("TableOfContentsSettings.AllowTitle", model.AllowTitle.ToString());
            builder.WithSetting("TableOfContentsSettings.RootSelector", model.RootSelector);
            yield return(DefinitionTemplate(model));
        }
Exemple #20
0
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "UserViewPart")
            {
                yield break;
            }

            var model = new UserViewTypePartSettings();

            updateModel.TryUpdateModel(model, "UserViewTypePartSettings", null, null);
            builder.WithSetting("UserViewTypePartSettings.DisplayType", model.DisplayType);
            builder.WithSetting("UserViewTypePartSettings.AllowAnonymousViews", model.AllowAnonymousViews.ToString());
            builder.WithSetting("UserViewTypePartSettings.AllowMultipleViewsFromSameUserToCount", model.AllowMultipleViewsFromSameUserToCount.ToString());

            yield return(DefinitionTemplate(model));
        }
Exemple #21
0
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(
            ContentTypePartDefinitionBuilder builder,
            IUpdateModel updateModel)
        {
            if (builder.Name != "PayButtonPart")
            {
                yield break;
            }
            var model = new PayButtonPartSettings();

            updateModel.TryUpdateModel(model, "PayButtonPartSettings", null, null);
            builder.WithSetting("PayButtonPartSettings.AmountField", model.AmountField);
            builder.WithSetting("PayButtonPartSettings.CurrencyField", model.CurrencyField);
            builder.WithSetting("PayButtonPartSettings.DefaultCurrency", model.DefaultCurrency);
            yield return(DefinitionTemplate(model));
        }
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "PaperclipPart")
            {
                yield break;
            }

            var model = new PaperclipTypePartSettings();

            updateModel.TryUpdateModel(model, "PaperclipTypePartSettings", null, null);
            builder.WithSetting("PaperclipTypePartSettings.DefaultPlacement", model.DefaultPlacement);
            builder.WithSetting("PaperclipTypePartSettings.DefaultDisplayType", model.DefaultDisplayType);
            builder.WithSetting("PaperclipTypePartSettings.AllowChangePlacement", model.AllowChangePlacement.ToString());
            builder.WithSetting("PaperclipTypePartSettings.AllowChangeDisplayType", model.AllowChangeDisplayType.ToString());

            yield return(DefinitionTemplate(model));
        }
        public static void SetValues(ContentTypePartDefinitionBuilder builder, GDPRPartPartSettings settings)
        {
            builder.WithSetting(
                "GDPRPartPartSettings.ShouldAnonymize",
                settings.ShouldAnonymize.ToString(CultureInfo.InvariantCulture));

            builder.WithSetting(
                "GDPRPartPartSettings.ShouldErase",
                settings.ShouldErase.ToString(CultureInfo.InvariantCulture));
            // serialized dictionaries
            builder.WithSetting(
                "GDPRPartPartSettings.AnonymizationSerializedPairs",
                settings.AnonymizationSerializedPairs);
            builder.WithSetting(
                "GDPRPartPartSettings.ErasureSerializedPairs",
                settings.ErasureSerializedPairs);
        }
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(
            ContentTypePartDefinitionBuilder builder,
            IUpdateModel updateModel)
        {
            if (builder.Name != "TwitterPostPart")
            {
                yield break;
            }
            var model = new TwitterPostPartSettingVM();

            updateModel.TryUpdateModel(model, "TwitterPostPartSettingVM", null, null);
            builder.WithSetting("TwitterPostPartSettingVM.Title", ((string)model.Title) ?? "");
            builder.WithSetting("TwitterPostPartSettingVM.Image", ((string)model.Image) ?? "");
            builder.WithSetting("TwitterPostPartSettingVM.Description", ((string)model.Description) ?? "");
            builder.WithSetting("TwitterPostPartSettingVM.ShowTwitterCurrentLink", ((Boolean)model.ShowTwitterCurrentLink).ToString());
            yield return(DefinitionTemplate(model));
        }
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "SpamFilterPart")
            {
                yield break;
            }

            var settings = new SpamFilterPartSettings {
            };

            if (updateModel.TryUpdateModel(settings, "SpamFilterPartSettings", null, null))
            {
                builder.WithSetting("SpamFilterPartSettings.Action", settings.Action.ToString());
                builder.WithSetting("SpamFilterPartSettings.Pattern", settings.Pattern);
            }

            yield return(DefinitionTemplate(settings));
        }
Exemple #26
0
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "DashboardPart")
            {
                yield break;
            }

            var settings = new DashboardPartSettings {
            };

            if (updateModel.TryUpdateModel(settings, "DashboardPartSettings", null, null))
            {
                builder.WithSetting("DashboardPartSettings.Name", settings.Name.ToString(CultureInfo.InvariantCulture));
                builder.WithSetting("DashboardPartSettings.Description", settings.Description.ToString(CultureInfo.InvariantCulture));
            }

            yield return(DefinitionTemplate(settings));
        }
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "RelatedContentPart")
            {
                yield break;
            }

            var viewModel = new RelatedContentTypePartSettingsViewModel
            {
                AvailableItemContentTypes = _contentDefinitionManager.ListTypeDefinitions().ToList()
            };

            updateModel.TryUpdateModel(viewModel, "RelatedContentTypePartSettingsViewModel", null, new[] { "AvailableItemContentTypes" });
            builder.WithSetting("RelatedContentTypeSettings.CollectionDisplayShape", viewModel.CollectionDisplayShape);
            builder.WithSetting("RelatedContentTypeSettings.RestrictedItemContentTypes", viewModel.RestrictedItemContentTypes != null ? string.Join(",", viewModel.RestrictedItemContentTypes) : "");
            builder.WithSetting("RelatedContentTypeSettings.RestrictItemContentTypes", viewModel.RestrictItemContentTypes.ToString());
            yield return(DefinitionTemplate(viewModel));
        }
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "SubmissionLimitPart")
            {
                yield break;
            }

            var settings = new SubmissionLimitPartSettings {
            };

            if (updateModel.TryUpdateModel(settings, "SubmissionLimitPartSettings", null, null))
            {
                builder.WithSetting("SubmissionLimitPartSettings.Limit", settings.Limit.ToString(CultureInfo.InvariantCulture));
                builder.WithSetting("SubmissionLimitPartSettings.Unit", settings.Unit.ToString(CultureInfo.InvariantCulture));
            }

            yield return(DefinitionTemplate(settings));
        }
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "ReCaptchaPart")
            {
                yield break;
            }

            var settings = new ReCaptchaPartSettings {
            };

            if (updateModel.TryUpdateModel(settings, "ReCaptchaPartSettings", null, null))
            {
                builder.WithSetting("ReCaptchaPartSettings.PublicKey", settings.PublicKey);
                builder.WithSetting("ReCaptchaPartSettings.PrivateKey", settings.PrivateKey);
            }

            yield return(DefinitionTemplate(settings));
        }
        public override IEnumerable <TemplateViewModel> TypePartEditorUpdate(ContentTypePartDefinitionBuilder builder, IUpdateModel updateModel)
        {
            if (builder.Name != "BidsPart")
            {
                yield break;
            }

            var settings = new BidsPartSettings {
            };

            if (updateModel.TryUpdateModel(settings, "BidsPartSettings", null, null))
            {
                builder.WithSetting("BidsPartSettings.DefaultBidsShown", settings.DefaultBidsShown.ToString(CultureInfo.InvariantCulture));
                builder.WithSetting("BidsPartSettings.MustBeAuthenticated", settings.MustBeAuthenticated.ToString(CultureInfo.InvariantCulture));
            }

            yield return(DefinitionTemplate(settings));
        }