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

Allow querystring parameters to set IsElementType checkbox on create document type route #6779

Conversation

marcemarc
Copy link
Contributor

@marcemarc marcemarc commented Oct 19, 2019

Prerequisites

  • [ + ] I have added steps to test this contribution in the description below

Relates to issue #6410

Description

Some of the cool Umbraco folk I know were chatting around the issue #6410 which is essentially is 'all about' adding to the Create Document Type options, a super fast way to create an Element Type, instead of having to create first a Document Type Without Template, and then remember to manually check the Is An Element Type checkbox on the permissions tab...

... why can't they just have a new option to do that on that menu ... speed up everyone's daily workflow...

image

... well there are concerns on how to present these options, in a way that doesn't confuse people new to Umbraco (what is a Document Type Collection anyway? etc)... which will involve some due consideration and perhaps an RFC...

... anyway in the meantime, devs are pulling their hair out, everyday, right click create, document type without template, permissions check is an element type and they are getting frustrated, and well I don't know just how far this is going to escalate...

So this PR doesn't address the menu, or adding that in... there is a whole lot of discussion required first - so what does it do? and why am I proposing it?

This PR, updates the DocumentTypes edit.controller.js to look on the querystring for two new parameters

iselement
&
culturevary

if these parameters are set to true on the querystring, then the checkbox toggle for 'Is an Element Type' and 'Allow varying by culture' will by default be also set to true.

image

image

image

This changes nothing for day to day creating of Document Types! - nothing is visible to anyone via the menu, shhhsshsh nobody needs to know this change has happened... just merge it in... nobody will know...

... but what it enables is a cool kid package developer to experiment with the options for this menu... to allow a 'power tools' document type options plugin to be created - that can perhaps enable evolution in the realm of the package sphere to identify and test the long term improvements required to be made to this menu in the core product... in the short term, devs can have a boost to their productivity, whilst buying some time for the longer term considerations...

…' the default checkboxes for either Is an element type or Allow varying by culture
@poornimanayar
Copy link
Contributor

Hey @marcemarc ,

Thank you for the PR. We shall review it and get back to you if anything more is needed.

Poornima

Copy link
Contributor

@abjerner abjerner left a comment

Choose a reason for hiding this comment

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

Hi @marcemarc,

This works like a charm - definitely something I could use my self 👍 😍

Anyways, while testing this I spotted that it's possible to noTemplate via the model passed to the editor service:

https://github.com/umbraco/Umbraco-CMS/blob/dd18f6a7991cbe077b60eafa284e033334f15849/src/Umbraco.Web.UI.Client/src/views/documenttypes/edit.controller.js#L59,L68

Wouldn't it also make sense to add support for isElement and allowVaryByCulture there as well?

@marcemarc
Copy link
Contributor Author

@abjerner Yes I spotted that too, to be honest, I wasn't sure how the new create Document Type view could be created from the context of an infinite editor? so wasn't quite sure how to test making that change, or whether it made sense.

@abjerner
Copy link
Contributor

@marcemarc it appears that you can call editorService.documentTypeEditor(options):

https://our.umbraco.com/apidocs/v8/ui/#/api/umbraco.services.editorService#methods_documenttypeeditor

But the documentation doesn't really have any more information beyond that the function exists. I'll try to look a bit more into it ;)

@abjerner
Copy link
Contributor

@marcemarc I did some digging, and it seems that a create dialog can be opened by specifying both id and create as:

editorService.documentTypeEditor({
	id: -1,
	create: true,
	noTemplate: true
});

From what I can tell, there is no part of the Umbraco source code that actually opens a document type create dialog like this. But there might be in the future, or a package might use it, so I think adding isElement and allowVaryByCulture makes sense. The create dialog is also the only way I can get passing the noTemplate option to the editor service to make sense.

not sure where this is used, but in theory this might be useful to be wired up too?
@marcemarc
Copy link
Contributor Author

@abjerner thanks for the digging, I couldn't envisage where it would be used... so it's good to know it isn't... less worried about changing it now - so I have pushed a change, that I think would make this possible via the infinite editor, though I'm not sure how best to test ...

update the model properties to follow camelcase, ignoring the existing notemplate that doesn't!!
Copy link
Contributor

@abjerner abjerner left a comment

Choose a reason for hiding this comment

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

@marcemarc thanks again. Should be good to merge now 😉

@nul800sebastiaan nul800sebastiaan merged commit a873c91 into umbraco:v8/dev Oct 31, 2019
@nul800sebastiaan
Copy link
Member

Thanks @marcemarc and @abjerner ! 👍

👀
image
👀

@marcemarc
Copy link
Contributor Author

sorry... @nul800sebastiaan but I think you are expecting me to do something different now each time, and I don't want to disappoint :-P

@nul800sebastiaan
Copy link
Member

😂 I was indeed waiting for that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants