kgiszewski / uwestfest Goto Github PK
View Code? Open in Web Editor NEWSlides and Code from our uWestFest talk on Property Editors
Slides and Code from our uWestFest talk on Property Editors
It seems extenals urls are not always saved - mainly when model.value
is empty.
I wrote this for Nested Content and should be able to port over https://github.com/leekelleher/umbraco-nested-content/blob/develop/build/install.ps1
Data saved in 0.14 or before is like this:
{
"type": "content",
"meta": {
"title": "",
"newWindow": false
},
"typeData": {
"url": "",
"contentId": 1395,
"mediaId": null
}
}
0.15 and beyond expects:
[
{
"type": "content",
"meta": {
"title": "",
"newWindow": false
},
"typeData": {
"url": "",
"contentId": 1395,
"mediaId": null
}
}
]
This causes the Umbraco UI to go very wrong...
Gruntfile.js contains debug configuration for the dist msbuild. Will post a pull request soon with a fix.
It would be nice if the user could pick not only content, but also an anchor in this content. I've got a quick solution with a text input for the anchor if the user wants to insert it. Will create a pull request.
The placeholder for the URL picker suggests that www
is a valid input, however the PVC creates a relative link.
Everything was working fine with ModelsBuilder, but now something changed with multiple urls and the PropertyValueConverter broke.
ModelsBuilder generates the following:
[ImplementPropertyType("link")]
public UrlPicker.Umbraco.Models.UrlPicker Link
{
get { return this.GetPropertyValue<UrlPicker.Umbraco.Models.UrlPicker>("link"); }
}
This should be:
this.GetPropertyValue<List<UrlPicker.Umbraco.Models.UrlPicker>>("link")
because of the change.
When I enable 'Media preview' and haven't selected anything yet, I get a JS error:
Cannot read property 'mediaId' of undefined
This is with version 0.14.1 via NuGet and Umbraco 7.3.7.
When media has been selected a null object is returned. URL and content fine.
All worked fine with:
Following upgrade to:
Url and Content fine, but media selection always returns null.
Reverting to UrlPicker v0.12.0
seemed to fix the problem. Upgrade to UrlPicker v 0.13.0
introduced the issue, so I guess there is a breaking change in that release?
Issue first reported at: https://our.umbraco.org/projects/backoffice-extensions/urlpicker/issues/71426-urlpicker-failing-for-selecting-media
Umbraco use the $dirty (ng-dirty) property on the form in property editors to check if they should display the "warning message" for unsaved content.
This is set for the url (unless when you enter some spaces). However when you choose content/media it doesn't set the $dirty property on the form.
Sometimes you might need to set the property manually using $setDirty() .. I have done it this way inspired by some of the core property editors: bjarnef/Switcher@cc26ca9
Being added as content instead of to the lib
folder, so the reference doesn't get added automatically
Then @using won't be needed in Views
@kgiszewski are you happy for me to hook this up?
Might be nice to allow admins to select a default type in the PreValues. I think in most cases I'd like to have Content as the default to encourage editors to use that over a URL.
I might have missed something but I cannot seem to get the newWindow property to work.
How should I call it in something like:
@foreach (var call in action) {
var link = call.GetValue<UrlPicker.Umbraco.Models.UrlPicker>("urlPicker");
if(link != null && !string.IsNullOrWhiteSpace(link.Name)) {
<a href="@link.Url" class="btn" target="???" title="@link.Name">@link.Name</a>
}
I have tried @link.Target and @link.NewWindow and after a quick look through the source I cannot see what it could be any assistance would be very welcome thanks.
Firstly, great package. We've used it on a few projects and it matches the style of the original uComponents url picker nicely.
Appreciate that this was mainly intended for uWestFest as the repo name suggests, but since then it has become the source for UrlPicker which has been released as package and gained some use. Perhaps a rename of the repo would now be a good idea?
Thanks!
There is already some confusion as while the .net is built against v7.1.5 I believe the dictionary keys require v7.2.8.
I would recommend we update to have dependency of v7.3.8, anyone have a different view?
The use of the data type service in the updated property converter adds a small but noticable delay in resolving any properties. Locally we're seeing a 60-80ms delay on using it. We've used the URL Picker for a navigation builder for this particular site and when you output 15+ URLs into the navigation this builds into a significant time. Is there a way to detect the requested type from within the property converter as this would likely be much quicker?
Or would a static cache of property to type that could be created at boot up be a better approach?
I don't mind doing the leg work but would appreciate input on best approach.
I have an Umbraco install that serves 3 domains with the following site structure:
DOMAIN-1.COM + Page_D1-1 + Page_D1-1.1
|
+ Page_D1-2 + DOMAIN-2.COM + Page_D2-1
| | |
| | + Page_D2-2
| |
| + DOMAIN-3.COM + Page_D3-1
| |
| + Page_D3-2
|
+ Page_D1-3
|
+ Page_D1-4
DOMAIN-2.COM
and DOMAIN-3.COM
have their hostnames set on the Umbraco node, whilst DOMAIN-1.COM
doesn't.
I have a UrlPicker data-type sat on Page_D3-1
with 'Content' links to Page_D1-1
, Page_D2-1
and Page_D3-2
. Inspection of the UrlPicker.Umbraco.Models.Url
property for these links reveals the following information:
Page_D1-1.Url = /Page_D1-1/
Page_D2-1.Url = http://DOMAIN-2.COM/Page_D2-1.Url/
Page_D3-2.Url = http://DOMAIN-3.COM/Page_D3-2.Url/
Links Page_D2-1.Url
and Page_D3-2.Url
work as expected, but because Page_D1-1.Url
is a relative URL its target from Page_D3-1
is http://DOMAIN-3.COM/Page_D1-1/
and not http://DOMAIN-1.COM/Page_D1-1/
I might expect. The page http://DOMAIN-3.COM/Page_D1-1/
does not exist, so visitors get a 404 error when visiting this page.
This errent behaviour is similar to if I had used IPublishedContent.Url
from this page instead of IPublishedContent.UrlAbsolute()
.
The addition of an UrlAbsolute()
method on the UrlPicker.Umbraco.Models.UrlPicker
class that respects the change of domain when climbing the content tree would be great.
Cheers,
Chris
Umbraco 7.2.4
UrlPicker (NuGet) 0.12.0
Steps to reproduce:
Expected Results:
No errors are logged.
Actual Results:
Deserialisation errors are logged.
Cause:
When the data is saved it has the value:
[
{
"type": null,
"meta": {
"title": "",
"newWindow": false
},
"typeData": {
"url": "",
"contentId": null,
"mediaId": null
},
"disabled": false
}
]
This is because the data type is only allowing a single value and doesn't start with an add button, so one record exists in the array. Because of this record it attempts to deserialise into the model but throws an exception within Newtonsoft because the type can't be deserialised as it is not a nullable field.
Workaround:
Enable the start with add button will prevent this one, broken, record data being created.
@xorcery Can you add me to this repo as well? I have a pull request that I've reviewed but I can't push to the repo.
Thanks.
Unfortunately, this control does not honor Umbarco's "Mandatory" setting for properties. This causes grief for the developer who uses the control, because I have to perform a "check" to ensure that I get Umbraco to render a URL without a YSOD due to having an empty TypeData.Url, or .ContentId, or .MediaId.
I am seeing this intermittently...the worst kind of bug.
Changes to the value of the UrlPicker are not always saved. I can set the value initially to any of the three types and Save/Publishing successfully. But if I try to make an edit, the original value persists...sometimes. I'm getting inconsistent test results. Maybe it doesn't matter whether I'm adding or editing. I've tested 100 times and I still can't draw a clear conclusion so wanted to pass it along.
When you click "select" in content/media tab you are able to open multiple dialogs on top of each other. I think you could check for current instances and close any open dialogs before opening a new one, something like this: https://github.com/umbraco/Umbraco-CMS/pull/633/files
The media dialog should be consistent with the Umbraco core media dialog - here it is missing the upload button.
Furthermore you can't use drag and drop of file to the dialog panel like with media picker.
I think in this line https://github.com/imulus/uWestFest/blob/develop/urlpicker/app/scripts/controllers/url.picker.controller.js#L22 it is fine to use treepicker when selecting content (or as default) .. or maybe content or linkpicker? http://umbraco.github.io/Belle/#/api/umbraco.services.dialogService
But when choosing "Media" it should use mediaPicker.
I think treePicker only render tree nodes and with the search filter.. but for media it would be much nicer with the previews for media items.. and it also make it possible to use the onlyImages parameter :)
At the same time maybe fix issue #18
How do I output in Razor?
If I want to use the class UrlPicker inside my own code, I get the following error:
CS0118 'UrlPicker' is a namespace but is used like a type
This is obvious, but really annoying. Renaming the class would be a breaking change, but how about adding a IUrlPicker interface for the model, so we can use the interface without a problem?
If a user only has access to a restricted section of the media tree, should the dialog treepicker not only show that? In the case of no other manual config restrictions anyway.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.