Copied to clipboard

Flag this post as spam?

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


  • Sean Dooley 289 posts 528 karma points
    Apr 04, 2018 @ 13:32
    Sean Dooley
    0

    Upgrade 0.1.1 to 0.5.0 issues

    In the process of upgrading Umbraco and DocTypeGridEditor but I'm getting an issue with DocTypeGridEditor.

    So far I've upgraded Umbraco from 7.3.8 to 7.4.0 and DocTypeGridEditor from 0.1.1 to 0.5.0. I have the following setup in grid.editors.config.js

    ...
    {
        "name": "Heading",
        "alias": "heading",
        "view": "/App_Plugins/DocTypeGridEditor/Views/doctypegrideditor.html",
        "icon": "icon-coin",
        "render": "/App_Plugins/DocTypeGridEditor/Render/DocTypeGridEditor.cshtml",
        "config": {
            "allowedDocTypes": [
                "Heading",
                "HeadingWithBlock",
                "HeadingWithShortLine",
                "HeadingWithLongLine",
                "HeadingWithThickShortLine",
                "HeadingWithThickLongLine"
            ],
            "enablePreview": false,
            "viewPath": "/Views/Partials/Grid/Editors/Custom/"
        }
    },
    ...
    

    When viewing a grid, I can see Headings that were previously added to a page. When clicking on a Heading to edit its content, the slide-out panel prompts me to choose a content type. Why is this happening?

    Looking at umbraco.config I can see the following

    ...
    {
      "value": {
        "dtgeContentTypeAlias": "Heading",
        "value": {
          "name": "Heading",
          "heading": "Take a tour of our walking nation",
          "headingColour": "000000",
          "size": "378",
          "alignment": ""
        },
        "id": "f91b69a8-25e6-6f7c-99b5-b6d68ca2bfe4"
      },
      "editor": {
        "alias": "heading"
      },
      "active": true
    },
    ...
    

    After selecting a content type, I can see the correct property values. Clicking Save, wipes the rest of the grid content except for the Heading that I just edited. Why is this happening?

    I'd be grateful for any help.

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Apr 04, 2018 @ 13:55
    Lee Kelleher
    0

    Hi Sean,

    I appreciate that it's frustrating. I'm trying to think back to if there was any breaking changes between v0.1.1 and latest, (but it was 3 years ago and I'm getting old!)

    Some people have had issues with cached JS - where you'd need to bump the ClientDependency version number. But if you're upgrading Umbraco too, then that would have changed already - I assume? Hmmm.

    Are there any errors in your browser dev console?

    Thanks,
    - Lee

  • Sean Dooley 289 posts 528 karma points
    Apr 04, 2018 @ 14:04
    Sean Dooley
    0

    Hi Lee

    When I "Save and publish" the page (without editing an existing DocTypeGridEditor), all DocTypeGridEditor components disappear and I get the following error

    angular.min.js?cdv=2:63 TypeError: Cannot read property 'toString' of null
        at isGuid (doctypegrideditor.controllers.js?cdv=2:174)
        at c.<anonymous> (doctypegrideditor.controllers.js?cdv=2:136)
        at d (angular.min.js?cdv=2:28)
        at Object.instantiate (angular.min.js?cdv=2:28)
        at angular.min.js?cdv=2:53
        at angular.min.js?cdv=2:44
        at n (angular.min.js?cdv=2:7)
        at k (angular.min.js?cdv=2:44)
        at e (angular.min.js?cdv=2:40)
        at angular.min.js?cdv=2:39
    
  • Sean Dooley 289 posts 528 karma points
    Apr 04, 2018 @ 14:07
    Sean Dooley
    0

    Looking at umbraco.config aftering "Save and publish", it now looks like

            {
              "value": {
                "value": {
                  "name": "Take a tour of our walking nation",
                  "heading": "Take a tour of our walking nation",
                  "headingColour": "000000",
                  "size": "378",
                  "alignment": "",
                  "lineColour": "a7d500"
                },
                "id": "f91b69a8-25e6-6f7c-99b5-b6d68ca2bfe4",
                "dtgeContentTypeAlias": null
              },
              "editor": {
                "alias": "heading"
              },
              "active": false
            },
    

    Notice that dtgeContentTypeAlias is null?

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Apr 04, 2018 @ 14:39
    Lee Kelleher
    0

    Hi Sean,

    It's getting a bit confusing, I've took a look over the DTGE source code history, the dtgeContentTypeAlias property was introduced in v0.2.0, before that it used one called docType, which contained the GUID of the DocumentType.

    For reference, this commit switched over from GUIDs to Aliases; https://github.com/umco/umbraco-doc-type-grid-editor/commit/cb284a79cb8f7c9d6bb05c0da175718e07a8ebfb

    Am I correct in thinking that you upgraded Umbraco first, then upgraded DTGE? If so, then I think I know what's happened - grab a brew, it's not great news...

    In Umbraco v7.4.0, all the DocumentType GUIDs were "normalized" - (see #U4-7286 and EnsureContentTypeUniqueIdsAreConsistent.cs for the gory details). This meant that ALL Document Type GUIDs changed! and with DTGE v0.1.x using the GUID, this meant all the grid-cell doc-type references couldn't be found. (Which is probably why we switched from GUIDs to Aliases.)

    Ultimately what you'll need to do is this...

    • Rollback to Umbraco v7.3.8 - (you have database backups, right? right? cool!)
    • Upgrade DTGE from v0.1.1 to v0.2.0 (or anywhere up to v0.4.0), as v0.5.0 targets Umbraco v7.4.0 so that's not gonna work for you.
    • Resave all your content nodes ... I don't think an entire site republish will work here, I think the JS needs to run on each page. Sorry, I know this will be a pain point!
    • Once all the content is working, etc. Then you can upgrade Umbraco to v7.4.0+

    Best of luck with it!

    Cheers,
    - Lee

  • Sean Dooley 289 posts 528 karma points
    Apr 04, 2018 @ 15:32
    Sean Dooley
    0

    Thanks Lee! I'll give that a try ... with an extra strong brew.

  • Sean Dooley 289 posts 528 karma points
    Apr 04, 2018 @ 16:15
    Sean Dooley
    0

    Resave all your content nodes ... I don't think an entire site republish will work here, I think the JS needs to run on each page. Sorry, I know this will be a pain point!

    Do you mean re-saving each individual DTGE in a grid on each content node? Or just re-saving the page / content node?

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Apr 04, 2018 @ 16:18
    Lee Kelleher
    0

    It should be enough to re-save the page - as opposed to each cell.

    Looking at the init code, it should handle the guid => alias switch on initial page load.

  • Sean Dooley 289 posts 528 karma points
    Apr 05, 2018 @ 09:30
    Sean Dooley
    0

    I've upgraded DTGE to 0.4.0 and I've come across a slight issue where the wrong partial view is rendering.

    For example, I have the following in gird.editors.config.js

    {
        "name": "Heading",
        "alias": "heading",
        "view": "/App_Plugins/DocTypeGridEditor/Views/doctypegrideditor.html",
        "icon": "icon-coin",
        "render": "/App_Plugins/DocTypeGridEditor/Render/DocTypeGridEditor.cshtml",
        "config": {
            "allowedDocTypes": [
                "Heading",
                "HeadingWithBlock",
                "HeadingWithShortLine",
                "HeadingWithLongLine",
                "HeadingWithThickShortLine",
                "HeadingWithThickLongLine"
            ],
            "enablePreview": false,
            "viewPath": "/Views/Partials/Grid/Editors/Custom/"
        }
    },
    

    And the following in umbraco.config

                {
                  "value": {
                    "dtgeContentTypeAlias": "HeadingWithBlock",
                    "value": {
                      "name": "Heading",
                      "heading": "Take a tour of our walking nation",
                      "lineColour": "a7d500",
                      "headingColour": "000000",
                      "size": "378",
                      "alignment": ""
                    },
                    "id": "e7ce68b1-4439-da2b-76d9-0f1eb6c41990"
                  },
                  "editor": {
                    "alias": "heading"
                  }
                },
    

    Even though it knows which ContentTypeAlias it is, "HeadingWithBlock", the partial view that is being rendered on the front-end is "Heading".

    As a workaround I have implemented the following in Heading.cshtml

    @if (Model.DocumentTypeAlias.ToSafeAlias(true) != "heading")
    {
        @Html.Partial("Grid/Editors/Custom/" + Model.DocumentTypeAlias.ToSafeAlias(true), Model)
    }
    else
    {
    

    Any ideas why this might be happening?

  • Sean Dooley 289 posts 528 karma points
    Apr 11, 2018 @ 13:23
    Sean Dooley
    0

    Hi Lee

    Would this update approach also apply to Nested Content?

    Thanks

    Sean

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Apr 11, 2018 @ 14:09
    Lee Kelleher
    0

    Which version is/was Nested Content on? (I can't recall if there was anything specific with earlier versions.)

  • Sean Dooley 289 posts 528 karma points
    Apr 11, 2018 @ 14:32
    Sean Dooley
    0

    Nested Content is currently on 0.2.0.

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Apr 11, 2018 @ 15:35
    Lee Kelleher
    0

    That should be fine to upgrade. Unless if you tried already and had a problem?

  • Sean Dooley 289 posts 528 karma points
    Apr 11, 2018 @ 15:52
    Sean Dooley
    0

    Thanks Lee.

    I'll give it a go now and see how I get on.

Please Sign in or register to post replies

Write your reply to:

Draft