Example #1
0
 /// <summary>
 /// An abstract base class that implements editable drop down functionality.
 /// Override and implement GetListItems to use.
 /// </summary>
 public static EditableBuilder <EditableDropDownAttribute> DropDown(this IPropertyRegistration <int> registration, params System.Web.UI.WebControls.ListItem[] listItems)
 {
     return(registration.Registration.RegisterEditable <EditableDropDownAttribute>(new CustomDropDownAttribute()
     {
         Name = registration.PropertyName, Title = registration.PropertyName, ListItems = listItems
     }));
 }
Example #2
0
        /// <summary>
        /// Decorates the content item with a date range editable that will update two date fields.
        /// </summary>
        public static EditableBuilder <WithEditableDateRangeAttribute> DateRange(this IPropertyRegistration <DateTime> registration, Expression <Func <DateTime> > endExpression, string title = "Dates")
        {
            string endExpressionText = System.Web.Mvc.ExpressionHelper.GetExpressionText(endExpression);

            return(registration.Registration.RegisterEditable <WithEditableDateRangeAttribute>(registration.PropertyName, title)
                   .Configure(a => a.NameEndRange = endExpressionText));
        }
Example #3
0
        /// <summary>
        /// Adds a drop down for editing values in an enum attribute.
        /// </summary>
        public static EditableBuilder <EditableEnumAttribute> Enum <TEnum>(this IPropertyRegistration <TEnum> registration, string title = null) where TEnum : struct
        {
            if (!typeof(TEnum).IsEnum)
            {
                throw new ArgumentException("Property " + registration.PropertyName + " of type " + typeof(TEnum) + " cannot be used with Enum registration. Only enum types are allowed");
            }

            return(registration.Registration.RegisterEditable <EditableEnumAttribute>(registration.PropertyName, title)
                   .Configure(e => e.EnumType = typeof(TEnum)));
        }
Example #4
0
 /// <summary>
 /// Defines a deletedChild item editor. Renders a drop down list where you can
 /// select what item to add and edit forms of added items.
 /// </summary>
 public static EditableBuilder <EditableChildrenAttribute> Children <TContent>(this IPropertyRegistration <IEnumerable <TContent> > registration, string title = null) where TContent : ContentItem
 {
     return(registration.Registration.RegisterEditable <EditableChildrenAttribute>(registration.PropertyName, title ?? registration.PropertyName));
 }
Example #5
0
        // displayable

        /// <summary>Specifies the usage of a displayable tokens for rendering this property.</summary>
        public static Builder <DisplayableTokensAttribute> Tokens <TContent>(this IPropertyRegistration <TContent, string> registration) where TContent : ContentItem
        {
            return(registration.Registration.RegisterDisplayable <DisplayableTokensAttribute>(registration.PropertyName));
        }
Example #6
0
 /// <summary>
 /// Adds editing of a number.
 /// </summary>
 public static EditableBuilder <EditableNumberAttribute> Number(this IPropertyRegistration <int> registration, string title = null)
 {
     return(registration.Registration.RegisterEditable <EditableNumberAttribute>(registration.PropertyName, title));
 }
Example #7
0
 /// <summary>
 /// Allows editing tags on an item.
 /// </summary>
 public static EditableBuilder <EditableTagsAttribute> Tags(this IPropertyRegistration <IEnumerable <string> > registration, string title = null)
 {
     return(registration.Registration.RegisterEditable <EditableTagsAttribute>(registration.PropertyName, title));
 }
Example #8
0
 /// <summary>
 /// Extracts a summary text from another detail and stores
 /// </summary>
 public static EditableBuilder <EditableSummaryAttribute> Summary(this IPropertyRegistration <string> registration, string title = null, string source = null)
 {
     return(registration.Registration.RegisterEditable <EditableSummaryAttribute>(registration.PropertyName, title)
            .Configure(e => e.Source = source));
 }
Example #9
0
 /// <summary>
 /// Allows selecting an item of a specific type from a drop down list.
 /// </summary>
 public static EditableBuilder <EditableItemSelectionAttribute> ItemSelection <TContent>(this IPropertyRegistration <TContent> registration, string title = null) where TContent : ContentItem
 {
     return(registration.Registration.RegisterEditable <EditableItemSelectionAttribute>(registration.PropertyName, title)
            .Configure(ee => ee.LinkedType = typeof(TContent)));
 }
Example #10
0
 /// <summary>An editable checkbox attribute. Besides creating a checkbox it also uses the checkbox's text property to display text.</summary>
 public static EditableBuilder <EditableCheckBoxAttribute> CheckBox(this IPropertyRegistration <bool> registration, string checkBoxText = null)
 {
     return(registration.Registration.RegisterEditable <EditableCheckBoxAttribute>(registration.PropertyName, "")
            .Configure(e => e.CheckBoxText = checkBoxText));
 }
Example #11
0
 /// <summary>
 /// Defines an editable link to another item on this site. The item is
 /// selected through a popup window displaying the item tree.
 /// </summary>
 public static EditableBuilder <EditableLinkAttribute> Link <TContent>(this IPropertyRegistration <TContent> registration, string title = null) where TContent : ContentItem
 {
     return(registration.Registration.RegisterEditable <EditableLinkAttribute>(registration.PropertyName, title)
            .Configure(ee => ee.SelectableTypes = new [] { typeof(TContent) }));
 }
Example #12
0
 /// <summary>
 /// An editable drop down with cultures/languages.
 /// </summary>
 public static EditableBuilder <EditableLanguagesDropDownAttribute> Languages(this IPropertyRegistration <string> registration, string title = null)
 {
     return(registration.Registration.RegisterEditable <EditableLanguagesDropDownAttribute>(registration.PropertyName, title));
 }
Example #13
0
 /// <summary>
 /// Defines an editable item. The edited item is referenced by the
 /// property decorated with this attribute. If the property is null a new
 /// item is created and added to the parent items child collection.
 /// </summary>
 public static EditableBuilder <EditableItemAttribute> Item <TContent>(this IPropertyRegistration <TContent> registration, string title = null) where TContent : ContentItem
 {
     return(registration.Registration.RegisterEditable <EditableItemAttribute>(registration.PropertyName, title));
 }
Example #14
0
 /// <summary>
 /// Allows selecting zero or more items from an exapandable check box list.
 /// </summary>
 public static EditableBuilder <EditableMultipleItemSelectionAttribute> MultipleItemSelection <TContent>(this IPropertyRegistration <IEnumerable <TContent> > registration, Func <IEnumerable <ContentItem> > getContentItems) where TContent : ContentItem
 {
     return(registration.Registration.RegisterEditable <EditableMultipleItemSelectionAttribute>(new CustomMultipleItemSelection
     {
         Title = registration.PropertyName,
         Name = registration.PropertyName,
         CustomItemsGetter = () => getContentItems().Select(ci => new System.Web.UI.WebControls.ListItem(ci.Title, ci.ID.ToString()))
     }));
 }
Example #15
0
 /// <summary>
 /// Allows selecting zero or more items of a specific type from an exapandable check box list.
 /// </summary>
 public static EditableBuilder <EditableMultipleItemSelectionAttribute> MultipleItemSelection <TContent>(this IPropertyRegistration <IEnumerable <TContent> > registration, Type excludedType = null) where TContent : ContentItem
 {
     return(registration.Registration.RegisterEditable <EditableMultipleItemSelectionAttribute>(new EditableMultipleItemSelectionAttribute
     {
         LinkedType = typeof(TContent),
         ExcludedType = excludedType ?? typeof(ISystemNode),
         Title = registration.PropertyName,
         Name = registration.PropertyName
     }));
 }
Example #16
0
 /// <summary>
 /// Defines an editable date/time picker control for a content item.
 /// </summary>
 public static EditableBuilder <EditableDateAttribute> Date(this IPropertyRegistration <DateTime> registration, string title = null)
 {
     return(registration.Registration.RegisterEditable <EditableDateAttribute>(registration.PropertyName, title));
 }
Example #17
0
 /// <summary>Attribute used to mark properties as editable. This attribute is predefined to use the <see cref="N2.Web.UI.WebControls.UrlSelector"/> web control as editor/url selector.</summary>
 public static EditableBuilder <EditableUrlAttribute> Url(this IPropertyRegistration <string> registration, string title = null)
 {
     return(registration.Registration.RegisterEditable <EditableUrlAttribute>(registration.PropertyName, title));
 }
Example #18
0
 /// <summary>Attribute used to mark properties as editable. This is used to associate the control used for the editing with the property/detail on the content item whose value we are editing.</summary>
 public static EditableBuilder <EditableUserControlAttribute> UserControl(this IPropertyRegistration registration, string userControlPath, string title = null)
 {
     return(registration.Registration.RegisterEditable <EditableUserControlAttribute>(registration.PropertyName, title)
            .Configure(e => e.UserControlPath = userControlPath));
 }
Example #19
0
 /// <summary>
 /// An abstract base class that implements editable drop down functionality.
 /// Override and implement GetListItems to use.
 /// </summary>
 public static EditableBuilder <EditableDropDownAttribute> DropDown(this IPropertyRegistration <string> registration, params string[] listItems)
 {
     return(registration.DropDown(listItems.Select(li => new System.Web.UI.WebControls.ListItem(li)).ToArray()));
 }
Example #20
0
 /// <summary>
 /// Specifices usage of an <see cref="System.Web.UI.WebControls.TextBox"/> web control as editor for the contents within a html element.</summary>
 /// <example>
 public static EditableBuilder <EditableHtmlElementAttribute> HtmlElement(this IPropertyRegistration <string> registration, string tagName, string title = null)
 {
     return(registration.Registration.RegisterEditable <EditableHtmlElementAttribute>(registration.PropertyName, title)
            .Configure(ehea => ehea.TagName = tagName));
 }