Switch to imageboard-like IDs (#7)
This commit is contained in:
parent
bc4f706164
commit
44eeaa80e6
15
database.sql
15
database.sql
|
@ -1,5 +1,5 @@
|
||||||
--
|
--
|
||||||
-- File generated with SQLiteStudio v3.4.4 on Tue. May 16 22:16:54 2023
|
-- File generated with SQLiteStudio v3.4.4 on Mon. Aug. 19 01:39:05 2024
|
||||||
--
|
--
|
||||||
-- Text encoding used: UTF-8
|
-- Text encoding used: UTF-8
|
||||||
--
|
--
|
||||||
|
@ -8,7 +8,7 @@ BEGIN TRANSACTION;
|
||||||
|
|
||||||
-- Table: categories
|
-- Table: categories
|
||||||
DROP TABLE IF EXISTS categories;
|
DROP TABLE IF EXISTS categories;
|
||||||
CREATE TABLE categories (cat_id INTEGER NOT NULL ON CONFLICT ROLLBACK UNIQUE ON CONFLICT ROLLBACK, cat_rank INTEGER NOT NULL, cat_name TEXT, PRIMARY KEY (cat_id AUTOINCREMENT));
|
CREATE TABLE categories (cat_id INTEGER NOT NULL ON CONFLICT ROLLBACK UNIQUE ON CONFLICT ROLLBACK, cat_rank INTEGER NOT NULL, cat_name TEXT, PRIMARY KEY (cat_id));
|
||||||
|
|
||||||
-- Table: posts
|
-- Table: posts
|
||||||
DROP TABLE IF EXISTS posts;
|
DROP TABLE IF EXISTS posts;
|
||||||
|
@ -30,18 +30,11 @@ CREATE TABLE sessions (
|
||||||
|
|
||||||
-- Table: subforums
|
-- Table: subforums
|
||||||
DROP TABLE IF EXISTS subforums;
|
DROP TABLE IF EXISTS subforums;
|
||||||
CREATE TABLE subforums (subf_id INTEGER PRIMARY KEY UNIQUE ON CONFLICT ROLLBACK NOT NULL ON CONFLICT ROLLBACK, subf_cat INTEGER REFERENCES categories (cat_id) NOT NULL, subf_rank INTEGER NOT NULL, subf_name TEXT NOT NULL ON CONFLICT ROLLBACK, subf_desc TEXT);
|
CREATE TABLE subforums (subf_id TEXT (1, 5) PRIMARY KEY UNIQUE ON CONFLICT ROLLBACK NOT NULL ON CONFLICT ROLLBACK, subf_cat INTEGER REFERENCES categories (cat_id) NOT NULL, subf_rank INTEGER NOT NULL, subf_name TEXT NOT NULL ON CONFLICT ROLLBACK, subf_desc TEXT);
|
||||||
|
|
||||||
-- Table: threads
|
-- Table: threads
|
||||||
DROP TABLE IF EXISTS threads;
|
DROP TABLE IF EXISTS threads;
|
||||||
CREATE TABLE threads (
|
CREATE TABLE threads (thread_id INTEGER NOT NULL ON CONFLICT ROLLBACK, thread_title TEXT NOT NULL ON CONFLICT ROLLBACK, thread_subf TEXT (1, 5) REFERENCES categories (cat_id), PRIMARY KEY (thread_id AUTOINCREMENT));
|
||||||
thread_id INTEGER NOT NULL ON CONFLICT ROLLBACK,
|
|
||||||
thread_title TEXT NOT NULL ON CONFLICT ROLLBACK,
|
|
||||||
thread_subf INTEGER REFERENCES categories (cat_id),
|
|
||||||
PRIMARY KEY (
|
|
||||||
thread_id AUTOINCREMENT
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
-- Table: users
|
-- Table: users
|
||||||
DROP TABLE IF EXISTS users;
|
DROP TABLE IF EXISTS users;
|
||||||
|
|
|
@ -73,17 +73,17 @@ sub startup {
|
||||||
action => 'index'
|
action => 'index'
|
||||||
);
|
);
|
||||||
# view subforum
|
# view subforum
|
||||||
$r->get('/subforum/:id')->to(
|
$r->get('/:id')->to(
|
||||||
controller => 'Controller::ViewSubf',
|
controller => 'Controller::ViewSubf',
|
||||||
action => 'subf_view'
|
action => 'subf_view'
|
||||||
);
|
);
|
||||||
|
|
||||||
# create thread
|
# create thread
|
||||||
$r->get('/thread/new/:id')->to(
|
$r->get('/:id/new')->to(
|
||||||
controller => 'Controller::NewThread',
|
controller => 'Controller::NewThread',
|
||||||
action => 'thread_compose'
|
action => 'thread_compose'
|
||||||
);
|
);
|
||||||
$r->post('/thread/new/:id')->to(
|
$r->post('/:id/new')->to(
|
||||||
controller => 'Controller::NewThread',
|
controller => 'Controller::NewThread',
|
||||||
action => 'thread_submit'
|
action => 'thread_submit'
|
||||||
);
|
);
|
||||||
|
|
|
@ -43,7 +43,7 @@ sub thread_submit {
|
||||||
or die "Please fill both the title and post content fields"
|
or die "Please fill both the title and post content fields"
|
||||||
} catch ($catch_error) {
|
} catch ($catch_error) {
|
||||||
$self->flash(error => $catch_error);
|
$self->flash(error => $catch_error);
|
||||||
$self->redirect_to('/thread/new/:id')
|
$self->redirect_to('/:id/new')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,7 @@ use base qw(DBIx::Class::Core);
|
||||||
__PACKAGE__->table('subforums');
|
__PACKAGE__->table('subforums');
|
||||||
__PACKAGE__->add_columns(
|
__PACKAGE__->add_columns(
|
||||||
subf_id =>
|
subf_id =>
|
||||||
{ data_type => 'integer',
|
{ data_type => 'text',
|
||||||
is_auto_increment => 1,
|
|
||||||
is_nullable => 0,
|
is_nullable => 0,
|
||||||
},
|
},
|
||||||
subf_cat =>
|
subf_cat =>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<div class="
|
<div class="
|
||||||
subforum-item subforum-<%= $_subf_id %>
|
subforum-item subforum-<%= $_subf_id %>
|
||||||
category-<%= $_cat_id %>
|
category-<%= $_cat_id %>
|
||||||
"><a href="/subforum/<%= $_subf_id %>"><%= $_name %></a></div>
|
"><a href="/<%= $_subf_id %>"><%= $_name %></a></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%
|
<%
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
<% if (! @thread_list) { %>
|
<% if (! @thread_list) { %>
|
||||||
Oops! Looks like there's no threads here yet. Maybe you'd
|
Oops! Looks like there's no threads here yet. Maybe you'd
|
||||||
like to <a href="/thread/new/<%= $subf_id %>">make one?</a>
|
like to <a href="<%= $subf_id %>/new/">make one?</a>
|
||||||
<% } else {
|
<% } else {
|
||||||
foreach my $thread_id (@thread_list) { %>
|
foreach my $thread_id (@thread_list) { %>
|
||||||
<%= $thread_item->(
|
<%= $thread_item->(
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<a href="/"><%= $self->board_name %></a> » <%= $cat_title %> »
|
<a href="/"><%= $self->board_name %></a> » <%= $cat_title %> »
|
||||||
<%= $subf_title %> » new thread
|
<%= $subf_title %> » new thread
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<form method="post" action="/thread/new/<%= $subf_id %>">
|
<form method="post" action="/<%= $subf_id %>/new/">
|
||||||
<input
|
<input
|
||||||
id="thread-title"
|
id="thread-title"
|
||||||
name="thread-title"
|
name="thread-title"
|
||||||
|
|
Loading…
Reference in New Issue