Пример #1
0
 /// <summary>
 /// Places a container in the right-hand side of the editing UI.
 /// </summary>
 public static ContainerBuilder <TModel, SidebarContainerAttribute> SidebarContainer <TModel>(this IContentRegistration <TModel> display, string containerName, string headingText, Action <IContentRegistration <TModel> > containerRegistration = null)
 {
     return(display.Register(new SidebarContainerAttribute(containerName, 0)
     {
         HeadingText = headingText
     })
            .Do(containerRegistration));
 }
Пример #2
0
 /// <summary>
 /// Places contained controls in the site editor interface instead of the regular editor
 /// interface. Any recursive containers in the selected page and it's ancestors are displayed.
 /// </summary>
 public static ContainerBuilder <TModel, RecursiveContainerAttribute> RecursiveContainer <TModel>(this IContentRegistration <TModel> display, string containerName, string headingFormat, Action <IContentRegistration <TModel> > containerRegistration = null)
 {
     return(display.Register(new RecursiveContainerAttribute(containerName, 0)
     {
         HeadingFormat = headingFormat
     })
            .Do(containerRegistration));
 }
Пример #3
0
        /// <summary>Registers editors based on the passed conventions, or the defualt conventions</summary>
        /// <param name="registration"></param>
        /// <param name="interceptEditable">An intereption point for editables before they are registered. Another editable or null can be returned.</param>
        /// <param name="configureConventions">Configures conventions before they are used.</param>
        public static void UsingConventions <TModel>(this IContentRegistration <TModel> registration, Func <PropertyDefinition, IEditable, IEditable> interceptEditable = null, Action <RegistrationConventions> configureConventions = null)
        {
            var conventions = registration.DefaultConventions;
            var definition  = registration.Definition;

            if (configureConventions != null)
            {
                configureConventions(conventions);
            }

            foreach (var container in conventions.Containers(definition))
            {
                registration.Register(container);
            }

            foreach (var pd in definition.Properties.Values)
            {
                if (pd.Editable != null)
                {
                    continue;
                }

                var editable = conventions.Editable(pd);
                if (editable != null)
                {
                    editable.Name          = pd.Name;
                    editable.ContainerName = conventions.EditableContainer(pd) ?? editable.ContainerName;

                    if (interceptEditable != null)
                    {
                        editable = interceptEditable(pd, editable);
                    }

                    if (editable != null)
                    {
                        registration.RegisterEditable(editable);
                    }
                }
            }

            conventions.Finalize(definition);
        }
Пример #4
0
        // containers

        /// <summary>
        /// Defines a tab panel that can be used to contain editor controls.
        /// </summary>
        public static ContainerBuilder <TModel, TabContainerAttribute> TabContainer <TModel>(this IContentRegistration <TModel> registration, string containerName, Action <IContentRegistration <TModel> > containerRegistration = null)
        {
            return(registration.Register(new TabContainerAttribute(containerName, containerName, 0))
                   .Do(containerRegistration));
        }
Пример #5
0
 /// <summary>
 /// Organizes editors in a field set that can be expanded to show all details.
 /// </summary>
 public static ContainerBuilder <TModel, ExpandableContainerAttribute> ExpandableContainer <TModel>(this IContentRegistration <TModel> display, string containerName, string legend, Action <IContentRegistration <TModel> > containerRegistration = null)
 {
     return(display.Register(new ExpandableContainerAttribute(containerName, legend ?? containerName, 0))
            .Do(containerRegistration));
 }