Copied to clipboard

Flag this post as spam?

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


  • Jonathan Roberts 409 posts 1063 karma points
    Jun 03, 2016 @ 14:04
    Jonathan Roberts
    0

    Extending Umbraco

    Hi, I would like to create my own Tab that shows on the Left handside of the CMS - similar to Forms, Settings etc. What I would like to do is to display data in table form from a SQL table in the main screen when someone clicks on this new tab.

    Is this possible? Any ideas how I go about doing such a thing?

    Thanks Jon

  • Dennis Adolfi 1082 posts 6450 karma points MVP 6x c-trib
    Jun 03, 2016 @ 14:09
    Dennis Adolfi
    2

    Hi Jonathan.

    This is very much possible, by creating you very own Custom Section / Application.

    Here are some great tutorials about how to go about this:

    http://www.enkelmedia.se/blogg/2013/11/22/creating-custom-sections-in-umbraco-7-part-1.aspx

    http://jondjones.com/how-to-create-a-custom-section-in-umbraco-7/

    https://www.linkedin.com/pulse/20141112132834-65892830-creating-a-custom-umbraco-dashboard-section

    The first one by Markus Johansson is really good, its a step by step tutorial on how to create your own Umbraco application, almost from start to finish. And his tutorial is very close to what you are trying to build.

    If it turns out great you might want to package it like your own package and share it in the community.

    Best of luck to you, let me know if there is anything else i can help with!

  • Comment author was deleted

    Jun 03, 2016 @ 14:37

    If it's simply for crud operations on a db table you might want to check out https://our.umbraco.org/projects/developer-tools/ui-o-matic/ , that will auto generate a user interface for you based on a poco and some attributes

  • Dennis Adolfi 1082 posts 6450 karma points MVP 6x c-trib
    Jun 03, 2016 @ 16:53
    Dennis Adolfi
    0

    Wow, this package looks awesome Tim! currently working in a project where I need something like this, with about 10.000 items. How is it with lots of data?

  • Comment author was deleted

    Jun 05, 2016 @ 18:16

    Yeah it should handle that amount of data pretty well, only downside is that you'll have a lot of page numbers and maybe want to handle the pagination numbers a little differently (but since it's open source you can :) )

  • Dennis Adolfi 1082 posts 6450 karma points MVP 6x c-trib
    Jun 06, 2016 @ 12:04
    Dennis Adolfi
    0

    Thank you Tim. That should be fine! I'll give it ago when we reach that point in the project! Seems like a great package! :)

  • Jonathan Roberts 409 posts 1063 karma points
    Jun 06, 2016 @ 08:11
    Jonathan Roberts
    0

    hi, Tim - that looks great - I started to implement a simple Person into the CMS to test it. When I add a new person I get a http://umbracosearch.stimulize.co.uk/umbraco/backoffice/UIOMatic/Object/PostCreate 500 (Internal Server Error).

    I have set a Primary Key in the DB. Is there anything else I need to do?

    im using Umbraco 7.4.2.

    Jon

  • Comment author was deleted

    Jun 06, 2016 @ 11:34

    Hey Jon, mind sharing your poco? Did you implement the interface? And the validate method

  • Jonathan Roberts 409 posts 1063 karma points
    Jun 06, 2016 @ 12:43
    Jonathan Roberts
    0

    Hi, This is the Person Class:

    {
    [UIOMaticAttribute("People", "icon-users", "icon-user", RenderType = UIOMaticRenderType.List)]
    [TableName("People")]
    public class Person : IUIOMaticModel
    {
        public Person() { }
    
        [UIOMaticIgnoreField]
        [PrimaryKeyColumn(AutoIncrement = true)]
        public int Id { get; set; }
    
        [UIOMaticField("First name", "Enter the persons first name")]
        public string FirstName { get; set; }
    
        [UIOMaticField("Last name", "Enter the persons last name")]
        public string LastName { get; set; }
    
        [UIOMaticField("Picture", "Select a picture", View = "file")]
        public string Picture { get; set; }
    
        public override string ToString()
        {
            return FirstName + " " + LastName;
        }
    
        public IEnumerable<Exception> Validate()
        {
            var exs = new List<Exception>();
    
            if (string.IsNullOrEmpty(FirstName))
                exs.Add(new Exception("Please provide a value for first name"));
    
            if (string.IsNullOrEmpty(LastName))
                exs.Add(new Exception("Please provide a value for last name"));
    
    
            return exs;
        }
    
        IEnumerable<Exception> IUIOMaticModel.Validate()
        {
            throw new NotImplementedException();
        }
    }
    

    }

    What do you need from the Poco?

    Jon

  • Comment author was deleted

    Jun 06, 2016 @ 12:46

    Think the error is coming because you didn't implement the Validate Method (so you are hitting that not implemented exception) , just return an empty list will get rid of the error.... or you could of course add custom validation rules

  • Comment author was deleted

    Jun 06, 2016 @ 12:49

    Ow you did implement the validate but could you drop the bit

    IEnumerable<Exception> IUIOMaticModel.Validate()
    {
        throw new NotImplementedException();
    }
    

    That might be causing some strange results, also when you inspect with dev tools what is the actual error that it throws?

  • Jonathan Roberts 409 posts 1063 karma points
    Jun 06, 2016 @ 12:55
    Jonathan Roberts
    0

    Hi, Thanks for updating - I removed that last bit and Im getting this error:

    angular.js?cdv=809639659:10419 POST http://umbracosearch.stimulize.co.uk/umbraco/backoffice/UIOMatic/Object/Validate 500 (Internal Server Error)

    Im using version 1.7.0 if that helps :)

    Thanks for all your help with this, Jon

  • Comment author was deleted

    Jun 06, 2016 @ 12:56

    Yeah defo has something todo with the validation, could you see what it does if you just return an empty list instead of the rules in that method

  • Jonathan Roberts 409 posts 1063 karma points
    Jun 06, 2016 @ 12:58
    Jonathan Roberts
    0

    Hi, That did the trick - it is now saving :)

    Many thanks

    Jon

  • Comment author was deleted

    Jun 06, 2016 @ 13:01

    Ok that's something :) will check why it's happening since you do want validation to happen :)

  • Jonathan Roberts 409 posts 1063 karma points
    Jun 06, 2016 @ 13:05
    Jonathan Roberts
    0

    Great stuff - thanks. Can I ask? I have noticed if using Visual Studio 2015 you can install your version 2.2 - is this a stable version?

    Thanks

    Jon

  • Comment author was deleted

    Jun 06, 2016 @ 13:07

    Sure shoot away :) 2.2 version of which package?

  • Jonathan Roberts 409 posts 1063 karma points
    Jun 06, 2016 @ 13:09
    Jonathan Roberts
    0

    Of UIOMatic.

  • Comment author was deleted

    Jun 06, 2016 @ 13:12

    That version doesn't exist :) https://www.nuget.org/packages/Nibble.Umbraco.UIOMatic/1.7.0 latest is 1.7.0... so not sure what vs is doing....

  • Paul de Quant 403 posts 1521 karma points
    Jun 06, 2016 @ 13:21
    Paul de Quant
    0

    Hi Tim,

    I find this in Nuget in Visual Studioenter image description here

  • Jonathan Roberts 409 posts 1063 karma points
    Jun 06, 2016 @ 13:31
    Jonathan Roberts
    0

    Thanks Paul - that's what I see too.

    Jon

  • Comment author was deleted

    Jun 06, 2016 @ 13:33

    Hmm that's strange I don't have that when I manage my packages in nuget enter image description here

    So I have no idea why vs is adding a 2 there...

  • Comment author was deleted

    Jun 06, 2016 @ 13:35

    So would recommend installing 1.7.0 not that 2

  • Jonathan Roberts 409 posts 1063 karma points
    Jun 06, 2016 @ 13:35
    Jonathan Roberts
    0

    I think I will remove 2.2 dll and go for the good old fashion version 1.7.0 :)

    Thanks again for all your help.

    Jon

  • Jonathan Roberts 409 posts 1063 karma points
    Jun 06, 2016 @ 14:12
    Jonathan Roberts
    0

    Is there a way to give the List view Headers a nice name for example First Name as opposed to FirstName?

    Thanks Jon

  • Comment author was deleted

    Jun 07, 2016 @ 08:09

    Currently not but it has been requested a couple of times so will add that in in a next version (when time permits since I'm pretty busy atm)

  • Jonathan Roberts 409 posts 1063 karma points
    Jun 07, 2016 @ 07:32
    Jonathan Roberts
    0

    Hi Tim, Have you ever got a Rich Text Editior working on the UI-O-MATIC project?

    I have tried following some online examples but being a bit new to AngularJs I never got them working.

    Thanks again for all your help, Jon

  • Comment author was deleted

    Jun 07, 2016 @ 08:07

    Hey Jonathan, nope haven't done that but you should be able to follow these instructions http://www.enkelmedia.se/blogg/2013/12/4/umbraco-7-use-the-rich-text-editor-tinymce-in-a-custom-section.aspx

  • Jonathan Roberts 409 posts 1063 karma points
    Jun 07, 2016 @ 08:10
    Jonathan Roberts
    0

    Hi, No problem. Thanks for all your help. Have a great week,

    Jon

  • Jonathan Roberts 409 posts 1063 karma points
    Jun 07, 2016 @ 10:47
    Jonathan Roberts
    0

    Hi Tim, Sorry to bother you again but I was hoping you may know the answer to this question.

    I have copied the example in the link above but the data isn't saving to the Database. This is my control:

    <div ng-controller="CustomSectionEditController">
    <ng-form>
        <umb-editor model="properties" ng-model="properties.Value"></umb-editor>
    
    </ng-form>
    

    and this is my controller:

    angular.module("umbraco").controller("CustomSectionEditController",
    function ($scope, $http, uioMaticObjectResource, $routeParams) {
    
        $http({ method: 'GET', url: 'backoffice/rte/rte/Getdescription', params: { id: $routeParams.id.split("?")[0] } })
    
           .success(function (data) {
               $scope.properties = {
                   label: 'bodyText',
                   view: 'rte',
                   hideLabel: true,
                   config: {
                       editor: {
                           toolbar: ["code", "undo", "redo", "cut", "styleselect", "bold", "italic", "alignleft", "aligncenter", "alignright", "bullist", "numlist", "link", "umbmediapicker", "umbmacro", "table", "umbembeddialog"],
                           stylesheets: [],
                           dimensions: { height: 400, width: 250 }
                       }
                   },
                   value: JSON.parse(data)
               };
    
           })
           .error(function () {
               $scope.error = "An Error has occured while loading!";
           });
    });
    

    In your edit controller.js file under Save() The RTE control's Value is unchanged.

    (I haven't copied the code exactly as the Properties loop which is wrapped in the example causes loads of issues).

    Any ideas?

    Thanks, jon

  • Comment author was deleted

    Jun 07, 2016 @ 10:57

    Hmm nope not sure :( would have to test it myself to get a better understanding of the issue

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies