Fix category and subforum listing on index + misc
This commit is contained in:
parent
e12eeebb6e
commit
45343a87fd
|
@ -3,7 +3,6 @@ package CharmBoard::Controller::Index;
|
|||
use utf8;
|
||||
use strict;
|
||||
use warnings;
|
||||
use feature qw(say unicode_strings);
|
||||
use experimental qw(try smartmatch);
|
||||
|
||||
use Mojo::Base 'Mojolicious::Controller', -signatures;
|
||||
|
@ -19,22 +18,23 @@ sub index {
|
|||
# create a Tree::Simple object that will contain the list
|
||||
# of categories and the subforums that belong to them
|
||||
my $tree =
|
||||
Tree::Simple->new("subfList", Tree::Simple->ROOT);
|
||||
Tree::Simple->new("ROOT", Tree::Simple->ROOT);
|
||||
|
||||
my ($fetchSubf, $catBranch);
|
||||
my (@fetchSubf, $catBranch);
|
||||
foreach my $iterCat (@allCat) {
|
||||
# create branch of subfList for the current category
|
||||
# create branch of ROOT for the current category
|
||||
|
||||
$catBranch =
|
||||
Tree::Simple->new($iterCat, $tree);
|
||||
|
||||
# fetch all subforums that belong to this category
|
||||
$fetchSubf =
|
||||
@fetchSubf =
|
||||
$self->schema->resultset('Subforums')
|
||||
->fetch_by_cat($iterCat);
|
||||
|
||||
# add each fetched subforum as children of the branch
|
||||
# for the current category
|
||||
foreach my $iterSubf ($fetchSubf) {
|
||||
foreach my $iterSubf (@fetchSubf) {
|
||||
Tree::Simple->new($iterSubf, $catBranch)}}
|
||||
|
||||
$self->render(
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package CharmBoard::Controller::Login;
|
||||
|
||||
use utf8;
|
||||
use strict;
|
||||
use warnings;
|
||||
use experimental qw(try smartmatch);
|
||||
use utf8;
|
||||
|
||||
use Mojo::Base 'Mojolicious::Controller', -signatures;
|
||||
use CharmBoard::Crypt::Password;
|
||||
use CharmBoard::Crypt::Seasoning;
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package CharmBoard::Controller::Logout;
|
||||
|
||||
use utf8;
|
||||
use strict;
|
||||
use warnings;
|
||||
use experimental qw(try smartmatch);
|
||||
use utf8;
|
||||
|
||||
use Mojo::Base 'Mojolicious::Controller', -signatures;
|
||||
|
||||
sub logout_do {
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package CharmBoard::Controller::Register;
|
||||
|
||||
use utf8;
|
||||
use strict;
|
||||
use warnings;
|
||||
use experimental qw(try smartmatch);
|
||||
use utf8;
|
||||
|
||||
use Mojo::Base 'Mojolicious::Controller', -signatures;
|
||||
use CharmBoard::Crypt::Password;
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package CharmBoard::Crypt::Password;
|
||||
|
||||
use utf8;
|
||||
use strict;
|
||||
use warnings;
|
||||
use experimental qw(try smartmatch);
|
||||
use utf8;
|
||||
|
||||
use Authen::Passphrase::Argon2;
|
||||
use CharmBoard::Crypt::Seasoning;
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package CharmBoard::Crypt::Seasoning;
|
||||
|
||||
use utf8;
|
||||
use strict;
|
||||
use warnings;
|
||||
use experimental qw(try smartmatch);
|
||||
use utf8;
|
||||
|
||||
use Math::Random::Secure qw(irand);
|
||||
|
||||
use Exporter qw(import);
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package CharmBoard::Schema;
|
||||
|
||||
use utf8;
|
||||
use strict;
|
||||
use warnings;
|
||||
use experimental qw(try smartmatch);
|
||||
use utf8;
|
||||
|
||||
use base qw(DBIx::Class::Schema);
|
||||
|
||||
__PACKAGE__->load_namespaces(
|
||||
|
|
|
@ -3,7 +3,6 @@ package CharmBoard::Schema::Set::Categories;
|
|||
use utf8;
|
||||
use strict;
|
||||
use warnings;
|
||||
use feature qw(say unicode_strings);
|
||||
use experimental qw(try smartmatch);
|
||||
|
||||
use base 'DBIx::Class::ResultSet';
|
||||
|
|
|
@ -3,7 +3,6 @@ package CharmBoard::Schema::Set::Subforums;
|
|||
use utf8;
|
||||
use strict;
|
||||
use warnings;
|
||||
use feature qw(say unicode_strings);
|
||||
use experimental qw(try smartmatch);
|
||||
|
||||
use base 'DBIx::Class::ResultSet';
|
||||
|
@ -14,8 +13,7 @@ sub fetch_by_cat {
|
|||
my $fetch =
|
||||
$set->search(
|
||||
{'subf_cat' => $_[0] },
|
||||
{order_by => 'subf_rank',
|
||||
group_by => undef});
|
||||
{order_by => 'subf_rank'});
|
||||
|
||||
return($fetch->get_column('subf_id')->all)}
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package CharmBoard::Schema::Source::Categories;
|
||||
|
||||
use utf8;
|
||||
use strict;
|
||||
use warnings;
|
||||
use experimental qw(try smartmatch);
|
||||
use utf8;
|
||||
|
||||
use base qw(DBIx::Class::Core);
|
||||
|
||||
__PACKAGE__->table('categories');
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package CharmBoard::Schema::Source::Posts;
|
||||
|
||||
use utf8;
|
||||
use strict;
|
||||
use warnings;
|
||||
use experimental qw(try smartmatch);
|
||||
use utf8;
|
||||
|
||||
use base qw(DBIx::Class::Core);
|
||||
|
||||
__PACKAGE__->table('posts');
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package CharmBoard::Schema::Source::Session;
|
||||
|
||||
use utf8;
|
||||
use strict;
|
||||
use warnings;
|
||||
use experimental qw(try smartmatch);
|
||||
use utf8;
|
||||
|
||||
use base qw(DBIx::Class::Core);
|
||||
|
||||
__PACKAGE__->table('sessions');
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package CharmBoard::Schema::Source::Subforums;
|
||||
|
||||
use utf8;
|
||||
use strict;
|
||||
use warnings;
|
||||
use experimental qw(try smartmatch);
|
||||
use utf8;
|
||||
|
||||
use base qw(DBIx::Class::Core);
|
||||
|
||||
__PACKAGE__->table('subforums');
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package CharmBoard::Schema::Source::Threads;
|
||||
|
||||
use utf8;
|
||||
use strict;
|
||||
use warnings;
|
||||
use experimental qw(try smartmatch);
|
||||
use utf8;
|
||||
|
||||
use base qw(DBIx::Class::Core);
|
||||
|
||||
__PACKAGE__->table('threads');
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package CharmBoard::Schema::Source::Users;
|
||||
|
||||
use utf8;
|
||||
use strict;
|
||||
use warnings;
|
||||
use experimental qw(try smartmatch);
|
||||
use utf8;
|
||||
|
||||
use base qw(DBIx::Class::Core);
|
||||
|
||||
__PACKAGE__->table('users');
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#!/usr/bin/env perl
|
||||
use experimental qw(try smartmatch);
|
||||
|
||||
use utf8;
|
||||
use strict;
|
||||
use warnings;
|
||||
use utf8;
|
||||
use experimental qw(try smartmatch);
|
||||
|
||||
use Mojo::File qw(curfile);
|
||||
use lib curfile->dirname->sibling('lib')->to_string;
|
||||
|
|
|
@ -22,6 +22,7 @@ foreach my $category ($categoryTree->getAllChildren) { %>
|
|||
$category->getNodeValue,
|
||||
$self->schema->resultset('Categories')->
|
||||
title_from_id($category->getNodeValue)) %>
|
||||
<% say ('$category: ' . $category); %>
|
||||
<%
|
||||
foreach my $subforum ($category->getAllChildren) { %>
|
||||
<%= $subfItem->(
|
||||
|
|
Loading…
Reference in New Issue