public IFieldStorage BindStorage(ContentPart contentPart, ContentPartFieldDefinition partFieldDefinition)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 2
0
        public void ApplySortCriterion(SortCriterionContext context, IFieldTypeEditor fieldTypeEditor, string storageName, Type storageType, ContentPartDefinition part, ContentPartFieldDefinition field)
        {
            bool ascending    = Convert.ToBoolean(context.State.Sort);
            var  propertyName = String.Join(".", part.Name, field.Name, storageName ?? "");

            // use an alias with the join so that two filters on the same Field Type wont collide
            var relationship = fieldTypeEditor.GetFilterRelationship(propertyName.ToSafeName());

            // generate the predicate based on the editor which has been used
            Action <IHqlExpressionFactory> predicate = y => y.Eq("PropertyName", propertyName);

            // combines the predicate with a filter on the specific property name of the storage, as implemented in FieldIndexService

            // apply where clause
            context.Query = context.Query.Where(relationship, predicate);

            // apply sort
            context.Query = ascending
                ? context.Query.OrderBy(relationship, x => x.Asc("Value"))
                : context.Query.OrderBy(relationship, x => x.Desc("Value"));
        }
Exemplo n.º 3
0
        public LocalizedString DisplaySortCriterion(SortCriterionContext context, ContentPartDefinition part, ContentPartFieldDefinition fieldDefinition)
        {
            bool ascending = Convert.ToBoolean(context.State.Sort);

            return(ascending
                       ? T("Ordered by field {0}, ascending", fieldDefinition.Name)
                       : T("Ordered by field {0}, descending", fieldDefinition.Name));
        }
 private void Apply(ContentPartFieldDefinition model, ContentPartFieldDefinitionRecord record)
 {
     record.Settings = model.Settings;
 }
 public override IDisplayResult Edit(ContentPartFieldDefinition partFieldDefinition)
 {
     return(Shape <BooleanFieldSettings>("BooleanFieldSettings_Edit", model => partFieldDefinition.Settings.Populate(model))
            .Location("Content"));
 }
Exemplo n.º 6
0
        async Task <IDisplayResult> IContentFieldDisplayDriver.UpdateEditorAsync(ContentPart contentPart, ContentPartFieldDefinition partFieldDefinition, ContentTypePartDefinition typePartDefinition, UpdateEditorContext context)
        {
            if (!string.Equals(typeof(TField).Name, partFieldDefinition.FieldDefinition.Name) &&
                !string.Equals(nameof(ContentField), partFieldDefinition.FieldDefinition.Name))
            {
                return(null);
            }

            var field = contentPart.GetOrCreate <TField>(partFieldDefinition.Name);

            Prefix = typePartDefinition.Name + "." + partFieldDefinition.Name;

            if (!String.IsNullOrEmpty(context.HtmlFieldPrefix))
            {
                Prefix = context.HtmlFieldPrefix + "." + Prefix;
            }

            var updateFieldEditorContext = new UpdateFieldEditorContext(contentPart, typePartDefinition, partFieldDefinition, context);

            var result = await UpdateAsync(field, context.Updater, updateFieldEditorContext);

            if (result == null)
            {
                return(null);
            }

            contentPart.Apply(partFieldDefinition.Name, field);

            return(result);
        }
Exemplo n.º 7
0
        Task <IDisplayResult> IContentFieldDisplayDriver.BuildEditorAsync(ContentPart contentPart, ContentPartFieldDefinition partFieldDefinition, ContentTypePartDefinition typePartDefinition, BuildEditorContext context)
        {
            if (!string.Equals(typeof(TField).Name, partFieldDefinition.FieldDefinition.Name) &&
                !string.Equals(nameof(ContentField), partFieldDefinition.FieldDefinition.Name))
            {
                return(Task.FromResult(default(IDisplayResult)));
            }

            var field = contentPart.GetOrCreate <TField>(partFieldDefinition.Name);

            Prefix = typePartDefinition.Name + "." + partFieldDefinition.Name;

            if (!String.IsNullOrEmpty(context.HtmlFieldPrefix))
            {
                Prefix = context.HtmlFieldPrefix + "." + Prefix;
            }

            var fieldEditorContext = new BuildFieldEditorContext(contentPart, typePartDefinition, partFieldDefinition, context);

            return(EditAsync(field, fieldEditorContext));
        }
Exemplo n.º 8
0
 public override IDisplayResult Edit(ContentPartFieldDefinition partFieldDefinition)
 {
     return(Initialize <ContentAppInstanceFieldSettings>("ContentAppInstanceFieldSettings_Edit", model => partFieldDefinition.Settings.Populate(model))
            .Location("Content"));
 }
 public override IDisplayResult Edit(ContentPartFieldDefinition partFieldDefinition)
 {
     return(Initialize <NumericFieldSettings>("NumericFieldSettings_Edit", model => partFieldDefinition.PopulateSettings(model))
            .Location("Content"));
 }
Exemplo n.º 10
0
 public virtual IEnumerable <TemplateViewModel> PartFieldEditor(ContentPartFieldDefinition definition)
 {
     return(Enumerable.Empty <TemplateViewModel>());
 }