Copied to clipboard

Flag this post as spam?

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


  • Emiel 31 posts 124 karma points
    Sep 03, 2016 @ 21:31
    Emiel
    0

    Creating more order with selecting one of many content editors.

    Good day!

    Currently we are developing a big website for a client and though the development goes pretty smooth, the customer asked if there was a possibility to create some order when you select a content editor while adding content. We agreed to look into this as we have about several dozen of content(grid) editors now and it only being ordered by name is not very helpful.

    Is there a plugin/tool/setting we could use to implement this?

    Thanks in advance!

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Sep 04, 2016 @ 00:51
    Nicholas Westby
    0

    A couple questions:

    • Can you add a screenshot of the dialog you are looking at?
    • Which version of Umbraco are you using?
  • Marc Goodson 2157 posts 14431 karma points MVP 9x c-trib
    Sep 04, 2016 @ 07:38
    Marc Goodson
    2

    Hi Emiel

    Umbraco assembles the list of available grid editors to use on a particular cell from the selected available editors for the particular cell, or 'all editors' if allow all editors is ticked.

    enter image description here

    So it's possible to limit the editors to display so any the ones that can be used in a particular cell are shown, to avoid hundreds appearing for every cell.

    But if it's necessary to have lots and lots of options in a particular cell, the alphabetical order isn't, as you point out, a super helpful option.

    The problem is that Umbraco compiles this list of editors from more than one place, the /config/grid.editors.config.js file for core editors and also any custom editors installed in app_plugins, which have a grideditors package.manifest file. (https://our.umbraco.org/documentation/getting-started/backoffice/property-editors/built-in-property-editors/grid-layout/build-your-own-editor)

    So there isn't 'one place' to define their order. (just check boxes to include them or not for a cell)

    In the core the view responsible for listing the available grid editors (/umbraco/views/common/overlays/itempicker/itempicker.html), has the hardcoding of the sort order to be by name'

    enter image description here

    If you delete the orderBy bit:

    ng-repeat="availableItem in model.availableItems | compareArrays:model.selectedItems:'alias' | filter:searchTerm"
    

    then the editors are listed in the order they appear in the file:

    /config/grid.editors.config.js

    which would give you some control over the order, but not necessarily those editors added via the package.manifest method.

    So, if you are desperate, (and this involves hacking the core files, which then will be overwritten when you upgrade Umbraco, so be aware this isn't recommended, just an experiment), you could add a new config item to all the core editors in /config/grid/editors/config.js (and to any package manifest file for custom grid editors, called 'sortOrder' eg

    {
        "name": "Rich text editor",
        "alias": "rte",
        "view": "rte",
        "icon": "icon-article",    
        "config": {
            "sortOrder": 5
        }
    },
    {
        "name": "Image",
        "alias": "media",
        "view": "media",
        "icon": "icon-picture",    
        "config": {
            "sortOrder": 3
        }
    },
    ... etc
    

    and then update the core file (/umbraco/views/common/overlays/itempicker/itempicker.html) to sort by this new config option...

        ng-repeat="availableItem in model.availableItems | compareArrays:model.selectedItems:'alias' | orderBy:['config.sortOrder', 'name'] | filter:searchTerm"
    

    I thought I'd add this to the issue tracker to start a discussion on whether this would be possible to achieve somehow as part of the core, but I've found that one already exists and it has been discussed:

    http://issues.umbraco.org/issue/U4-7960#

    It has much of what I've just said!! but you can vote/comment your opinion too

  • Emiel 31 posts 124 karma points
    Sep 05, 2016 @ 07:23
    Emiel
    0

    Hey, thanks for the help so far. What I was thinking of is to create folders in the data type node so you can "group" different kinds of in certain category's. E.G: 5 different text data types (h1,2,3,4, paragraph) in the folder "text elements". So instead of having this:enter image description here

    You'd be able to navigate through all the editors much easier like this:

    enter image description here

    I understand I'd need to make my hands dirty with messing with the core of Umbraco, but anyone has any clues how to accomplish this?

    Thanks!

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Sep 05, 2016 @ 07:29
    Nicholas Westby
    1

    Archetype is basically doing that. You could refer to how Archetype is doing it and do something similar:

    Archetype

    In this example, I have two groups ("Basic" and "Location"). Right now, I have "Basic" selected so that I only see the fieldsets belonging to the basic group.

  • Emiel 31 posts 124 karma points
    Sep 05, 2016 @ 08:07
    Emiel
    0

    Thanks for the suggestion on Archetype! It looks very nifty, actually reminds me of Leblender. It seems I am able to group data types quite easily, which is nice. However, how do you group up the content editors like you did in your example?

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Sep 05, 2016 @ 08:26
    Nicholas Westby
    1

    When configuring an Archetype in the developer section under Data Types, there is a button ("Global Options" or something like that). It allows you to add new group labels. Then when you create each fieldset, you can select the group label to be used for that fieldset. You may also need to enable multiple fieldsets (should be under that same "Global Options" dialog).

    I don't really tinker much with the Umbraco Grid, so I'm not sure if there is a similar screen that would be a good place to add this type of functionality. If not, perhaps the group label could be added in the configuration files some people mentioned above.

  • Emiel 31 posts 124 karma points
    Sep 05, 2016 @ 08:52
    Emiel
    0

    Alright, figured it out, however - sadly - I think this is not really what I'm looking for. It seems this is more like some sort of data-type grouper. As shown I've created a new Archetype data type and added a couple of data types and grouped them under the name of "text elements". This is pretty close to what I want, the problem is that I am unable to add grid editors to this list. This is what I got so far: enter image description here

  • Nicholas Westby 2054 posts 7103 karma points c-trib
    Sep 05, 2016 @ 20:27
    Nicholas Westby
    0

    Yes, one would typically choose between Archetype and Umbraco Grid. I was pointing out the grouping capability of Archetype as an example of how one might implement such a thing for the Umbraco Grid.

    That is, somebody who was modifying the source code of Umbraco could take some hints and use some ideas that have so far been implemented as part of Archetype to implement something similar for the Umbraco Grid.

    And yes, you could refer to Archetype as a data type grouper. It's main function is to create complex data types by composing simpler data types together (e.g., a slideshow is a collection of slides, and a slide is a header/link/image). Archetype data types can even be composed of other Archetype data types.

Please Sign in or register to post replies

Write your reply to:

Draft