Changeset 255:134c6156f8ba

Show
Ignore:
Timestamp:
24.05.2010 00:11:30 (4 months ago)
Author:
alafin
Branch:
default
Message:

add cookie collapser for category

Location:
djangobb
Files:
3 added
4 modified

Legend:

Unmodified
Added
Removed
  • djangobb/djangobb_forum/templates/forum/forum_row.html

    r211 r255  
    1515                        <div class="tclcon"> 
    1616                                <h3>{% link forum %} <a href="{% url djangobb:forum_feed "forum" %}{{ forum.id }}/"><img src="{{ MEDIA_URL }}forum/img/feed-icon-small.png"  alt="[RSS Feed]" title="[RSS Feed]" class="rss" /></a></h3> 
    17                                 {{ forum.description|safe }} 
    18                                  
     17                                {{ forum.description|safe }}                             
    1918                                <p> 
    2019                                {% cache 6000 moderators forum.id %} 
  • djangobb/djangobb_forum/templates/forum/index.html

    r211 r255  
    33{% load i18n %} 
    44 
     5{% block extra_meta %} 
     6<script type="text/javascript" src="{{ MEDIA_URL }}forum/js/jquery.cookie.js"></script> 
     7<script type="text/javascript"> 
     8         
     9        function set_collapser(cat_id) { 
     10                category_body_id = "category_body_" + cat_id; 
     11                if($.cookie(category_body_id)){ 
     12                        item_id = "#" + category_body_id;  
     13                        head_id = item_id.replace("body", "head"); 
     14                        $(head_id).addClass("collapsed"); 
     15                        $(item_id).slideToggle("slow"); 
     16                } 
     17        } 
     18        $(document).ready(function(){    
     19                $("a.toggle").click(function(){ 
     20                        header_id = $(this).parent().attr('id'); 
     21                        body_id = header_id.replace("head", "body"); 
     22                        item_id = '#' + body_id 
     23                        if ($(this).parent().attr('class')==''){ 
     24                                $(this).parent().addClass("collapsed"); 
     25                                $.cookie(body_id, 'collapsed'); 
     26                        }else { 
     27                                $(this).parent().removeClass("collapsed"); 
     28                                $.cookie(body_id, ''); 
     29                        } 
     30                        $(item_id).slideToggle("slow"); 
     31                }); 
     32        {% for iter in cats %} 
     33                set_collapser({{ iter.id }}) 
     34        {% endfor %} 
     35        }); 
     36</script> 
     37{% endblock %} 
     38 
    539{% block content %} 
    640<div id="idx1" class="blocktable"> 
    741{% for iter in cats %} 
    8         <h2> 
    9                 <a href="{% url djangobb:forum_feed "category" %}{{ iter.cat.id }}/"><img src="{{ MEDIA_URL }}forum/img/feed-icon-small.png"  alt="[RSS Feed]" title="[RSS Feed]" class="rss" /></a> 
    10                 <span>{{ iter.cat }}</span> 
     42        <h2 id="category_head_{{ iter.id }}"> 
     43                <a class="toggle" href="#">Toggle shoutbox</a> 
     44                <span> 
     45                        {{ iter.cat }} 
     46                </span> 
    1147        </h2> 
    12         <div class="box"> 
     48        <div class="box" id="category_body_{{ iter.id }}"> 
    1349                <div class="inbox"> 
    1450                        <table cellspacing="0"> 
  • djangobb/djangobb_forum/views.py

    r250 r255  
    5252    for forum in _forums: 
    5353        cat = cats.setdefault(forum.category.id, 
    54             {'cat': forum.category, 'forums': []}) 
     54            {'id': forum.category.id, 'cat': forum.category, 'forums': []}) 
    5555        cat['forums'].append(forum) 
    5656        forums[forum.id] = forum 
     
    5959    cats = sorted(cats.values(), cmpdef) 
    6060 
     61    print cats 
     62     
    6163    to_return = {'cats': cats, 
    6264                'posts': Post.objects.count(), 
  • djangobb/static/forum/themes/default/css/default_cs.css

    r177 r255  
    2525.djangobb H2, #brdmenu {BACKGROUND: url(../img/fon111.gif); COLOR: #FFF; font-weight: bold; height: 16px;} 
    2626.djangobb H2 {font-weight: bold;BACKGROUND: #46586a url(../img/fon111.gif);border-top: 1px solid #46586a;border-left: 1px solid #46586a;border-right: 1px solid #46586a; height: 16px;} 
     27.djangobb H2 a.toggle  { 
     28        float: right; 
     29        BACKGROUND: url(../img/cat_minimize.png); 
     30        display:block; 
     31        height:17px; 
     32        line-height:1px; 
     33        outline-color:-moz-use-text-color; 
     34        outline-style:none; 
     35        outline-width:0; 
     36        text-indent:-3000em; 
     37        width:28px; 
     38} 
     39 
     40.djangobb H2.collapsed a.toggle { 
     41        background-image:url(../img/cat_maximize.png); 
     42} 
    2743 
    2844/* 1.4 Table header rows */ 
     
    111127.isticky = sticky topics. The default is "icon". By default only .inew is different.*/ 
    112128 
     129DIV.forum_icon {background:url(../img/active_forum.gif)} 
    113130DIV.icon {background:url(../img/inactive_topic.gif)} 
    114131DIV.inew {background:url(../img/active_topic.gif)}