Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bjarne Fyrstenborg 1281 posts 3991 karma points MVP 7x c-trib
    Aug 01, 2014 @ 16:12
    Bjarne Fyrstenborg
    1

    Breaks when no OrderBy value is chosen

    First I think this is a great package :)

    However I found a small bug in the YouTube package v. 1.0.1

    When setting up the datatype you are able to choose how the videos should be sorted. However it's still possible  to save without choosen a OrderBy value. In this case I get an error like this in the console:

    Failed to load resource: the server responded with a status of 400 (Bad Request) http://localhost:56003/umbraco/backoffice/YouTube/YouTubeApi/VideosForChannel

    and the objects orderBy property is null.
    So I think either it should be required to choose an OrderBy value or set a default value in the code.. the last thing is always a good idea, if it's not optional.

    This is how it looks when a choose OrderBy date.

    and when I don't choose an OrderBy value:

    in the case above without videos it also returns an error in the console: TypeError: Cannot read property 'enableMin' of null

    /Bjarne

     

  • Warren Buckley 2106 posts 4836 karma points MVP ∞ admin hq c-trib
    Aug 01, 2014 @ 16:26
    Warren Buckley
    0

    Hi Bjarne, Thanks for spotting that issue. I will make the prevalue required to avoid this issue.

    If you wish to fix this ourself on your install until I get a new version built out and pushed, you can ammend the package.manifest file in the App_Data/YouTube/ folder

         {
            "description": "Select the sort order for display videos",
            "key": "orderBy",
            "label": "Order By",
            "view": "~/App_Plugins/YouTube/views/prevalues/YouTube.orderby.html",
            "validation": [
              {
                 type": "Required"
              }
            ]
          },
    

    Thanks,
    Warren :)

  • Bjarne Fyrstenborg 1281 posts 3991 karma points MVP 7x c-trib
    Aug 01, 2014 @ 16:35
    Bjarne Fyrstenborg
    0

    Hi Warren

    can't you dropdown be populated only with the specific values and not included with the empty/blank value first time (I'm not sure if it's an Umbraco thing as when you save a value, the blank item dissapear - the same happens with the default dropdown in content section, so in Umbraco 7 when first a value is chosen, it doesn't seem to be posible to et it back to empty this you could in Umbraco 4 and 6: http://issues.umbraco.org/issue/U4-4450 )

    But maybe it could be set to date as default?

    /Bjarne

  • Warren Buckley 2106 posts 4836 karma points MVP ∞ admin hq c-trib
    Aug 01, 2014 @ 16:51
    Warren Buckley
    0

    I could but would require some more AngularJS code to explicitly set a sort order item. Did you try the package.manifest change I suggested though?

    Thanks,
    Warren :)

  • Bjarne Fyrstenborg 1281 posts 3991 karma points MVP 7x c-trib
    Aug 01, 2014 @ 18:09
    Bjarne Fyrstenborg
    0

    Hi Warren

    Yes, I modified the package.manifest sort the OrderBy is required.. I also think the Channel should be required:

    "prevalues": {
            "fields": [
              {
                "description": "Enter the Channel to display videos only for that channel",
                "key": "channel",
                "label": "Channel ",
                "view": "~/App_Plugins/YouTube/views/prevalues/YouTube.channelinfo.html",
                "validation": [
                  {
                      "type": "Required"
                  }                        
                ]
              },
              {
                "description": "Select the sort order for display videos",
                "key": "orderBy",
                "label": "Order By",
                "view": "~/App_Plugins/YouTube/views/prevalues/YouTube.orderby.html",
                "validation": [
                  {
                      "type": "Required"
                  }                        
                ]
              },
    ... 

    But I'm not sure if it's these changes, but I now got a issue that I can't pick videos because have have some errors in console about min and max fields can't be null:
    TypeError: Cannot read property 'enableMin' of null

    I tried modified this line var isMinEnabled = $scope.model.config.minmax.enableMin; to 
    var isMinEnabled = $scope.model.config.minmax != null ? $scope.model.config.minmax.enableMin : false; 

    where I then get the error about max:
     TypeError: Cannot read property 'enableMax' of null

    so I also changed this:
    var isMaxEnabled = $scope.model.config.minmax != null ? $scope.model.config.minmax.enableMax : false;

    So with the changes to check for that minmax not is null, I could set Channel and OrderBy to required and still pick the videos.

    /Bjarne

  • Bjarne Fyrstenborg 1281 posts 3991 karma points MVP 7x c-trib
    Aug 01, 2014 @ 18:38
Please Sign in or register to post replies

Write your reply to:

Draft