1 of 1 found this page helpful

Hide theme elements on an individual page

    Table of contents
    1. 1. Simplifying deployment

    Let's say that you want to hide the comments section on just one page of your MindTouch site because you want to avoid having people add comments to it.  Here is how you would do it.

    1. Go to the page that you want to hide the comment on and edit the page
    2. Insert a formatted block and apply the dekiscript style to it

    Once you have the block add the following to it:

     

    	<script type="text/jem">"
    $('document').ready(function() {
        $('#comments').css('display', 'none');
    });
    "</script>
    
     
    Once you have added it then save the page and note that the comments are hidden.
    With this code you can hide multiple elements just by itemizing them within the ready function block.  You can also preface the block with a requirement that non-admins are the only onces that have the styles applied by doing the following:
     
    		<script type="text/jem">"
    $('document').ready(function() {
     if({{!user.admin}}){
        $('#comments').css('display', 'none');
        }
    });
    "</script>
    
     

    Simplifying deployment

    Once you have the code right then you can load it into a Template and reference the template dynamically within the page.  This will ensure that if someone edits the page that doesn't have rights to add unsafe html, that the override isn't removed. 

    Was this page helpful?
    Tag page
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by