Exemplo n.º 1
0
        public override IEnumerable<TemplateViewModel> TypeEditorUpdate(ContentTypeDefinitionBuilder builder, IUpdateModel updateModel) {
            var model = new ContentTypeSettingsViewModel();
            updateModel.TryUpdateModel(model, "ContentTypeSettingsViewModel", null, null);

            builder.Creatable(model.Creatable);
            builder.Draftable(model.Draftable);
            builder.WithSetting("Stereotype", model.Stereotype);

            yield return DefinitionTemplate(model);
        }
Exemplo n.º 2
0
        public override IEnumerable<TemplateViewModel> TypeEditor(ContentTypeDefinition definition) {
            var settings = definition.Settings.GetModel<ContentTypeSettings>();
            var model = new ContentTypeSettingsViewModel {
                Creatable = settings.Creatable,
                Draftable = settings.Draftable,
            };

            if(definition.Settings.ContainsKey("Stereotype")) {
                model.Stereotype = definition.Settings["Stereotype"] ?? String.Empty;
            }

            yield return DefinitionTemplate(model);
        }
        public override async Task<IDisplayResult> UpdateAsync(ContentTypeDefinition contentTypeDefinition, UpdateTypeEditorContext context)
        {
            var model = new ContentTypeSettingsViewModel();

            if (await context.Updater.TryUpdateModelAsync(model, Prefix))
            {
                context.Builder.Creatable(model.Creatable);
                context.Builder.Listable(model.Listable);
                context.Builder.Draftable(model.Draftable);
                context.Builder.Securable(model.Securable);
                context.Builder.Stereotype(model.Stereotype);
            }

            return Edit(contentTypeDefinition, context.Updater);
        }
Exemplo n.º 4
0
        public override IEnumerable<TemplateViewModel> TypeEditor(ContentTypeDefinition definition)
        {
            var settings = definition.Settings.ToObject<ContentTypeSettings>();
            var model = new ContentTypeSettingsViewModel
            {
                Creatable = settings.Creatable,
                Listable = settings.Listable,
                Draftable = settings.Draftable,
                Securable = settings.Securable,
            };

            model.Stereotype = definition.Settings.Value<string>("Stereotype") ?? "";

            yield return DefinitionTemplate(model);
        }