Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added IsNew and TypePartDefinition to viewmodel #16898

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public override IDisplayResult Edit(BooleanField field, BuildFieldEditorContext
model.Field = field;
model.Part = context.ContentPart;
model.PartFieldDefinition = context.PartFieldDefinition;
model.IsNew = context.IsNew;
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public override IDisplayResult Edit(ContentPickerField field, BuildFieldEditorCo
model.Field = field;
model.Part = context.ContentPart;
model.PartFieldDefinition = context.PartFieldDefinition;

model.IsNew = context.IsNew;
model.SelectedItems = [];
var settings = context.PartFieldDefinition.GetSettings<ContentPickerFieldSettings>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public override IDisplayResult Edit(DateField field, BuildFieldEditorContext con
model.Field = field;
model.Part = context.ContentPart;
model.PartFieldDefinition = context.PartFieldDefinition;
model.IsNew = context.IsNew;
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public override IDisplayResult Edit(DateTimeField field, BuildFieldEditorContext
model.Field = field;
model.Part = context.ContentPart;
model.PartFieldDefinition = context.PartFieldDefinition;
model.IsNew = context.IsNew;
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public override IDisplayResult Edit(HtmlField field, BuildFieldEditorContext con
model.Field = field;
model.Part = context.ContentPart;
model.PartFieldDefinition = context.PartFieldDefinition;
model.IsNew = context.IsNew;
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public override IDisplayResult Edit(LinkField field, BuildFieldEditorContext con
model.Field = field;
model.Part = context.ContentPart;
model.PartFieldDefinition = context.PartFieldDefinition;
model.IsNew = context.IsNew;
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public override IDisplayResult Edit(LocalizationSetContentPickerField field, Bui
model.Field = field;
model.Part = context.ContentPart;
model.PartFieldDefinition = context.PartFieldDefinition;
model.IsNew = context.IsNew;

model.SelectedItems = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public override IDisplayResult Edit(MultiTextField field, BuildFieldEditorContex
model.Field = field;
model.Part = context.ContentPart;
model.PartFieldDefinition = context.PartFieldDefinition;
model.IsNew = context.IsNew;
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public override IDisplayResult Edit(NumericField field, BuildFieldEditorContext
model.Field = field;
model.Part = context.ContentPart;
model.PartFieldDefinition = context.PartFieldDefinition;
model.IsNew = context.IsNew;
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public override IDisplayResult Edit(TextField field, BuildFieldEditorContext con
model.Field = field;
model.Part = context.ContentPart;
model.PartFieldDefinition = context.PartFieldDefinition;
model.IsNew = context.IsNew;
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public override IDisplayResult Edit(TimeField field, BuildFieldEditorContext con
model.Field = field;
model.Part = context.ContentPart;
model.PartFieldDefinition = context.PartFieldDefinition;
model.IsNew = context.IsNew;
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public override IDisplayResult Edit(UserPickerField field, BuildFieldEditorConte
model.Part = context.ContentPart;
model.PartFieldDefinition = context.PartFieldDefinition;
model.TypePartDefinition = context.TypePartDefinition;
model.IsNew = context.IsNew;

if (field.UserIds.Length > 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public override IDisplayResult Edit(YoutubeField field, BuildFieldEditorContext
model.Field = field;
model.Part = context.ContentPart;
model.PartFieldDefinition = context.PartFieldDefinition;
model.IsNew = context.IsNew;
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Microsoft.AspNetCore.Mvc.ModelBinding;
using OrchardCore.ContentFields.Fields;
using OrchardCore.ContentManagement;
using OrchardCore.ContentManagement.Metadata.Models;
Expand All @@ -10,4 +11,6 @@ public class EditBooleanFieldViewModel
public BooleanField Field { get; set; }
public ContentPart Part { get; set; }
public ContentPartFieldDefinition PartFieldDefinition { get; set; }
[BindNever]
public bool IsNew { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ public class EditContentPickerFieldViewModel
public ContentPickerField Field { get; set; }
public ContentPart Part { get; set; }
public ContentPartFieldDefinition PartFieldDefinition { get; set; }

[BindNever]
public bool IsNew { get; set; }
[BindNever]
public IList<VueMultiselectItemViewModel> SelectedItems { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Microsoft.AspNetCore.Mvc.ModelBinding;
using OrchardCore.ContentFields.Fields;
using OrchardCore.ContentManagement;
using OrchardCore.ContentManagement.Metadata.Models;
Expand All @@ -10,4 +11,6 @@ public class EditDateFieldViewModel
public DateField Field { get; set; }
public ContentPart Part { get; set; }
public ContentPartFieldDefinition PartFieldDefinition { get; set; }
[BindNever]
public bool IsNew { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Microsoft.AspNetCore.Mvc.ModelBinding;
using OrchardCore.ContentFields.Fields;
using OrchardCore.ContentManagement;
using OrchardCore.ContentManagement.Metadata.Models;
Expand All @@ -10,4 +11,6 @@ public class EditDateTimeFieldViewModel
public DateTimeField Field { get; set; }
public ContentPart Part { get; set; }
public ContentPartFieldDefinition PartFieldDefinition { get; set; }
[BindNever]
public bool IsNew { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Microsoft.AspNetCore.Mvc.ModelBinding;
using OrchardCore.ContentFields.Fields;
using OrchardCore.ContentManagement;
using OrchardCore.ContentManagement.Metadata.Models;
Expand All @@ -10,4 +11,6 @@ public class EditHtmlFieldViewModel
public HtmlField Field { get; set; }
public ContentPart Part { get; set; }
public ContentPartFieldDefinition PartFieldDefinition { get; set; }
[BindNever]
public bool IsNew { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Microsoft.AspNetCore.Mvc.ModelBinding;
using OrchardCore.ContentFields.Fields;
using OrchardCore.ContentManagement;
using OrchardCore.ContentManagement.Metadata.Models;
Expand All @@ -12,4 +13,6 @@ public class EditLinkFieldViewModel
public LinkField Field { get; set; }
public ContentPart Part { get; set; }
public ContentPartFieldDefinition PartFieldDefinition { get; set; }
[BindNever]
public bool IsNew { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ public class EditLocalizationSetContentPickerFieldViewModel

[BindNever]
public IList<VueMultiselectItemViewModel> SelectedItems { get; set; }

[BindNever]
public bool IsNew { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ public class EditMultiTextFieldViewModel

[BindNever]
public ContentPartFieldDefinition PartFieldDefinition { get; set; }

[BindNever]
public bool IsNew { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Microsoft.AspNetCore.Mvc.ModelBinding;
using OrchardCore.ContentFields.Fields;
using OrchardCore.ContentManagement;
using OrchardCore.ContentManagement.Metadata.Models;
Expand All @@ -10,4 +11,6 @@ public class EditNumericFieldViewModel
public NumericField Field { get; set; }
public ContentPart Part { get; set; }
public ContentPartFieldDefinition PartFieldDefinition { get; set; }
[BindNever]
public bool IsNew { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Microsoft.AspNetCore.Mvc.ModelBinding;
using OrchardCore.ContentFields.Fields;
using OrchardCore.ContentManagement;
using OrchardCore.ContentManagement.Metadata.Models;
Expand All @@ -10,4 +11,6 @@ public class EditTextFieldViewModel
public TextField Field { get; set; }
public ContentPart Part { get; set; }
public ContentPartFieldDefinition PartFieldDefinition { get; set; }
[BindNever]
public bool IsNew { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Microsoft.AspNetCore.Mvc.ModelBinding;
using OrchardCore.ContentFields.Fields;
using OrchardCore.ContentManagement;
using OrchardCore.ContentManagement.Metadata.Models;
Expand All @@ -10,4 +11,6 @@ public class EditTimeFieldViewModel
public TimeField Field { get; set; }
public ContentPart Part { get; set; }
public ContentPartFieldDefinition PartFieldDefinition { get; set; }
[BindNever]
public bool IsNew { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public class EditUserPickerFieldViewModel

[BindNever]
public IList<VueMultiselectUserViewModel> SelectedUsers { get; set; } = [];

[BindNever]
public bool IsNew { get; set; }
}

public class VueMultiselectUserViewModel
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using OrchardCore.ContentFields.Fields;
using OrchardCore.ContentManagement;
using OrchardCore.ContentManagement.Metadata.Models;
Expand All @@ -14,4 +15,6 @@ public class EditYoutubeFieldViewModel
public YoutubeField Field { get; set; }
public ContentPart Part { get; set; }
public ContentPartFieldDefinition PartFieldDefinition { get; set; }
[BindNever]
public bool IsNew { get; set; }
}