-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Hide sidebar blocks. #1291
Comments
Hi @andersonbrantes, If you can confirm the view you're looking at (Do you have a custom homepage set?) I could help with those rules. |
Ok @ssddanbrown , I will try to do it with CSS... |
@andersonbrantes something like this is what I use: |
Hi @unknowndomain... I could use something like that, but, I want this rule only for public pages. This is tricky to do with CSS without a specific identifier(Id or Class) for this. Maybe I can do it with Javascript. But, the best way would be on the server side, I think. There is a similar issue to what I want to do: #1319 |
I agree, another solution which would be helpful generally is that the body tag have a few classes on it to help you figure out what kind of page you are on, i.e. That way you could write CSS selectors like This is how WordPress handles the issue. |
I think hiding recent activity block from public is important in terms of security at some cases. Some users who has different roles should see this. |
I fully agree. Pages hidden to some roles appear in the recently changed area to all roles, and they can access it by just clicking the link. |
On the custom css route it would be helpful if IDs or better still class names set for the entire block section so they can be hidden individually. Currently they seem to be applied somewhat inconsistently. For example i can set in Custom HTML Head Content:
and it removes the whole block. But if i do:
it removes the block contents but not the header because the id tag has been applied at the sub block of the full recently-updated-pages block content. If the IDs were set on the top block element for each section that would be helpful fix. Lastly I would think about using classes rather than IDs as at some point you can guarantee someone is going to want to use the same block twice on a page in a customised theme for whatever reason and if you use IDs it will be invalid html and you've got yourself another support ticket. Lovely looking wiki so far, looking forward to seeing it improve over time! |
Any progress on this? This is an important feature IMHO. Right sidebar, history, and if possible top-right header content should be hidden from public. |
Hi, I'm looking forward to see this feature. I'm looking for a way to hide recent activity, especially usernames for guest viewers. Maybe this could be simply implemented to display Someone instead of real username when guest loads the page ? |
It's very important feature. In our case we send guest links on specified documents, but all guests can see all documents in Recent activity. Maybe this can be solved through User rights? |
Yes, possible solution would be, to replace username with Someone and disable link to user based on user role or permission. |
Yes, Users (Including guests) should only be able to see the activity for items they have access to. By default the guest user can view everything but this is configurable by alterting their role. |
If this could be the role "List chapter, books, shelf" it would be great. We could send a link for book/chapter but if we dont't give that role - guests will not be able to list anothers books/chapters. This role can affect showing recent activity too. And of course Guests mustn't be able to view User name or another private information. |
I've worked around this for now by hiding the sidebar things we don't need in <style> tags in the HTML head content. The way I've done it means all the sidebar headings aren't visible, but it works ok for what we need it for. Not totally secure as folks can just open developer tools and disable "display: none" to see the content, but means general punters won't see unnecessary clutter.
|
Just want to advise, we do have the visual theme system that can be utilised if you need to do something more extensive outside of setting styles, without altering core app files: https://github.com/BookStackApp/BookStack/blob/master/dev/docs/visual-theme-system.md Would allow you to override any view file we use and completely remove those parts if desired. |
Hello everyone, this how my wife hide the right panel for guests users only.
It's just hidden i can see it appear and vanish in a second, not quite secure IMO but still better than nothing. Have a nice day. |
@satanahell Slightly optimized/earlier-loading version of that if desired: <script>
window.addEventListener('DOMContentLoaded', (event) => {
const loginShowing = document.querySelector('a[href$="/login"]') !== null;
const rightPanel = document.querySelector("div.tri-layout-right");
if (loginShowing && rightPanel) {
rightPanel.style.visibility = 'hidden';
}
});
</script> Note, if you're hiding the right sidebar with a primary aim to hide export options, these can instead be controlled via role permissions (As most right sidebar actions can at some level.) |
@ssddanbrown thanks for your optimized reply, my wife told me that she didn't have your skill level ! I start using this "tricks" in order to expand the main page frame even if i had to hide the left panel too. I still want to display a large google slide into an e-frame on my bookstack instance. Ultimately i find out an acceptable way to achieve that whitout tweaking my bookstack. But i'm still pushing my wife to get a special custom CSS template for this purpose !! 👍 Enjoy your day, |
How would I go about hiding all occurrences of the .tag-item class using this? Instead of just the first occurrence. |
Thanks for the JavaScript snippets - those work great Edit: I figured this out by mixing some of the suggestions here up a bit and having the element hide unless instead of display if a user is logged in:
This does not quite address the security aspect though - anyone with minor computer knowledge can access the browser console and change the |
It would be helpful if I could show/hide these blocks via the settings. |
This is a kludgy way to implement it, but I was looking for a similar way to hide recent activity and recent books from public users and this is what I've come up with: Inside of those two, I've wrapped the drafts, recently updated pages, and activity list code blocks in the following if statement:
This should check that a user has any kind of 'creation' permissions before displaying that section, but can be modified to look for whichever permission fits your use best. This works for our uses, but this will also strip the recent activity lists from logged in users that do not have any creation permissions. |
A variation of the above example, if you only wan to hide recent activity from public viewing, you could use this snippet: <script>
window.addEventListener('DOMContentLoaded', (event) => {
const loginShowing = document.querySelector('a[href$="/login"]') !== null;
const leftActivity = document.querySelector("#recent-activity");
if (loginShowing && leftActivity) {
leftActivity.style.visibility = 'hidden';
}
});
</script> Or completely remove it <script>
window.addEventListener('DOMContentLoaded', (event) => {
const loginShowing = document.querySelector('a[href$="/login"]') !== null;
const leftActivity = document.getElementById("recent-activity");
if (loginShowing && leftActivity) {
leftActivity.innerHTML = "";
}
});
</script> |
This worked great. Thanks @tacerus. |
This works well but just to highlight an edge case: If you have a shelf/book/chapter/page called login then this can stop working and start hiding both panels for logged in users too. It will continue to work if you include the full link for login to your instance: |
Hi -- I appreciate all this problem solving. I would like to exclude/hide ONLY the "recent activity" -- the "Book Navigation" that shows up on the left sidebar is very useful to my users, but I would like them to not see the editing activity. The examples above do not seem to work for me -- the event listeners don't work when all i'm doing is removing recent activity. They are being ignored completely. I also don't want public viewers to be able to see the previous versions of the books/pages. Not sure how to proceed. |
This seemed to be working for us until the latest update (23.12). Is an updated method required to hide the sidebar? |
I'm not familiar with PHP code. Who can provide me with the applied code file? I'd like to see it and apply it myself. |
For those of you who are still in search of a solution which doesn't involve JavaScript, this might be helpful to you: |
It would be really nice if BookStack could integrate the two added permissions from https://github.com/code-kungfu/bookstack-cktheme/ in the main core, to avoid future breakage. |
Hello, you are doing a great job with this tool.
Is there a configuration to hide the “recent activity”, “recently updated pages” and “my recently viewed” sidebar blocks?
The text was updated successfully, but these errors were encountered: