Ejemplo n.º 1
0
        // zones

        public static Builder <AvailableZoneAttribute> AvailableZone <TModel>(this IContentRegistration <TModel> registration, string zoneName, string title = null)
        {
            return(registration.RegisterRefiner(new AvailableZoneAttribute(title ?? zoneName, zoneName)));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Class applicable editable attribute that adds text boxes for selecting
 /// published date range.
 /// </summary>
 public static EditableBuilder <WithEditablePublishedRangeAttribute> PublishedRange <T>(this IContentRegistration <T> registration, string title = "Published between")
 {
     return(registration.RegisterEditable <WithEditablePublishedRangeAttribute>("Published", title));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// This attribute replace the children allowed with the types
 /// </summary>
 public static Builder <RestrictChildrenAttribute> RestrictChildren <TModel>(this IContentRegistration <TModel> registration, params Type[] allowedChildTypes)
 {
     return(registration.RegisterRefiner <RestrictChildrenAttribute>(new RestrictChildrenAttribute(allowedChildTypes)));
 }
Ejemplo n.º 4
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));
 }
Ejemplo n.º 5
0
        /// <summary>Begins registration of a property on the content type.</summary>
        /// <typeparam name="TProperty">The property type of the property.</typeparam>
        /// <param name="expression">An expression defining the property, e.g. item =&gt; item.Text</param>
        /// <returns>A property registration object.</returns>
        public static PropertyRegistration <TModel, TProperty> On <TModel, TProperty>(this IContentRegistration <TModel> registration, Expression <Func <TModel, TProperty> > expression)
        {
            string expressionText = System.Web.Mvc.ExpressionHelper.GetExpressionText(expression);

            return(new PropertyRegistration <TModel, TProperty>(registration, expressionText));
        }
Ejemplo n.º 6
0
 public static EditableBuilder <EditableMultipleItemSelectionAttribute> MultipleItemSelection(this IContentRegistration registration, string name, Type linkedType, Type excludedType = null)
 {
     return(registration.RegisterEditable(new EditableMultipleItemSelectionAttribute
     {
         LinkedType = linkedType,
         ExcludedType = excludedType ?? typeof(ISystemNode),
         Title = name,
         Name = name
     }));
 }
Ejemplo n.º 7
0
 /// <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, string tabText, Action <IContentRegistration <TModel> > containerRegistration = null)
 {
     return(registration.Register(new TabContainerAttribute(containerName, tabText ?? containerName, 0))
            .Do(containerRegistration));
 }
Ejemplo n.º 8
0
 public static EditableBuilder <EditableUserControlAttribute> UserControl(this IContentRegistration registration, string name, string userControlPath, string title = null)
 {
     return(registration.RegisterEditable <EditableUserControlAttribute>(name, title)
            .Configure(e => e.UserControlPath = userControlPath));
 }
Ejemplo n.º 9
0
 public static EditableBuilder <EditableSummaryAttribute> Summary(this IContentRegistration registration, string name, string title = null, string source = null)
 {
     return(registration.RegisterEditable <EditableSummaryAttribute>(name, title)
            .Configure(e => e.Source = source));
 }
Ejemplo n.º 10
0
 public static EditableBuilder <EditableLanguagesDropDownAttribute> Languages(this IContentRegistration registration, string name, string title = null)
 {
     return(registration.RegisterEditable <EditableLanguagesDropDownAttribute>(name, title));
 }
Ejemplo n.º 11
0
 public static EditableBuilder <EditableThemeSelectionAttribute> ThemeSelection(this IContentRegistration registration, string name, string title = null)
 {
     return(registration.RegisterEditable <EditableThemeSelectionAttribute>(name, title));
 }
Ejemplo n.º 12
0
 public static EditableBuilder <WithEditableTitleAttribute> Title(this IContentRegistration registration, string title = "Title")
 {
     return(registration.RegisterEditable <WithEditableTitleAttribute>("Title", title));
 }
Ejemplo n.º 13
0
 public static EditableBuilder <EditableFreeTextAreaAttribute> FreeText(this IContentRegistration registration, string name, string title = null)
 {
     return(registration.RegisterEditable <EditableFreeTextAreaAttribute>(name, title));
 }
Ejemplo n.º 14
0
 /// <summary>Specifies the icon to display when selecting new items to create.</summary>
 public static IContentRegistration <TModel> IconClass <TModel>(this IContentRegistration <TModel> registration, string iconClass)
 {
     registration.Definition.IconClass = iconClass;
     return(registration);
 }
Ejemplo n.º 15
0
 public static EditableBuilder <EditableDateAttribute> Date(this IContentRegistration registration, string name, string title = null)
 {
     return(registration.RegisterEditable <EditableDateAttribute>(name, title));
 }
Ejemplo n.º 16
0
 public static Builder <RestrictParentsAttribute> RestrictParents(this IContentRegistration registration, params Type[] allowedParentTypes)
 {
     return(registration.RegisterRefiner(new RestrictParentsAttribute(allowedParentTypes)));
 }
Ejemplo n.º 17
0
 public static EditableBuilder <EditableEnumAttribute> Enum(this IContentRegistration registration, string name, Type enumType, string title = null)
 {
     return(registration.RegisterEditable <EditableEnumAttribute>(name, title)
            .Configure(e => e.EnumType = enumType));
 }
Ejemplo n.º 18
0
 public static Builder <RestrictChildrenAttribute> RestrictChildren(this IContentRegistration registration, AllowedTypes allowedTypes)
 {
     return(registration.RegisterRefiner(new RestrictChildrenAttribute(allowedTypes)));
 }
Ejemplo n.º 19
0
 public static EditableBuilder <EditableMultipleItemSelectionAttribute> MultipleItemSelection(this IContentRegistration registration, string name, Func <IEnumerable <ContentItem> > getContentItems)
 {
     return(registration.RegisterEditable <EditableMultipleItemSelectionAttribute>(new CustomMultipleItemSelection
     {
         Title = name,
         Name = name,
         CustomItemsGetter = () => getContentItems().Select(ci => new ListItem(ci.Title, ci.ID.ToString(CultureInfo.InvariantCulture)))
     }));
 }
Ejemplo n.º 20
0
 public static Builder <AllowedZonesAttribute> AllowedZones(this IContentRegistration registration, params string[] zoneNames)
 {
     return(registration.RegisterRefiner(new AllowedZonesAttribute(zoneNames)));
 }
Ejemplo n.º 21
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));
 }
Ejemplo n.º 22
0
 public static EditableBuilder <EditableTagsAttribute> Tags(this IContentRegistration registration, string name)
 {
     return(registration.RegisterEditable <EditableTagsAttribute>(name, name));
 }
Ejemplo n.º 23
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));
 }
Ejemplo n.º 24
0
 public static EditableBuilder <WithEditableDateRangeAttribute> DateRange(this IContentRegistration registration, string nameStart, string nameEnd, string title = "Dates")
 {
     return(registration.RegisterEditable <WithEditableDateRangeAttribute>(nameStart, title)
            .Configure(a => a.NameEndRange = nameEnd));
 }
Ejemplo n.º 25
0
 /// <summary>Class applicable attribute used to add a name editor. The name represents the URL slug for a certain content item.</summary>
 public static EditableBuilder <WithEditableNameAttribute> Name <T>(this IContentRegistration <T> registration, string title = "Name")
 {
     return(registration.RegisterEditable <WithEditableNameAttribute>("Name", title));
 }
Ejemplo n.º 26
0
 public static EditableBuilder <EditableCheckBoxAttribute> CheckBox(this IContentRegistration registration, string name, string checkBoxText = null)
 {
     return(registration.RegisterEditable <EditableCheckBoxAttribute>(name, "")
            .Configure(e => e.CheckBoxText = checkBoxText));
 }
Ejemplo n.º 27
0
        // restrictions

        /// <summary>
        /// A class decoration used to restrict which items may be placed under
        /// which. When this attribute intersects with
        /// <see cref="AllowedChildrenAttribute"/>, the union of these two are
        /// considered to be allowed.</summary>
        public static Builder <RestrictParentsAttribute> RestrictParents <TModel>(this IContentRegistration <TModel> registration, AllowedTypes allowedTypes)
        {
            return(registration.RegisterRefiner <RestrictParentsAttribute>(new RestrictParentsAttribute(allowedTypes)));
        }
Ejemplo n.º 28
0
 public static EditableBuilder <EditableChildrenAttribute> Children(this IContentRegistration registration, string zoneName)
 {
     return(registration.RegisterEditable <EditableChildrenAttribute>(zoneName, zoneName).Configure(eca => eca.ZoneName = zoneName));
 }
Ejemplo n.º 29
0
 /// <summary>Specifies the icon to display when selecting new items to create.</summary>
 public static IContentRegistration <TModel> Icon <TModel>(this IContentRegistration <TModel> registration, string iconUrl)
 {
     registration.Definition.IconUrl = N2.Web.Url.ResolveTokens(iconUrl);
     return(registration);
 }
 public override void RegisterDefinition(IContentRegistration <FluentWebFormPage> register)
 {
     register.Page();
     register.UsingConventions();
     register.Definition.SortOrder = 1000;
 }