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

Implement missing forms selectpart and options #7281

Merged
merged 5 commits into from
Oct 26, 2020
Merged

Conversation

deanmarcussen
Copy link
Member

Fixes #3297
Fixes #4094

Similar ui to the predefined text field list settings.

I chose not to do it with SelectListItem and / or optgroup to keep everything simple, and consistent with the rest of the forms module.

Screenshot 2020-10-14 at 15 42 31

@ns8482e
Copy link
Contributor

ns8482e commented Oct 15, 2020

@deanmarcussen I have started working on this too.

Can you add my request here? Support for Type, placeholder and optgroup?

e.g. type being Dropdown list, radio list, List box, checkbox list?

@deanmarcussen
Copy link
Member Author

Can you add my request here? Support for Type, placeholder and optgroup?

e.g. type being Dropdown list, radio list, List box, checkbox list?

I thought about those, but I saw this as a SelectPart and would see a radio group as a different part.

Maybe not?

it could be extended for optgroup, but I had to do this for a client, and wanted to keep it simple, so thought I'd push it up after.

Feel free to take over the pr, I am short of time to do anything much more to it

@ns8482e
Copy link
Contributor

ns8482e commented Oct 15, 2020

@deanmarcussen No worries, I can add my PR on top of your feature.

I thought about those, but I saw this as a SelectPart and would see a radio group as a different part.

Maybe not?

Technically if we map SelectPart to <select> tag than it seems different. But when we look at from functional side - it seems same for form designer perspective as he could change display seamlessly for single select - from dropdown to radio list and for multi select listbox to checkbox list without reworking on form design for same data -

@deanmarcussen
Copy link
Member Author

Technically if we map SelectPart to <select> tag than it seems different.

Yes, I essentially agree, but currently the form part's are matched to a tag type.

i.e. the input part supports radio buttons etc.

Hence why I felt we should probably continue that.

Otherwise we're changing our minds partway through, and they become a strange mix.

@deanmarcussen
Copy link
Member Author

Might be worth asking @sfmskywalker what the original design intentions of the forms module was?

@ns8482e
Copy link
Contributor

ns8482e commented Oct 15, 2020

i.e. the input part supports radio buttons etc.

OK, But IMO - using radio/checkbox with input and making list of choices and maintaining ModelState on postback requires some sort of html asp.net knowledge :).

It's kinda too much expectation from non technical form designer.

@ns8482e
Copy link
Contributor

ns8482e commented Oct 15, 2020

@deanmarcussen anyway continue with your PR, I'll create PR for my request.

@jptissot
Copy link
Member

Why not just add a bag of SelectItems / OptGroups ?

@Skrypt
Copy link
Contributor

Skrypt commented Oct 15, 2020

I like that Vue.js component I wonder who did it? 🙈
Just a small comment here. We need to add a margin between those form elements. They all look stacked on top of each others. No clear different margin between a title and the previous elements group. It needs to breathe a little !!!

96149047-c980a500-0f00-11eb-86a0-160fd32b981e

@ns8482e Is there a functional reason why you added this style?

div.form-group {
margin-bottom: 0px !important;
}

See #7292 for fix.

@Skrypt
Copy link
Contributor

Skrypt commented Oct 16, 2020

Yeah it could definitely use a SelectListItem / OptGroups but I believe the Vue.js component doesn't do it for now. We'd need to be able to add OptGroups when we click on the small edit icon and then display a list of those OptGroups as a new column in the Option items. I think it's fine enough for now while we wait on someone to work on adding this on the Vue.js component.

@Skrypt Skrypt self-requested a review October 16, 2020 08:27
Copy link
Contributor

@Skrypt Skrypt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after small fixes

@ns8482e
Copy link
Contributor

ns8482e commented Oct 16, 2020

@ns8482e Is there a functional reason why you added this style?

To reduce white space - when used in smaller columns like 25%, 33%

@jptissot
Copy link
Member

Yeah it could definitely use a SelectListItem / OptGroups but I believe the Vue.js component doesn't do it for now. We'd need to be able to add OptGroups when we click on the small edit icon and then display a list of those OptGroups as a new column in the Option items. I think it's fine enough for now while we wait on someone to work on adding this on the Vue.js component.

But why not simply use Widgets and a bag instead of writing a custom implementation ?

@Skrypt
Copy link
Contributor

Skrypt commented Oct 16, 2020

@jptissot That would be for listing ContentItems right? Then this would be more like a ContentPicker.

@jptissot
Copy link
Member

No, I mean the Select has a Bag (named Options) of SelectItem / SelectOptGroup and you build those as Content Items instead of adding a custom editor for Options.

@Skrypt
Copy link
Contributor

Skrypt commented Oct 16, 2020

Yes a content item picker... in then end what you get is a content item list right?

@deanmarcussen
Copy link
Member Author

why not simply use Widgets and a bag instead of writing a custom implementation ?

Yes, I saw your comment on the issue @jptissot , that you had resolved it that way.

It tends to be the way I build sites as well, bags, bagcontainers, and bagitems, to create lists inside content.
But I tend to think that approach is more appropriate to theme development, not our internal module development.

The reason I didn't for this was because you do end up with content items, which makes the templating more complex, and the part becomes not hard typed.

i.e. you can't just have an array on it, it becomes an array of content items.

As I said, I'm reasonably easy on this pr, I needed it for a client, so figured I'd push it back to OC afterwards.

If you guys think it should be done differently, then I don't mind closing it, but the issues have sat there for a year and a half without anyone doing anything to fix it ;)

@ns8482e
Copy link
Contributor

ns8482e commented Oct 16, 2020

No, I mean the Select has a Bag (named Options) of SelectItem / SelectOptGroup and you build those as Content Items instead of adding a custom editor for Options.

Then it’s kinda data source to SelectPart

@Skrypt
Copy link
Contributor

Skrypt commented Oct 16, 2020

I think we should have both options. These are 2 different option lists which makes sense to have.

@Skrypt
Copy link
Contributor

Skrypt commented Oct 16, 2020

@jptissot Will it break your actual SelectPart because of naming? Maybe we could name this one as SimpleSelectPart and come up with a ContentItemSelectPart later on ...

@ns8482e
Copy link
Contributor

ns8482e commented Oct 16, 2020

@Skrypt SelectPart and Select content type metadata are already defined in Migration

@Skrypt
Copy link
Contributor

Skrypt commented Oct 16, 2020

Ok I understand now why we debate on the implementation.

// Select
_contentDefinitionManager.AlterPartDefinition("SelectPart", part => part
.WithDescription("Provides select field properties."));
_contentDefinitionManager.AlterTypeDefinition("Select", type => type
.WithPart("FormInputElementPart")
.WithPart("FormElementPart")
.WithPart("SelectPart")
.Stereotype("Widget"));

I think we can use the same metadata for every Driver we would implement here?

@ns8482e
Copy link
Contributor

ns8482e commented Oct 16, 2020

I guess yes, you can have multiple drivers contribute in rendering for the same Part.
See CommonPart for example.

@Skrypt
Copy link
Contributor

Skrypt commented Oct 16, 2020

So here what I'm saying is that we should probably decide if that's the name we want to use for the Basic implementation which uses the Vue.js viewcomponent.

@ns8482e
Copy link
Contributor

ns8482e commented Oct 16, 2020

You mean SelectPartDisplayDriver? Seems fine. For future enhancement - functionality can be added within that driver.
Also I guess it doesn't affect any custom modules, if it's using the same name for driver.

@Skrypt
Copy link
Contributor

Skrypt commented Oct 16, 2020

Ok so I'm leaving you decide if this PR needs more work or not. I'm fine with it. Better have something than nothing too.

@agriffard agriffard merged commit 3e1bf0a into dev Oct 26, 2020
@delete-merged-branch delete-merged-branch bot deleted the deanmarcussen/selectpart branch October 26, 2020 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Forms Module - Select Widget not working/complete How can i add options to the SelectPart?
5 participants