开发者

Django roll-up (collapsible) menu

开发者 https://www.devze.com 2023-04-03 15:33 出处:网络
I have a web app with three frames (banner, menu, content) The menu frame needs to have a dynamic roll-up menu

I have a web app with three frames (banner, menu, content) The menu frame needs to have a dynamic roll-up menu Example:

+ Teachers
  - Create
  - Edit
  - Delete

+ Schools
  - Create
  - Edit
  - Delete
  - View Staff

+ Classrooms
  - Create
  - Edit
  - Delete

If you click on the + or "Sch开发者_运维问答ools" it will hide/un-hide items under it. The menu needs to be dynamically drawn after user login based on user group and role. Some users may only be authorized to see

+ Classrooms
  -Edit 

and some users will see everything.

Is there anything built or a plugin that anyone has used that would provide a framework for what I need?


Simple implementation using jQuery:

<div id="menu">
    <a>Teachers</a><br />
    <div style="display: none">
        <a href="">Edit</a><br />
        <a href="">Delete</a><br /> 
    </div>
    <a>Schools</a><br />
    <div style="display: none">
        <a href="">Edit</a><br />
        <a href="">Delete</a><br /> 
    </div>
</div>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
$('#menu > a').click(function(){
    $(this).next().next().slideToggle();
    return false;
});
</script>


Maybe here (for django): http://www.google.pl/search?q=django+tree+menu
and here (for js) http://www.google.pl/search?q=javascript+tree+menu
or better here (jQuery) http://www.google.pl/search?q=jquery+tree+menu

Anyway, for simple cases, its not too hard to make your own impl.

0

精彩评论

暂无评论...
验证码 换一张
取 消