Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMS tree shows "Too many pages (show as list)" if too many lumberjack-ed pages are added #91

Open
kinglozzer opened this issue Jun 27, 2019 · 4 comments

Comments

@kinglozzer
Copy link
Member

I’ve worked around this in my project by overriding CMSMain_SubTree.ss and checking whether the node has the lumberjack extension (line 4):

<% if not $node.IsInDB %><%-- Only render root node if it's the true root --%>
<ul><li id="record-0" data-id="0" class="Root nodelete"><ins class="jstree-icon font-icon-right-dir">&nbsp;</ins><strong>$rootTitle</strong>
<% end_if %>
<% if $limited && not $node.hasExtension('SilverStripe\Lumberjack\Model\Lumberjack') %>
        <ul><li class="readonly">
        <span class="item">
            <%t SilverStripe\\CMS\\Controllers\\CMSMain.TOO_MANY_PAGES 'Too many pages' %>
            (<a href="{$listViewLink.ATT}" class="subtree-list-link" data-id="$node.ID" data-pjax-target="Content"><%t SilverStripe\\CMS\\Controllers\\CMSMain.SHOW_AS_LIST 'show as list' %></a>)
        </span>
        </li></ul>
<% else_if $children %>
        <ul>
            <% loop $children %><% include SilverStripe\\CMS\\Controllers\\CMSMain_TreeNode %><% end_loop %>
        </ul>
<% end_if %>
<% if not $node.IsInDB %>
    </li></ul>
<% end_if %>

A proper fix to the module could probably use a similar approach, though it’d need to check show_in_sitetree/hide_from_cms_tree

@robbieaverill
Copy link

Ah so the expected behaviour would be that it treats small and large collections of child pages equally, in that it hides or shows them depending on its config?

Presumably if the config says "show in sitetree" and "hide from cms tree" is false, we should still show the "too many pages" message?

@kinglozzer
Copy link
Member Author

kinglozzer commented Jul 1, 2019

Yeah actually it might be a more difficult to solve than I first thought - if you have two “child” classes and one is hidden from the tree and one isn’t, you should still see the “Too many pages” message if the visible children count is too high.

Actually after spotting #86, I need to double check which config things I’ve set edit: they don’t seem to make any difference

purplespider added a commit to purplespider/silverstripe-basic-news that referenced this issue Sep 18, 2019
Removes unnecessary arrow and “too many items” from site tree using CSS.

Awaiting fix: silverstripe/silverstripe-lumberjack#91
@dawb
Copy link

dawb commented Apr 28, 2022

Is there any update on this? This seems to be a core issue not showing a small amount of allowed child pages when there are a large amount of hidden pages.

@mikey-harveycameron
Copy link

I was able to hide excessive blog posts but show the other pages by using hide_from_cms_tree
The post is visible in lumberjack but not the sitetree - until you edit it.

SilverStripe\CMS\Model\SiteTree:
  hide_from_cms_tree:
    - SilverStripe\Blog\Model\BlogPost

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants