public void Start() { foreach (ItemDefinition definition in definitions.GetDefinitions()) { if (typeof(ISyndicatable).IsAssignableFrom(definition.ItemType)) { EditableCheckBoxAttribute ecb = new EditableCheckBoxAttribute(CheckBoxText, 10); ecb.Name = SyndicatableDetailName; ecb.ContainerName = ContainerName; ecb.SortOrder = SortOrder; definition.Add(ecb); } } }
public void Start() { foreach (ItemDefinition definition in _definitionManager.GetDefinitions()) { if (typeof(ModelBase).IsAssignableFrom(definition.ItemType) && !definition.IsPage) { var ecb = new EditableCheckBoxAttribute { Title = "", CheckBoxText = "Wrap with container", Name = "UseContainer", DefaultValue = true, ContainerName = Defaults.Containers.Metadata }; definition.Add(ecb); } } }
private ContentRegistration RegisterPart(PartDefinitionPage pd) { var def = DefinitionMap.Instance.GetOrCreateDefinition(typeof(ContentPart), pd.Title); // no extensions // registration - compare Dinamico views @{ Content.Define(re => ... ) } var re = new ContentRegistration(def) { Definition = { TemplateKey = pd.Name, Description = pd.Description }, Context = { GlobalSortOffset = pd.PartSortOrder }, ContentType = def.ItemType, Title = pd.Title, IconUrl = pd.IconUrl }; //if (!string.IsNullOrEmpty(pd.Definition)) //{ // var jsd = new JavaScriptRegistration(); // jsd.Eval(re, pd.Definition); //} foreach (var attrDef in pd.Attributes) { AbstractEditableAttribute attr = null; var name = RemoveSpecialCharacters(attrDef.Title); switch (attrDef.PartType) { case PartDefinitionPage.AttributePart.AttributePartTypeEnum.RichText: attr = new EditableTextAttribute { TextMode = TextBoxMode.MultiLine, Name = name, Title = attrDef.Title }; break; case PartDefinitionPage.AttributePart.AttributePartTypeEnum.Number: attr = new EditableNumberAttribute { Name = name, Title = attrDef.Title }; break; case PartDefinitionPage.AttributePart.AttributePartTypeEnum.CheckBox: attr = new EditableCheckBoxAttribute { Name = name, Title = attrDef.Title }; break; case PartDefinitionPage.AttributePart.AttributePartTypeEnum.Url: attr = new EditableUrlAttribute { Name = name, Title = attrDef.Title }; break; case PartDefinitionPage.AttributePart.AttributePartTypeEnum.Image: attr = new EditableImageAttribute { Name = name, Title = attrDef.Title }; break; #if TODO // use a better mechanism to find available types/attrs case PartDefinitionPage.AttributePart.AttributePartTypeEnum.Category: attr = new EditableCategorySelectionAttribute("ID:" + name) { Name = name, Title = attrDef.Title }; break; case PartDefinitionPage.AttributePart.AttributePartTypeEnum.Product: attr = new EditableProductMultiSelectionAttribute("Id:" + name) { Name = name, Title = attrDef.Title }; break; #endif case PartDefinitionPage.AttributePart.AttributePartTypeEnum.Text: default: attr = new EditableTextAttribute { TextMode = TextBoxMode.SingleLine, Name = name, Title = attrDef.Title }; break; //throw new ArgumentOutOfRangeException(); } if (!string.IsNullOrEmpty(attrDef.DefaultValue)) { attr.DefaultValue = attrDef.DefaultValue; } attr.HelpText = attrDef.HelpText; re.Add(attr); } re.IsDefined = true; re.Finalize(); return(re); }