umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
Other
4.49k stars 2.69k forks source link

The Insert Value dialog (template editor) is not outputting the correct markup for built in properties #5437

Closed dzordzs closed 3 years ago

dzordzs commented 5 years ago

Updated Report

The issue here is that the Query builder is not outputting the correct values for 'built in' properties like 'pageName' (which is just Model.Name) see https://github.com/umbraco/Umbraco-CMS/issues/5437#issuecomment-490871090

Same issue goes for other built in values like created date, etc...

Original Report

Rendering standard fields using Umbraco Helper does not work.

Steps to reproduce:

And this issue is with all standard field (pageName, CreateDate, level etc) Custom fields are rendered just fine, for example @Model.Value("companyName")

Expected result

If you are rendering @Model.Value("pageName") then you'd expect that Umbraco will return the name of the specific page.

Shazwazza commented 5 years ago

I think this only worked sort of, in v7 because of dynamics

If you want to render the standard fields, these are available on the model as strongly typed properties. I don't think we want to take a step backwards to have non-strongly typed results with magic strings?

dzordzs commented 5 years ago

Strongly typed does work indeed but then I guess we would need to change the output of what Umbraco serves. If you do use the helper then it should automagically output @Model.Name instead of @Model.Value("pageName").

Shazwazza commented 5 years ago

Just a quick note - with this syntax, there is no 'helper' :) this is just @Model is just IPublishedContent, we're just dealing with a model here.

we would need to change the output of what Umbraco serves

What are you referring to here @dzordzs ? The query builder or something? If umbraco is generating this syntax somehow then that's the issue, not the other way around

dzordzs commented 5 years ago

It's the one you can use in the template @Shazwazza Insert -> Value: image

Shazwazza commented 5 years ago

ok, that's the bug then, i'll update the title

electricsheep commented 5 years ago

@Shazwazza I've just been investigating this - as far as I can see, it's not the Query Builder that is outputting incorrect markup, it's the Insert -> Value modal.

It should be a fairly simple fix to output e.g. @Model.Name for standard fields, however there is an extra challenge. Should you still be able add a default value or set a standard field to recursive? These settings rely on @Model.Value() extensions, so I think you would have to come up with a different approach to get these working for standard fields.

aarhusit commented 5 years ago

I'm working on a PR on this issue.

TimGeyssens commented 4 years ago

Still an issue... just test on latest stable v8, all standard settings (so models builders purelive) and the value dialog recommends @Model.Value("createDate")...if you insert that nothing happens... so ideally the insert value dialog should check the modelsbuilder setting and suggest the correct working syntax... since I imagine that for new users that just wanna take a quick spin this is confusing...

TimGeyssens commented 4 years ago

Alos would be ace, if someone with the correct permissions changes this issue to "Insert Value Dialog" instead of "Query Builder"

TimGeyssens commented 4 years ago

Would be nice if @warrenbuckley's work can be used for this https://twitter.com/warrenbuckley/status/1228292889161195520 since the base seems to be there...

umbrabot commented 3 years ago

Hiya @dzordzs,

Just wanted to let you know that we noticed that this issue got a bit stale and might not be relevant any more.

We will close this issue for now but we're happy to open it up again if you think it's still relevant (for example: it's a feature request that's not yet implemented, or it's a bug that's not yet been fixed).

To open it this issue up again, you can write @umbrabot still relevant in a new comment as the first line. It would be super helpful for us if on the next line you could let us know why you think it's still relevant.

For example:

@umbrabot still relevant This bug can still be reproduced in version x.y.z

This will reopen the issue in the next few hours.

Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face: