コード例 #1
0
 public Task UpdateTypePartEditorAsync(ContentTypePartDefinition model, UpdateTypePartEditorContext context)
 {
     return _typePartDisplayDrivers.InvokeAsync(async contentDisplay =>
     {
         var result = await contentDisplay.UpdateEditorAsync(model, context);
         if (result != null)
             result.Apply(context);
     }, Logger);
 }
コード例 #2
0
        public override async Task<IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (!String.Equals("ListPart", contentTypePartDefinition.PartDefinition.Name, StringComparison.Ordinal))
            {
                return null;
            }

            var model = new ListPartSettings();

            await context.Updater.TryUpdateModelAsync(model, Prefix);

            context.Builder.ContainedContentType(model.ContainedContentType);

            return Edit(contentTypePartDefinition, context.Updater);
        }
コード例 #3
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (!String.Equals(nameof(FacebookPluginPart), contentTypePartDefinition.PartDefinition.Name))
            {
                return(null);
            }

            var model = new FacebookPluginPartSettingsViewModel();

            await context.Updater.TryUpdateModelAsync(model, Prefix,
                                                      m => m.Liquid);

            if (!string.IsNullOrEmpty(model.Liquid) && !_templateManager.Validate(model.Liquid, out var errors))
            {
                context.Updater.ModelState.AddModelError(nameof(model.Liquid), S["The Body doesn't contain a valid Liquid expression. Details: {0}", string.Join(" ", errors)]);
            }
            else
            {
                context.Builder.WithSettings(new FacebookPluginPartSettings {
                    Liquid = model.Liquid
                });
            }

            return(Edit(contentTypePartDefinition, context.Updater));
        }
コード例 #4
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (contentTypePartDefinition.Editor() == "Monaco")
            {
                var model    = new MonacoSettingsViewModel();
                var settings = new HtmlBodyPartMonacoEditorSettings();

                await context.Updater.TryUpdateModelAsync(model, Prefix);

                if (!model.Options.IsJson())
                {
                    context.Updater.ModelState.AddModelError(Prefix + "." + nameof(MonacoSettingsViewModel.Options), S["The options are written in an incorrect format."]);
                }
                else
                {
                    var jsonSettings = JObject.Parse(model.Options);
                    jsonSettings["language"] = "html";
                    settings.Options         = jsonSettings.ToString();
                    context.Builder.WithSettings(settings);
                }
            }

            return(Edit(contentTypePartDefinition, context.Updater));
        }
コード例 #5
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (!String.Equals(nameof(CommonPart), contentTypePartDefinition.PartDefinition.Name, StringComparison.Ordinal))
            {
                return(null);
            }

            var model = new CommonPartSettingsViewModel();

            if (await context.Updater.TryUpdateModelAsync(model, Prefix))
            {
                context.Builder.WithSettings(new CommonPartSettings {
                    DisplayDateEditor = model.DisplayDateEditor, DisplayOwnerEditor = model.DisplayOwnerEditor
                });
            }

            return(Edit(contentTypePartDefinition, context.Updater));
        }
コード例 #6
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (!String.Equals(nameof(BagPart), contentTypePartDefinition.PartDefinition.Name))
            {
                return(null);
            }

            var model = new BagPartSettingsViewModel();

            await context.Updater.TryUpdateModelAsync(model, Prefix, m => m.ContainedContentTypes, m => m.DisplayType);

            if (model.ContainedContentTypes == null || model.ContainedContentTypes.Length == 0)
            {
                context.Updater.ModelState.AddModelError(nameof(model.ContainedContentTypes), S["At least one content type must be selected."]);
            }
            else
            {
                context.Builder.WithSettings(new BagPartSettings
                {
                    ContainedContentTypes = model.ContainedContentTypes,
                    DisplayType           = model.DisplayType
                });
            }

            return(Edit(contentTypePartDefinition, context.Updater));
        }
コード例 #7
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            var model = new WidgetsListPartSettingsViewModel();

            if (await context.Updater.TryUpdateModelAsync(model, Prefix, m => m.Zones))
            {
                context.Builder.WithSettings(new WidgetsListPartSettings {
                    Zones = (model.Zones ?? "").Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries)
                });
            }

            return(Edit(contentTypePartDefinition, context.Updater));
        }
コード例 #8
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition model, UpdateTypePartEditorContext context)
        {
            if (!string.Equals(nameof(BlockBodyPart), model.PartDefinition.Name, StringComparison.Ordinal))
            {
                return(null);
            }

            var settings = new BlockBodyPartSettings();

            await context.Updater.TryUpdateModelAsync(settings, Prefix);

            context.Builder.WithSettings(settings);

            return(Edit(model));
        }
コード例 #9
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (!String.Equals(nameof(ActionsPanelPart), contentTypePartDefinition.PartDefinition.Name, StringComparison.Ordinal))
            {
                return(null);
            }

            var contentItemDisplayManager = _serviceProvider.GetRequiredService <IContentItemDisplayManager>();
            var contentManager            = _serviceProvider.GetRequiredService <IContentManager>();

            var model = new ActionsPanelPartSettingsViewModel();

            await context.Updater.TryUpdateModelAsync(model, Prefix);

            //FlowPartDisplayMode
            model.FlowPartDisplayMode.Widgets.Clear();

            for (var i = 0; i < model.Prefixes.Length; i++)
            {
                var contentItem = await contentManager.NewAsync(model.ContentTypes[i]);

                contentItem.Weld(new FlowMetadata());
                var widgetModel = await contentItemDisplayManager.UpdateEditorAsync(contentItem, context.Updater, context.IsNew, htmlFieldPrefix : model.Prefixes[i]);


                model.FlowPartDisplayMode.Widgets.Add(contentItem);
            }


            //FlowPartEditMode
            model.FlowPartEditMode.Widgets.Clear();

            for (var i = 0; i < model.PrefixesEditMode.Length; i++)
            {
                var contentItem = await contentManager.NewAsync(model.ContentTypesEditMode[i]);

                contentItem.Weld(new FlowMetadata());

                var widgetModel = await contentItemDisplayManager.UpdateEditorAsync(contentItem, context.Updater, context.IsNew, htmlFieldPrefix : model.PrefixesEditMode[i]);


                model.FlowPartEditMode.Widgets.Add(contentItem);
            }

            //FlowPartCreateMode
            model.FlowPartCreateMode.Widgets.Clear();

            for (var i = 0; i < model.PrefixesCreateMode.Length; i++)
            {
                var contentItem = await contentManager.NewAsync(model.ContentTypesCreateMode[i]).ConfigureAwait(false);

                contentItem.Weld(new FlowMetadata());

                var widgetModel = await contentItemDisplayManager.UpdateEditorAsync(contentItem, context.Updater, context.IsNew, htmlFieldPrefix : model.PrefixesCreateMode[i]);

                model.FlowPartCreateMode.Widgets.Add(contentItem);
            }

            context.Builder.WithSettings(new ActionsPanelPartSettings
            {
                FlowPartDisplayMode = model.FlowPartDisplayMode,
                FlowPartEditMode    = model.FlowPartEditMode,
                FlowPartCreateMode  = model.FlowPartCreateMode,
                AllowOverrideActionsPanelPerInstance = model.AllowOverrideActionsPanelPerInstance
            });


            return(Edit(contentTypePartDefinition, context.Updater));
        }
コード例 #10
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (!String.Equals(nameof(AdvancedBreadCrumbPart), contentTypePartDefinition.PartDefinition.Name, StringComparison.Ordinal))
            {
                return(null);
            }

            var model = new AdvancedBreadCrumbPartSettingsViewModel();

            if (await context.Updater.TryUpdateModelAsync(model, Prefix)) //, m => m.ShortName))
            {
                context.Builder.WithSettings(new AdvancedBreadCrumbPartSettings
                {
                });// { ShortName = model.ShortName }});
            }

            return(Edit(contentTypePartDefinition, context.Updater));
        }
コード例 #11
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (contentTypePartDefinition.ContentTypeDefinition.Name == contentTypePartDefinition.PartDefinition.Name)
            {
                return(null);
            }

            var model = new GraphQLContentTypePartSettingsViewModel();

            await context.Updater.TryUpdateModelAsync(model, Prefix);

            context.Builder.WithSettings(model.Settings);

            return(Edit(contentTypePartDefinition));
        }
コード例 #12
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (!String.Equals(nameof(HtmlBodyPart), contentTypePartDefinition.PartDefinition.Name))
            {
                return(null);
            }

            if (contentTypePartDefinition.Editor() == "CKEditorClassic")
            {
                var model    = new HtmlBodyPartCKEditorClassicSettingsViewModel();
                var settings = new HtmlBodyPartCKEditorClassicSettings();

                await context.Updater.TryUpdateModelAsync(model, Prefix, m => m.SelectedConfigurationName);

                settings.ConfigurationName = model.SelectedConfigurationName;

                context.Builder.WithSettings(settings);
            }

            return(Edit(contentTypePartDefinition));
        }
コード例 #13
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            var model = new PreviewPartSettingsViewModel();

            await context.Updater.TryUpdateModelAsync(model, Prefix,
                                                      m => m.Pattern
                                                      );

            if (!string.IsNullOrEmpty(model.Pattern) && !_templateManager.Validate(model.Pattern, out var errors))
            {
                context.Updater.ModelState.AddModelError(nameof(model.Pattern), S["Pattern doesn't contain a valid Liquid expression. Details: {0}", string.Join(" ", errors)]);
            }
            else
            {
                context.Builder.WithSettings(new PreviewPartSettings
                {
                    Pattern = model.Pattern
                });
            }

            return(Edit(contentTypePartDefinition, context.Updater));
        }
コード例 #14
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (!String.Equals(nameof(EmailTemplatePart), contentTypePartDefinition.PartDefinition.Name))
            {
                return(null);
            }

            var model = new EmailTemplatePartSettingsViewModel();

            await context.Updater.TryUpdateModelAsync(model, Prefix,
                                                      m => m.SelectedEmailTemplates);

            var templatesDocument = await _templatesManager.GetEmailTemplatesDocumentAsync();

            context.Builder.WithSettings(new EmailTemplatePartSettings
            {
                SelectedEmailTemplates = model.SelectedEmailTemplates[0]?.Split(',', StringSplitOptions.RemoveEmptyEntries)
            });

            return(Edit(contentTypePartDefinition, context.Updater));
        }
コード例 #15
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (!String.Equals(nameof(MarkdownBodyPart), contentTypePartDefinition.PartDefinition.Name))
            {
                return(null);
            }

            var model    = new MarkdownBodyPartSettingsViewModel();
            var settings = new MarkdownBodyPartSettings();

            if (await context.Updater.TryUpdateModelAsync(model, Prefix))
            {
                settings.SanitizeHtml = model.SanitizeHtml;

                context.Builder.WithSettings(settings);
            }

            return(Edit(contentTypePartDefinition, context.Updater));
        }
コード例 #16
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (!String.Equals(nameof(AutoroutePart), contentTypePartDefinition.PartDefinition.Name, StringComparison.Ordinal))
            {
                return(null);
            }

            var model = new AutoroutePartSettingsViewModel();

            await context.Updater.TryUpdateModelAsync(model, Prefix,
                                                      m => m.Pattern,
                                                      m => m.AllowCustomPath,
                                                      m => m.AllowUpdatePath,
                                                      m => m.ShowHomepageOption);

            context.Builder.WithSetting(nameof(AutoroutePartSettings.Pattern), model.Pattern);
            context.Builder.WithSetting(nameof(AutoroutePartSettings.AllowCustomPath), model.AllowCustomPath.ToString());
            context.Builder.WithSetting(nameof(AutoroutePartSettings.AllowUpdatePath), model.AllowUpdatePath.ToString());
            context.Builder.WithSetting(nameof(AutoroutePartSettings.ShowHomepageOption), model.ShowHomepageOption.ToString());

            return(Edit(contentTypePartDefinition, context.Updater));
        }
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (contentTypePartDefinition.DisplayMode() == "Prism")
            {
                var model    = new PrismSettingsViewModel();
                var settings = new HtmlBodyPartPrismDisplaySettings();

                if (await context.Updater.TryUpdateModelAsync(model, Prefix))
                {
                    settings.Theme = model.Theme;

                    context.Builder.WithSettings(settings);
                }
            }

            return(Edit(contentTypePartDefinition, context.Updater));
        }
コード例 #18
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (!String.Equals(nameof(InfiniteAjaxScrollPart), contentTypePartDefinition.PartDefinition.Name, StringComparison.Ordinal))
            {
                return(null);
            }

            var model = new InfiniteAjaxScrollPartSettingsViewModel();

            if (await context.Updater.TryUpdateModelAsync(model, Prefix, m => m.Container, m => m.ScrollContainer, m => m.UseHistory, m => m.Item, m => m.Pagination,
                                                          m => m.NextAnchor,
                                                          m => m.Loader
                                                          // m => m.OnPageChange,
                                                          // m => m.BeforePageChange,
                                                          // m => m.OnLoadItems,
                                                          // m => m.OnRenderComplete
                                                          ))
            {
                context.Builder.WithSettings(new InfiniteAjaxScrollPartSettings
                {
                    Container       = model.Container,
                    ScrollContainer = model.ScrollContainer,
                    UseHistory      = model.UseHistory,
                    Item            = model.Item,
                    Pagination      = model.Pagination,
                    NextAnchor      = model.NextAnchor,
                    Loader          = model.Loader,
                    // OnPageChange = model.OnPageChange,
                    // BeforePageChange = model.BeforePageChange,
                    // OnLoadItems = model.OnLoadItems,
                    // OnRenderComplete = model.OnRenderComplete,
                });
            }

            return(Edit(contentTypePartDefinition, context.Updater));
        }
コード例 #19
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            var model = new AutoroutePartSettingsViewModel();

            await context.Updater.TryUpdateModelAsync(model, Prefix,
                                                      m => m.Pattern,
                                                      m => m.AllowCustomPath,
                                                      m => m.AllowUpdatePath,
                                                      m => m.ShowHomepageOption,
                                                      m => m.AllowDisabled,
                                                      m => m.AllowRouteContainedItems,
                                                      m => m.ManageContainedItemRoutes,
                                                      m => m.AllowAbsolutePath);

            if (!string.IsNullOrEmpty(model.Pattern) && !_templateManager.Validate(model.Pattern, out var errors))
            {
                context.Updater.ModelState.AddModelError(nameof(model.Pattern), S["Pattern doesn't contain a valid Liquid expression. Details: {0}", string.Join(" ", errors)]);
            }
            else
            {
                context.Builder.WithSettings(new AutoroutePartSettings
                {
                    Pattern                   = model.Pattern,
                    AllowCustomPath           = model.AllowCustomPath,
                    AllowUpdatePath           = model.AllowUpdatePath,
                    ShowHomepageOption        = model.ShowHomepageOption,
                    AllowDisabled             = model.AllowDisabled,
                    AllowRouteContainedItems  = model.AllowRouteContainedItems,
                    ManageContainedItemRoutes = model.ManageContainedItemRoutes,
                    AllowAbsolutePath         = model.AllowAbsolutePath
                });
            }

            return(Edit(contentTypePartDefinition, context.Updater));
        }
コード例 #20
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (!String.Equals(nameof(BodyPart), contentTypePartDefinition.PartDefinition.Name, StringComparison.Ordinal))
            {
                return(null);
            }

            var model = new BodyPartSettingsViewModel();

            await context.Updater.TryUpdateModelAsync(model, Prefix, m => m.RenderTokens);

            context.Builder.WithSetting(nameof(BodyPartSettings.RenderTokens), model.RenderTokens.ToString());

            return(Edit(contentTypePartDefinition, context.Updater));
        }
コード例 #21
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (!String.Equals(nameof(BinderPart), contentTypePartDefinition.PartDefinition.Name, StringComparison.Ordinal))
            {
                return(null);
            }

            var model = new BinderPartSettingsViewModel();

            if (await context.Updater.TryUpdateModelAsync(model, Prefix, m => m.Icon, m => m.TemplatesListUrl))
            {
                context.Builder.WithSettings(new BinderPartSettings {
                    Icon = model.Icon, TemplatesListUrl = model.TemplatesListUrl
                });
            }

            return(Edit(contentTypePartDefinition, context.Updater));
        }
コード例 #22
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (!String.Equals("ListPart", contentTypePartDefinition.PartDefinition.Name, StringComparison.Ordinal))
            {
                return(null);
            }

            var model = new ListPartSettingsViewModel();

            await context.Updater.TryUpdateModelAsync(model, Prefix, m => m.ContainedContentTypes, m => m.PageSize);

            if (model.ContainedContentTypes == null || model.ContainedContentTypes.Length == 0)
            {
                context.Updater.ModelState.AddModelError(nameof(model.ContainedContentTypes), TS["At least one content type must be selected."]);
            }
            else
            {
                context.Builder.WithSetting("PageSize", model.PageSize.ToString());
                context.Builder.ContainedContentTypes(model.ContainedContentTypes);
            }

            return(Edit(contentTypePartDefinition, context.Updater));
        }
コード例 #23
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            var settings = contentTypePartDefinition.GetSettings <ListPartSettings>();

            var model = new ListPartSettingsViewModel();

            await context.Updater.TryUpdateModelAsync(model, Prefix, m => m.ContainedContentTypes, m => m.PageSize, m => m.EnableOrdering);

            if (model.ContainedContentTypes == null || model.ContainedContentTypes.Length == 0)
            {
                context.Updater.ModelState.AddModelError(nameof(model.ContainedContentTypes), S["At least one content type must be selected."]);
            }
            else
            {
                context.Builder.WithSettings(new ListPartSettings
                {
                    PageSize              = model.PageSize,
                    EnableOrdering        = model.EnableOrdering,
                    ContainedContentTypes = model.ContainedContentTypes
                });

                // Update order of existing content if enable ordering has been turned on
                if (settings.EnableOrdering != model.EnableOrdering && model.EnableOrdering == true)
                {
                    await _containerService.SetInitialOrder(contentTypePartDefinition.ContentTypeDefinition.Name);
                }
            }

            return(Edit(contentTypePartDefinition, context.Updater));
        }
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (!string.Equals(nameof(AuditTrailPart), contentTypePartDefinition.PartDefinition.Name))
            {
                return(null);
            }

            var model = new AuditTrailPartSettingsViewModel();

            if (await context.Updater.TryUpdateModelAsync(model, Prefix, m => m.ShowAuditTrailCommentInput))
            {
                context.Builder.WithSettings(new AuditTrailPartSettings
                {
                    ShowAuditTrailCommentInput = model.ShowAuditTrailCommentInput
                });
            }

            return(Edit(contentTypePartDefinition, context.Updater));
        }
コード例 #25
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (!String.Equals(nameof(MyTestPart), contentTypePartDefinition.PartDefinition.Name))
            {
                return(null);
            }

            var model = new MyTestPartSettingsViewModel();

            if (await context.Updater.TryUpdateModelAsync(model, Prefix, m => m.MySetting))
            {
                context.Builder.WithSettings(new MyTestPartSettings {
                    MySetting = model.MySetting
                });
            }

            return(Edit(contentPartDefinition, context.Updater));
        }
コード例 #26
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (!await _authorizationService.AuthorizeAsync(_httpContextAccessor.HttpContext.User, Permissions.ManageIndexes))
            {
                return(null);
            }

            var model = new ContentIndexSettingsViewModel();

            await context.Updater.TryUpdateModelAsync(model, Prefix);

            context.Builder.WithSettings(model.ContentIndexSettings);

            return(await EditAsync(contentTypePartDefinition, context.Updater));
        }
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (!IsProfileGroupOwnership(contentTypePartDefinition))
            {
                return(null);
            }

            var model = new ProfileGroupOwnershipPartSettingsViewModel();

            await context.Updater.TryUpdateModelAsync(model, Prefix, m => m.RestrictAccess);

            context.Builder.WithSettings(new ProfileGroupOwnershipPartSettings
            {
                RestrictAccess = model.RestrictAccess
            });

            return(Edit(contentTypePartDefinition, context.Updater));
        }
コード例 #28
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition model, UpdateTypePartEditorContext context)
        {
            if (!string.Equals(nameof(PoiPart), model.PartDefinition.Name))
            {
                return(null);
            }

            var viewModel = new PoiPartSettingsViewModel();

            await context.Updater.TryUpdateModelAsync(viewModel, Prefix,
                                                      m => m.MarkerAdminIcon,
                                                      m => m.MarkerHoverIcon,
                                                      m => m.MarkerIcon,
                                                      m => m.MarkerIconHeight,
                                                      m => m.MarkerIconWidth,
                                                      m => m.MarkerIconZoomRatio
                                                      );

            context.Builder.WithSettings(new PoiPartSettings
            {
                MarkerAdminIcon     = viewModel.MarkerAdminIcon,
                MarkerHoverIcon     = viewModel.MarkerHoverIcon,
                MarkerIcon          = viewModel.MarkerIcon,
                MarkerIconHeight    = viewModel.MarkerIconHeight,
                MarkerIconWidth     = viewModel.MarkerIconWidth,
                MarkerIconZoomRatio = viewModel.MarkerIconZoomRatio
            });

            return(Edit(model, context.Updater));
        }
コード例 #29
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (!String.Equals(nameof(DependencyTreePart), contentTypePartDefinition.PartDefinition.Name, StringComparison.Ordinal))
            {
                return(null);
            }

            var model = new DependencyTreePartSettingsViewModel();

            if (await context.Updater.TryUpdateModelAsync(model, Prefix, m => m.Strategy))
            {
                context.Builder.WithSettings(new DependencyTreePartSettings {
                    Strategy = model.Strategy
                });
            }

            return(Edit(contentTypePartDefinition, context.Updater));
        }
コード例 #30
0
        public Task<dynamic> UpdateTypePartEditorAsync(ContentTypePartDefinition contentTypePartDefinition, IUpdateModel updater, string groupId = "")
        {
            if (contentTypePartDefinition == null)
            {
                throw new ArgumentNullException(nameof(contentTypePartDefinition));
            }

            dynamic typePartDefinitionShape = CreateContentShape("ContentTypePartDefinition_Edit");

            _contentDefinitionManager.AlterTypeDefinition(contentTypePartDefinition.ContentTypeDefinition.Name, typeBuilder =>
            {

                typeBuilder.WithPart(contentTypePartDefinition.Name, async typePartBuilder =>
                {
                    typePartDefinitionShape.ContentPart = contentTypePartDefinition;

                    var partContext = new UpdateTypePartEditorContext(
                        typePartBuilder,
                        typePartDefinitionShape,
                        groupId,
                        _shapeFactory,
                        _layoutAccessor.GetLayout(),
                        updater
                    );

                    await BindPlacementAsync(partContext);

                    await _handlers.InvokeAsync(handler => handler.UpdateTypePartEditorAsync(contentTypePartDefinition, partContext), Logger);
                });

            });

            return Task.FromResult<dynamic>(typePartDefinitionShape);
        }
コード例 #31
0
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (!String.Equals("ListPart", contentTypePartDefinition.PartDefinition.Name, StringComparison.Ordinal))
            {
                return(null);
            }

            var model = new ListPartSettings();

            await context.Updater.TryUpdateModelAsync(model, Prefix);

            context.Builder.ContainedContentType(model.ContainedContentType);

            return(Edit(contentTypePartDefinition, context.Updater));
        }
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            var model = new SubscriptionLevelPartSettings();

            await context.Updater.TryUpdateModelAsync(model, Prefix, m => m.Hint, m => m.Multiple);

            context.Builder.WithSettings(model);

            return(Edit(contentTypePartDefinition, context.Updater));
        }
        public override async Task <IDisplayResult> UpdateAsync(ContentTypePartDefinition contentTypePartDefinition, UpdateTypePartEditorContext context)
        {
            if (!String.Equals(nameof(PricePart), contentTypePartDefinition.PartDefinition.Name))
            {
                return(null);
            }

            var model = new PricePartSettingsViewModel();

            await context.Updater.TryUpdateModelAsync(model, Prefix,
                                                      m => m.CurrencySelectionMode,
                                                      m => m.SpecificCurrencyIsoCode);

            context.Builder.WithSettings(new PricePartSettings
            {
                CurrencySelectionMode   = model.CurrencySelectionMode,
                SpecificCurrencyIsoCode =
                    model.CurrencySelectionMode == CurrencySelectionModeEnum.SpecificCurrency
                        ? model.SpecificCurrencyIsoCode : null
            });

            return(Edit(contentTypePartDefinition, context.Updater));
        }