Giter Club home page Giter Club logo

umbraco-multi-url-picker's People

Contributors

arjanwoldring avatar bjarnef avatar dawoe avatar jeavon avatar leekelleher avatar mattbrailsford avatar myster avatar rasmusjp avatar uniquelau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

umbraco-multi-url-picker's Issues

Links are wrong after being deployed in Umbraco.com

When I deploy some content with a Multi Url Picker in Umbraco.com, the links in ie. staging ends up being wrong.

I think it is because Multi Url Picker stores id's and they can be different from environment to environment.

Is it possible to use GUIDs instead?

Feature Request: File Upload

Would it be possible to add a File Upload option in addition to being able to pick from the media section? I know the picker allows you to upload straight into the media section, but there are cases when you don't want the item available in the media section. You may recall the old uComponents Url Picker had this option.

Thanks!

package.manifest not needed anymore?

With the latest version of the Multi-Url Picker the datatype is broken if I use the NuGet version of the package since that adds a package.manifest file. If I remove it, things start to work again.

If I use the Umbraco package), the package.manifest is not created and everything works fine.

Is the package.manifest file not needed anymore?

Issues on using Multi Url Picker from Archetype

I have posted at archetype forum http://our.umbraco.org/projects/backoffice-extensions/archetype/sound-off!/56104-How-to-get-Multi-Url-Picker-data-from-Archetype

but thought I should ask the Multi Url Picker developer too, if Im missing obvious;
Need some guidance on how to use the Multi Url Picker from Archetype property in a Partial.

I have created a simple Archetype with a textstring and the 'Multi Url Picker' property.

If I try to code sample given in multi url picker page, it gives YSOD with < MultiUrls > does not exist. I did include @using RJP.MultiUrlPicker; at the top of the page but still the same error.

I cant seem to figure out how to make this work seamlessly with Archetype. In a (very) hacky way I can get the values with; (configured multi url picker with min 1 and max 1 links, so just getting 1 link for now)

@using Newtonsoft.Json;

@foreach (var fieldset in Model.Content.GetPropertyValue("slidelinks")) {
var thelinkJSON = fieldset.GetValue("link");

dynamic thelink = JsonConvert.DeserializeObject(thelinkJSON);

  • }

    If someone can shed some light on how to properly use Multi Url Picker with Archetype would greatly appreciate.

    Issues when used inside LeBlender grid editor

    I have tried to use the multi url picker as a link property in a LeBlender grid editor.
    However I can't really make it work with cast to the strongly typed object.

    I have tried with both a Multi Url Picker and Single Url Picker (max items = 1).

    Inside LeBlender grid editor.

    @if (Model.Items != null && Model.Items.Any())
    {
         var item = Model.Items.First();
         
         // both of these return null
         var link1 = item.GetValue<IEnumerable<Link>>("link");
         var link2 = item.GetValue<Link>("link");
    }
    

    If I use LeBlenders GetRawValue method I get the raw json, but when I deserialize this to either IEnumerable<Link> or Link it returns Unexpected character encountered while parsing value: l. Path '', line 0, position 0.

    var link = item.GetRawValue("link") 
    var linkPage = !string.IsNullOrWhiteSpace(link) ? JsonConvert.DeserializeObject<Link>("link") : null;
    

    The raw json value looks like this:

    [ { "id": "1076", "name": "Forside", "udi": "umb://document/48a5922997804cb5929074151348071a", "url": "/", "icon": "icon-home", "published": true } ]
    

    If I re-use the variable from GetRawValue:

    var link = item.GetRawValue("link");
    var linkPage = !string.IsNullOrWhiteSpace(link) ? JsonConvert.DeserializeObject<Link>(link) : null;
    

    then I get this error:

    Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'RJP.MultiUrlPicker.Models.Link' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly. To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array. Path '', line 1, position 1.
    

    Error when many entries in picker

    Hey,

    when introducing many links picked in picker, i see:

    System.Data.SqlClient.SqlException: String or binary data would be truncated.
     The statement has been terminated. 
    

    when publishing page.

    could it be a wrong database field type selected?

    Not registering added link

    Hi @rasmusjp,

    I've found a bug:
    When I set Min number of items and Max number of items to 1 and I try to add a non-content link (just link and page title) I get an error: You need to add at least 0 more item(s).

    I've looked in the code and on line 77 in MultiUrlPicker.js and I've found that $scope.watch is not registering any change when there are 0 items or 1 item (non-content link, which doesn't have an id), since the function assigned to the watchExpression is returning an empty string in both cases.

    I've changed line 77 to:

    //return _.map($scope.renderModel, function ( i ) { return i.id }).join()
    return $scope.renderModel.length;

    and it appears to be working now.

    Great addon btw ๐Ÿ‘

    Editing a media item breaks the link

    Given I have media with ID 3 and path of "/media/123/maidenname.docx"
    Given I have picked media item 3.
    Given I replace the file of media ID 3 I get a path of "/media/124/marriedname.docx"
    When I edit the place where item 3 was picked, and click 'select' again
    Then the link becomes an external link, and the URL used is "/media/123/maidenname.docx"

    Note: If I do not edit/save this picked item then the link remains unbroken since it determines the url from media ID 3 at run-time.

    I consider this a somewhat rare corner case, but it should be noted.

    Aside: I have a thumbnail upload for media of type file... in this case the "Link to document" field shows the thumbnail URL, but the correct URL is shown to the user... in this case when the record is edited and 'select' is clicked without re-picking the media then the links now link to the thumbnail not the PDF, and it is now an 'external' link.

    Note: editing the link (by opening click select) always converts it to an external link regardless of whether the media item has been modified.

    Feature request: Switch to external link

    Hi,

    My client as ask me to pass on a feature request: Can you add an "External link" button next to the "Link to file" button to make the process of adding an external link more explicit?

    Currently, once you've clicked on the content tree you have to close & re-open the dialog to enter an external link.

    Thanks,

    Antony

    Link titles should use the target node name by default

    Given Content or Media named "Maiden Name"
    Given I have picked "Maiden Name" in an RJP picker (using Link to file if Media)
    Given I have not specified a custom page title.
    When I rename "Maiden Name" to "Married Name"
    Then existing links do not update to "Married Name"

    This could be considered a bug.

    If we change the scenario slightly and say:
    Given we specified the page title as "Mum"
    Then keeping "Mum" is a feature (no pun intended) and I would 'not' consider this a bug.

    Ideally both these scenarios could be catered to, and here's how I think it could be done.
    By default picking Content or Media does not fill in the Page Title field, but leaves it blank...
    In order not to confuse the user the placeholder text should change to the picked item's Node Name, in this case "Maiden Name" (perhaps some additional UI hints or text could be provided if this is not clear enough what is happening)
    If the user then over-writes the page title with "Mum" then "Mum" is kept.

    Note: this should work the same way for both Content and Media.

    Only returns first item on startup

    This is a weird one and I haven't been able to narrow it down to anything, but on the initial startup request (after an apppool restart) the picker only returns the first item in the list. On a refresh all items are present. We're on 7.6.5 running in Umbraco Cloud.

    Minor cosmetics

    Hey, thanks a ton for this property editor. The url picker from uComponents was awesome, but as it isn't available for Umbraco 7, this is a great alternative.

    I was thinking about making some minor cosmetic changes and wanted to know what you thought.

    • Hide the move handle when there's only one item. (#8)
    • Align the node icon and name so that when the item is hovered, the underlines meet.
    • Gracefully handle when the recycling bin is chosen (do nothing instead of trying to get the id and throwing an error). (#13)
    • When a url is picked, but no title was entered, show the url in the picker list. (#14)

    Feature request: Usage in macro parameter

    Nice package!
    Would it be possible to add this to as a macro parameter? (I'm using macro's as widgets on a site)
    I've tried to add "isParameterEditor: true" to package.manifest, and so far so good, it does work.
    But when using in a macro container, and a link is selected, the umbraco panel is closed before I'm able to save the macro parameters:

    Step 1:
    skaermbillede 2015-01-09 kl 10 42 35

    Step 2:
    skaermbillede 2015-01-09 kl 10 43 54

    Step 3:
    skaermbillede 2015-01-09 kl 10 44 13

    Thanks!

    Feature request: More logging

    Hi!
    Would it be possible to add more logging to the log entry
    "MultiUrlPicker value converter skipped a link as the node has been upublished/deleted (Id: ###), "
    to include where it was skipped? So we can fix the dead link?

    Cheers for a good tool.

    example with lambda expression?

    i am trying to only loop or get count of content links that have a specific property value... lets say audience. How would i craft a lambda expression to get a count of those only? any help would be great.

    Nuget install fails

    Hi there @rasmusjp. Nice plugin ๐Ÿ‘
    The Nuget install fails to include package.manifest and references to assemblies.

    Courier project needs updating

    When I went to build the courier project with the lates version of courier, the interfsace to courier seems to have changed. In MultiUrlPickerDataResolverProvider.cs change

    link.id = PersistenceManager.Default.GetUniqueId(

    for

    link.id = ExecutionContext.DatabasePersistence.GetUniqueId(

    Can't choose a PDF file from Media

    Hi,
    It looks like in Umbraco 7.1.1 I can't choose a PDF file from the Media folder through your picker.
    Is this something you are looking at?

    Kind regards,
    Iulia

    link type

    Hi,

    I would not consider this an issues, I am just sure there is a better way of doing this.

    I want to be able to tell what I am being passed, External link, internal link or link to a media item. This is what I am using, umbraco 7.1.4 MVC.

    var multiUrlPickerDyn = CurrentPage.tilesLink;
    if (multiUrlPickerDyn.Any())
    {
    var dType = "";
    foreach (var item in multiUrlPickerDyn)
    {
    if (@item.Id != null) {
    if (String.IsNullOrEmpty(Umbraco.Content(@item.Id).DocumentTypeAlias)) {
    var iType = Umbraco.Media(@item.Id).ContentType;
    dType = iType.Alias;
    node = Umbraco.Media(@item.Id);
    } else {
    dType = Umbraco.Content(@item.Id).DocumentTypeAlias;
    node = Umbraco.Content(@item.Id);
    }
    } else {
    dType = "ExternalLink";
    }
    }
    }

    Now I am not the worlds best coder, but this is not exactly pretty even by my standards...

    Is there a better way of doing this? I am hoping you are going say there is something built-in for this. I couldn't find any more detailed docs to see though.

    Your help is much appreciated.

    Loving the datatype though, thanks.

    Stephen

    Issue after install

    Hi,

    I've installed the nuget package and it seems to work fine, I've created the data type but when i try and use as a property I can't add links (The Add link is just an anchor link, i.e. #). From the text on the image below, maybe I'm missing some files?

    image

    Thanks for any help.

    Feature request: Allow only external links

    The internal multi URL picker is already more powerful (restrict by document type and/or content path); so I only want to use this in a case where I definitely know I need external links, and at least some of those cases are external-only (there is a different document type or property for internal).

    Doesn't work on Umbraco Cloud

    Umbraco version: 7.5.13 assembly: 1.0.6309.16496
    Package version: 1.3.2
    screen shot 2017-05-05 at 13 17 46

    The limitations text is visible and when I click "Add" I just end up on the Content dashboard
    I haven't entered any limitations on the datatype.

    null entries in value array

    A customer of ours managed to bring the "value" of the property in a state where it was similar to this:

    value: [
        {id:1234},
        null,
        {id:1234},
    ]
    

    So somehow one of the items in the array was null.

    This cause two things:

    1. The datatype failed, because it tried to access the id property of a null object

    2. The frontend failed because the value converter tried ti access properties on a null json object.

    I have not been able to reproduce how the null got there in the first place, but it would be nice if the two scenarios above where more null tolerant :)

    I fixed the datatype by adding a null check around the building of the renderModel:

    if( $scope.model.value ) {
        _.each($scope.model.value, function( item, i ) {
            if (item !== undefined && item !== null) { //Check for null
                $scope.renderModel.push(new Link(item));
                if( item.id ) {
                    (item.isMedia ? mediaIds : documentIds).push( item.id );
                }
            }
        });
    }
    

    Picked nodes are not resolved when deleted

    When having nodes picked that then are deleted are not resolved like with e.g. MNTP.

    For example I have these links inside Archetype, but the nodes have been deleted.

    image

    When clicking the link (edit) it returns an error, because the node doesn't exists.

    image

    Overly verbose logging of warnings in tracelog

    First, a big thanks for this project - I use it on nearly every site I develop and it's always worked great.

    I only have one tiny issue, and that is that (by default) MultiUrlPicker creates a lot of warnings in the Umbraco trace log when it skips a node that no longer exist. Example from my tracelog file:

    [T164/D2] MultiUrlPicker value converter skipped a link as the node has been upublished/deleted (Id: 2424)

    For a large site the number of log entries can become overwhelming. For instance, I'm looking at one site I built (that has a lot of nodes) and the log file for just one day has over 7,000 instances of this warning being logged.

    Would it be possible to disable warnings or have a way of configuring it so these warning are disabled? I can understand they might be useful for debugging, but for most people they aren't of any use. Thanks!

    "Unable to cast" error with Umbraco 7.4.2 and Archetype

    Trying to use the Multi Url Picker inside an Archetype data type. Here is my Razor code to get the URL:

    var multiUrlPicker = fieldset.GetValue<MultiUrls>("buttonURL");
    if (multiUrlPicker.Any())
    {
        foreach (var item in multiUrlPicker)
        {
            <p><a href="@item.Url" class="btn btn-primary btn-lg">@fieldset.GetValue("buttonText")</a></p>
        }
    }
    

    When I view the page, I get this system error:

    Unable to cast object of type 'Newtonsoft.Json.Linq.JValue' to type 'Newtonsoft.Json.Linq.JArray'.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidCastException: Unable to cast object of type 'Newtonsoft.Json.Linq.JValue' to type 'Newtonsoft.Json.Linq.JArray'.

    Source Error:

    Line 79: @if (fieldset.HasValue("buttonURL"))
    Line 80: {
    Line 81: var multiUrlPicker = fieldset.GetValue("buttonURL");
    Line 82: if (multiUrlPicker.Any())
    Line 83: {

    Is this something I'm doing wrong, or is it incompatible with 7.4.x?

    Feature Request : Querystring Parameters

    Hi @rasmusjp

    Great package by the way. Umbraco should make your picker as a new standard in the cms. Its absolutely fantastic.

    What would make it even more awesome is a single box for querystring parameters to add onto the url, wether its an external or internal link. This allows for flexibility. Maybe a add parameter button which allows you to add multiple key pair values

    7.03 doesn't work

    I installed package, but can't make it work, when creating new DataType, not on the list, cleared cache, tried different browsers, could you help?

    Limited to 100 items?

    Currently using this and we now get an "undefined" error in Umbraco when a user tries to save a page where a MultiUrlPicker has more than 100 items.

    Remove links without a template ?

    Would it be possible to remove nodes from the tree, that doesn't have a template attached ?
    It could just be a checkbox when configuring the datatype. (Hide nodes without a template true/false)

    String or binary data would be truncated.

    Hi,

    I hit this error when adding more than 9 links to a picker.

    I think the json property data is being saved in the dataNvarchar column which has a max length of 500 chars. The RTE for example saves its content in the dataNtext column of cmsPropertyData which is unbounded.

    I'll have a poke about and see how to save the data in the other column from angular

    Capitalisation of properties

    On my server version of a project the following code works:

    foreach (var item2 in multiUrlPicker)
    {
    @item2.Name

                        }
    

    However on my local version I can only retrieve properties with lower case, e.g.

        <a href="@item2.url" target="@item2.target" class="btn-default btn-paly">@item2.name</a>
    

    Using Umbraco 7.2.6.

    Media Items should also save ID

    Media items should also save their ID into the JSON data in the same way as content.
    Without this the data could be stale as the media items could have a new upload with a new file name or even deleted and there is no way to check.

    New data types with max number of items set to 1 will return a single Link or null

    In the changelog, i read "New data types with max number of items set to 1 will return a single Link or null.
    Existing data types will continue to return IEnumerable."

    How can I use the "New data type", instead of the "Existing data type"? I see no difference in the DataType property editor naming (this is Multi Url Picker).
    Or should I read Existing vs New as when document types already have a Multi Url Picker property defined vs when one is newly added?

    Recommend Projects

    • React photo React

      A declarative, efficient, and flexible JavaScript library for building user interfaces.

    • Vue.js photo Vue.js

      ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

    • Typescript photo Typescript

      TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    • TensorFlow photo TensorFlow

      An Open Source Machine Learning Framework for Everyone

    • Django photo Django

      The Web framework for perfectionists with deadlines.

    • D3 photo D3

      Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

    Recommend Topics

    • javascript

      JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

    • web

      Some thing interesting about web. New door for the world.

    • server

      A server is a program made to process requests and deliver data to clients.

    • Machine learning

      Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

    • Game

      Some thing interesting about game, make everyone happy.

    Recommend Org

    • Facebook photo Facebook

      We are working to build community through open source technology. NB: members must have two-factor auth.

    • Microsoft photo Microsoft

      Open source projects and samples from Microsoft.

    • Google photo Google

      Google โค๏ธ Open Source for everyone.

    • D3 photo D3

      Data-Driven Documents codes.