Changeset 255:134c6156f8ba
- Timestamp:
- 24.05.2010 00:11:30 (4 months ago)
- Author:
- alafin
- Branch:
- default
- Message:
-
add cookie collapser for category
- Location:
- djangobb
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r211
|
r255
|
|
| 15 | 15 | <div class="tclcon"> |
| 16 | 16 | <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 }} |
| 19 | 18 | <p> |
| 20 | 19 | {% cache 6000 moderators forum.id %} |
-
|
r211
|
r255
|
|
| 3 | 3 | {% load i18n %} |
| 4 | 4 | |
| | 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 | |
| 5 | 39 | {% block content %} |
| 6 | 40 | <div id="idx1" class="blocktable"> |
| 7 | 41 | {% 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> |
| 11 | 47 | </h2> |
| 12 | | <div class="box"> |
| | 48 | <div class="box" id="category_body_{{ iter.id }}"> |
| 13 | 49 | <div class="inbox"> |
| 14 | 50 | <table cellspacing="0"> |
-
|
r250
|
r255
|
|
| 52 | 52 | for forum in _forums: |
| 53 | 53 | cat = cats.setdefault(forum.category.id, |
| 54 | | {'cat': forum.category, 'forums': []}) |
| | 54 | {'id': forum.category.id, 'cat': forum.category, 'forums': []}) |
| 55 | 55 | cat['forums'].append(forum) |
| 56 | 56 | forums[forum.id] = forum |
| … |
… |
|
| 59 | 59 | cats = sorted(cats.values(), cmpdef) |
| 60 | 60 | |
| | 61 | print cats |
| | 62 | |
| 61 | 63 | to_return = {'cats': cats, |
| 62 | 64 | 'posts': Post.objects.count(), |
-
|
r177
|
r255
|
|
| 25 | 25 | .djangobb H2, #brdmenu {BACKGROUND: url(../img/fon111.gif); COLOR: #FFF; font-weight: bold; height: 16px;} |
| 26 | 26 | .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 | } |
| 27 | 43 | |
| 28 | 44 | /* 1.4 Table header rows */ |
| … |
… |
|
| 111 | 127 | .isticky = sticky topics. The default is "icon". By default only .inew is different.*/ |
| 112 | 128 | |
| | 129 | DIV.forum_icon {background:url(../img/active_forum.gif)} |
| 113 | 130 | DIV.icon {background:url(../img/inactive_topic.gif)} |
| 114 | 131 | DIV.inew {background:url(../img/active_topic.gif)} |