Copied to clipboard

Flag this post as spam?

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


  • Jesper Hauge 298 posts 487 karma points c-trib
    Jan 07, 2014 @ 13:32
    Jesper Hauge
    1

    Custom list views per doctype in Umbraco backend

    Trying to come with an estimate on how much it would take to be able to customize the list view columns for a certain media type.

    I found that it's fairly easy to customize the file that creates the list view which is found here

    /umbraco/Views/propertyeditors/listview/listview.html
    

    And you could probably do a lot of funky stuff in that file using some ngIf directives, but I'm thinking that would be bad practice, since altering this file would mean I'd have to take special care of this file every time I do a minor Umbraco update.

    What would be the most straightforward way of accomplishing this?

    Is there any way of overruling the view file selection using some kind of package technique, perhaps a manifest file and some custom view files?

    Any ideas?

    Regards Jesper Hauge

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Jan 08, 2014 @ 11:01
    Sebastiaan Janssen
    100

    Maybe it would be a good idea to just fork the listview and make it a proper plugin. It's already a datatype so you can customize and re-use that on the document types on which you need it. The only problem might be that if you use it as a datatype, you'll still be able to expand the node tree.

    Maybe we can build support into the core for a setting like "Hide expand button" on the datatype (sorry: Property Editor!). For now it would probably mean you'd have to do some javascript hacking.

  • Jesper Hauge 298 posts 487 karma points c-trib
    Jan 08, 2014 @ 11:36
    Jesper Hauge
    1

    I think I arrived at nearly the same conclusions, was mostly trying to check if I missed something obvious.

    What I'm trying to do is add the contents of specific doc properties as columns in the list view. So maybe we should consider adding possibility of specifying which columns should be shown in the list view to the datatype editor for list views. Then you could have different list views for different doctypes, and the yes it would be nice if it was possible to specify that you wanted to hide expand button also.

    @Sebastiaan: Do you think I should try and describe what I'm looking for, and create an issue for it on YouTrack?

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Jan 08, 2014 @ 12:11
    Sebastiaan Janssen
    0

    It's in our plans to do this and make something like a provider for the list view. We just didn't want to start building those yet as it would've immediately made it too complex. So start with a good basis and then expand on it.

    But yes, if you could spend 5 minutes adding that to the tracker that would be great, saves me some time, thanks! :-)

  • jonok 297 posts 658 karma points
    Feb 09, 2014 @ 23:07
    jonok
    0

    In the meantime, perhaps this could be a messy/hacky way of doing it?... would it be possible to check a variable (eg. the doc type) in javascript, and then show/hide listview td's depending on this value? I'm not very familiar with angular.js so I'm not sure what variables are accessible by javascript within the listview.html page?

  • Søren Reinke 158 posts 206 karma points c-trib
    Jul 09, 2014 @ 15:24
    Søren Reinke
    0

    Jesper, might you have an example you could share?

  • Olie 11 posts 52 karma points
    Nov 17, 2014 @ 18:40
    Olie
    0

    I found that the controller pulls in the docType and all properties so is easy to add in extra fields based on type (but hacky modifying core code)

    /umbraco/Views/propertyeditors/listview/listview.html
    

    ~line:83 in the last TD of the TR that loops the pages

    <tr ng-repeat="result in listViewResultSet.items">
    ....
        <td>
            <div ng-if="result.contentTypeAlias === 'BlogPost'">
                <span ng-repeat="prop in result.properties">
                    <span ng-if="prop.alias === 'authorName' && prop.value !== ''">
                        <span style="display: inline-block; padding: 2px 6px; background-color: red;">{{prop.value}}</span>
                    </span>
                </span>
            </div>
        </td>
    ....
    </tr>
    
  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Nov 17, 2014 @ 19:57
    Sebastiaan Janssen
    0

    Just as a note, in Umbraco 7.2 you will be able to customize the fields of each listview you'd like to make, no need for hacking the core code. :)

  • mike 90 posts 258 karma points
    Mar 05, 2015 @ 17:12
    mike
    0

    In 7.2 is there a quick way to change/hack the source of the list view?  For instance adding an additional tab with a listview that shows the children of a different node?

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Mar 05, 2015 @ 17:25
    Sebastiaan Janssen
    0

    Yes, you should have buttons for that in the document type editor:

    enter image description here

    enter image description here

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Mar 05, 2015 @ 17:26
    Sebastiaan Janssen
    0

    Oh, for displaying children of a different node?? That would be very confusing wouldn't it? Can you specify what the usecase for that would be?

  • mike 90 posts 258 karma points
    Mar 05, 2015 @ 18:36
    mike
    0

    It was to simplify admin for client so related items could be managed on different tabs of a page.

    I guess what I want is not the listview control as this hides items in the tree view.  What I want is something just like the listview with all the same functionality (publish/create/delete/sort) but be able to specify a custom datasource.

    I've already been told I need to create my own property editor for this.  I guess I am just looking for the easiest way to do it without starting from scratch.

    Do you have any tips or know of a project that implements something like this that I can have a look at?

     

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Mar 06, 2015 @ 11:30
Please Sign in or register to post replies

Write your reply to:

Draft