summaryrefslogtreecommitdiff
path: root/lib/VNWeb/Discussions/Index.pm
blob: 565cbc4943ef2911669a00c51f57d2f9b9fd8231 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package VNWeb::Discussions::Index;

use VNWeb::Prelude;
use VNWeb::Discussions::Lib;


TUWF::get qr{/t}, sub {
    framework_ title => 'Discussion board index', sub {
        form_ method => 'get', action => '/t/search', sub {
            div_ class => 'mainbox', sub {
                h1_ 'Discussion board index';
                boardtypes_ 'index';
                boardsearch_;
            }
        };

        for my $b (keys %BOARD_TYPE) {
            h1_ class => 'boxtitle', sub {
                a_ href => "/t/$b", $BOARD_TYPE{$b}{txt};
            };
            threadlist_
                where   => sql('t.id IN(SELECT tid FROM threads_boards WHERE type =', \$b, ')'),
                boards  => sql('NOT (tb.type =', \$b, 'AND tb.iid = 0)'),
                results => $BOARD_TYPE{$b}{index_rows},
                page    => 1;
        }
    }
};

1;