Copied to clipboard

Flag this post as spam?

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


  • Craig100 1136 posts 2522 karma points c-trib
    Feb 21, 2016 @ 13:38
    Craig100
    0

    7.4.1 site. Created dataType Vorto-RTE. Want to add it to a mysite-grid dataType as an available editor. Have seen instructions about adding to the Grid Editor list (https://our.umbraco.org/documentation/getting-started/backoffice/property-editors/built-in-property-editors/grid-layout) but need the alias which I can't find.

    Is there no way of selecting in the UI or is it still necessary to modify the JSON file? If so, is the editor's alias available somewhere?

    Thanks,

    Craig

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Feb 22, 2016 @ 07:45
    Jeroen Breuer
    0

    Hello,

    You could try to add a Vorto RTE in the Grid with this package: https://our.umbraco.org/projects/backoffice-extensions/doc-type-grid-editor/

    What you could also do is place the Grid inside Vorto. Something like this: https://twitter.com/j_breuer/status/649284610501812224

    Jeroen

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Feb 29, 2016 @ 16:21
    Jeroen Breuer
    0

    Hello,

    I've also got a video where I explain how the RTE and Vorto can work together: https://www.youtube.com/watch?v=DWjbJiIUQdk

    Jeroen

  • Craig100 1136 posts 2522 karma points c-trib
    Mar 01, 2016 @ 14:43
    Craig100
    0

    Hi Jeroen,

    I watched your video with interest and it all made perfect sense. Then I downloaded the latest version of Vorto (1.5.0) and the generated models and back end code now all looks different. So I have a few nice Vorto UI's but have no idea how to get the data out in the templates.

    I noted your example has at the top:-

    @using Umbraco.Extensions.Models
    @inherits UmbracoTemplatePage
    

    Where as a new template generated by Umbraco 7.4.1 has:-

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.MyPage>
    @using ContentModels = Umbraco.Web.PublishedContentModels;
    

    In the generated model I see a partial class "PageAdmin" and when I try to use it as you show at 9:43 mins in the video by adding the line:-

    var pageAdmin = new Model.Content as PageAdmin;
    

    VS2015 complains that "Namespace Model cannot be found" with a red squiggle under "Model" and "as". It seems to recognise "PageAdmin" as a class.

    I'm sure it's just a slight syntax tweak that I need to do but I don't know how.

    Any advice would be appreciated.

    Thnx

    Craig

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Mar 01, 2016 @ 14:50
    Jeroen Breuer
    0

    Hello,

    Since you've done the following:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.MyPage>
    

    It means Model.Content is already of the type ContentModels.MyPage.

    If PageAdmin is a property on MyPage this should work:

    var pageAdmin = Model.Content.PageAdmin;
    

    Jeroen

  • Craig100 1136 posts 2522 karma points c-trib
    Mar 01, 2016 @ 15:04
    Craig100
    0

    myPage has a generated model, but PageAdmin is another generated model. It's for a docType that consists of a normal true/false and a Vorto Media Picker, which is what I'm trying to get to in the end. myPage has PageAdmin added to it as a composite in the content editor (docType) UI.

    So var pageAdmin = Model.Content.PageAdmin rightly complains that myPage does not contain a definition for PageAdmin.

    Also tried var pageAdmin = ContentModels.PageAdmin; but that complains about PageAdmin being a type and not valid in the given context.

  • Craig100 1136 posts 2522 karma points c-trib
    Mar 01, 2016 @ 15:25
    Craig100
    0

    Moving on slightly.....

    var pageAdmin = PageAdmin.GetBackgroundImage(somethingneedstogohere);
    

    It's what needs to go into "that" (below) that is the issue. It would replace "somethingneedstogohere" above

        /// <summary>Static getter for Background Image</summary>
        public static Our.Umbraco.Vorto.Models.VortoValue GetBackgroundImage(IPageAdmin that) { return that.GetPropertyValue<Our.Umbraco.Vorto.Models.VortoValue>("backgroundImage"); }
    
  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Mar 01, 2016 @ 16:03
    Jeroen Breuer
    0

    Hmm Models Builder and compositions are a bit more complicated because of the interfaces. Maybe you should try it with inherited doctypes first.

  • Craig100 1136 posts 2522 karma points c-trib
    Mar 01, 2016 @ 16:55
    Craig100
    0

    Thanks Jeroen,

    I re-hashed the docTypes to use docType inheritance. Trying to get the backgroundImage url but still not working, I'm missing something. The generated models using the new vorto version don't seem to be like the one's in your excellent demo.

    //------------------------------------------------------------------------------
    // <auto-generated>
    //   This code was generated by a tool.
    //
    //    Umbraco.ModelsBuilder v3.0.0.90
    //
    //   Changes to this file will be lost if the code is regenerated.
    // </auto-generated>
    //------------------------------------------------------------------------------
    
    using System;
    using System.Collections.Generic;
    using System.Linq.Expressions;
    using System.Web;
    using Umbraco.Core.Models;
    using Umbraco.Core.Models.PublishedContent;
    using Umbraco.Web;
    using Umbraco.ModelsBuilder;
    using Umbraco.ModelsBuilder.Umbraco;
    
    namespace Umbraco.Web.PublishedContentModels
    {
        /// <summary>Base Page</summary>
        [PublishedContentModel("basePage")]
        public partial class BasePage : PublishedContentModel
        {
    #pragma warning disable 0109 // new is redundant
            public new const string ModelTypeAlias = "basePage";
            public new const PublishedItemType ModelItemType = PublishedItemType.Content;
    #pragma warning restore 0109
    
            public BasePage(IPublishedContent content)
                : base(content)
            { }
    
    #pragma warning disable 0109 // new is redundant
            public new static PublishedContentType GetModelContentType()
            {
                return PublishedContentType.Get(ModelItemType, ModelTypeAlias);
            }
    #pragma warning restore 0109
    
            public static PublishedPropertyType GetModelPropertyType<TValue>(Expression<Func<BasePage, TValue>> selector)
            {
                return PublishedContentModelUtility.GetModelPropertyType(GetModelContentType(), selector);
            }
    
            ///<summary>
            /// Background Image: Select the image to cover the page.
            ///</summary>
            [ImplementPropertyType("backgroundImage")]
            public Our.Umbraco.Vorto.Models.VortoValue BackgroundImage
            {
                get { return this.GetPropertyValue<Our.Umbraco.Vorto.Models.VortoValue>("backgroundImage"); }
            }
    
            ///<summary>
            /// SEO
            ///</summary>
            [ImplementPropertyType("sEO")]
            public Our.Umbraco.Vorto.Models.VortoValue SEO
            {
                get { return this.GetPropertyValue<Our.Umbraco.Vorto.Models.VortoValue>("sEO"); }
            }
        }
    }
    

    Trying to get BackgroundImage out of it in the template with:-

      //if (Model.Content.HasValue(Model.Content.BackgroundImage)) {
        var backgroundImageUrl = Umbraco.TypedMedia(Model.Content.BackgroundImage).Url;
       // }
    

    It complains for Model.Content.BackgroundImage that "The value of parameter 'id' must be either a string or an integer". If I output it, It's actually the string "Our.Umbraco.Vorto.Models.VortoValue" which might also explain why Model.Content.HasValue doesn't work either.

    Still no closer to getting this site underway with Vorto.

  • Craig100 1136 posts 2522 karma points c-trib
    Mar 01, 2016 @ 18:29
    Craig100
    0

    The SEO value in the above code is a Vorto "nested content" datatype of one text string and two text areas. So I would have thought var seoTitle = SEO.browserTitle; should work, but it doesn't. SEO is ok but it croaks on .browserTitle.

    Not sure what's causing the difficulty, ModelsBuilder or Vorto. I've never used either before. At this rate I might have to ditch one or both so I can get on with production.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Mar 01, 2016 @ 19:01
    Jeroen Breuer
    0

    If you do everything that I described in this blogpost it should work: http://24days.in/umbraco/2015/multilingual-vorto-nested-content/

    It's using an older version of the ModelsBuilder, but everything should work the same.

    Maybe first have a play with the example project?

    https://github.com/jbreuer/1-1-multilingual-example

    Jeroen

  • Craig100 1136 posts 2522 karma points c-trib
    Mar 01, 2016 @ 20:47
    Craig100
    0

    Hi Jeroen,

    Thanks. I've just taken a look at the example project and it doesn't use the "normal" (as in 7.4.1) models builder and doesn't use the "normally" generated templates (as from the UI). I'm concerned that regeneration of models will overwrite any changes and that to get it to work the set up is too far away from a standard build with the handcrafted models in a separate project instead of the App_Data folder where they are currently generated by a normal install (normal plus api install, plus web.config change, plus VS extension install that is ;)).

    Just to see, I decided to upgrade Vorto to 1.5 so I have two versions of your example site running, one with Vorto 1.4 and one with Vorto 1.5. Have rebuilt and republished but the 1.5 version site always brings up a 404 even from the links on the properties tab. I did the upgrade on two installs just in case the first one was a fluke, but it was repeatable.

    I'm too nervous to continue with this now. The ModelsBuilder was supposed to save dev time but it seems to be taking me too much time to set up and "discover" the new syntaxes (if they even exist). I'd like to use Vorto but I'm not confident enough to switch your example around from the old to new models builder and Vorto versions so I'm reluctantly going to trash the work I've done and start again with either a tree per language and use Umbraco Relations for the language switching or use Vorto with the Models Builder switched off. I'll have to have a think.

    Thanks for your advice, it has been appreciated.

    Craig

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Mar 04, 2016 @ 08:13
    Jeroen Breuer
    0

    Hi Craig,

    I've upgraded the 1-1 multilingual example to use Umbraco.ModelsBuilder 3.0 which is shipped with Umbraco 7.4. I've also upgraded to Vorto 1.5.1. So it's using all the newest versions now. Hopefully it's now easier to understand.

    https://github.com/jbreuer/1-1-multilingual-example/commits/master

    The template is now also using

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage<UmbNewsItem>

    https://github.com/jbreuer/1-1-multilingual-example/blob/master/Sources/24days/Views/umbNewsItem.cshtml#L2

    Jeroen

  • Craig100 1136 posts 2522 karma points c-trib
    Mar 04, 2016 @ 08:48
    Craig100
    0

    Thanks Jeroen,

    I'll download it and go through it. Had to get the site built so went ahead with Vorto but with ModelsBuilder switched off. Might back-fit it but will def use for the next site.

    Craig

Please Sign in or register to post replies

Write your reply to:

Draft