From 24fbcf708b28fde3ae6f82fccb3c15ef507ba966 Mon Sep 17 00:00:00 2001 From: barnold Date: Thu, 29 Sep 2022 13:18:03 +0100 Subject: [PATCH] Put the about-page under the book controller. --- lib/MyApp.pm | 2 +- lib/MyApp/Controller/Home.pm | 8 -------- templates/{home => book}/about.html.ep | 0 templates/home/index.html.ep | 12 ------------ 4 files changed, 1 insertion(+), 21 deletions(-) delete mode 100644 lib/MyApp/Controller/Home.pm rename templates/{home => book}/about.html.ep (100%) delete mode 100644 templates/home/index.html.ep diff --git a/lib/MyApp.pm b/lib/MyApp.pm index a1fec6d..a7d2d34 100644 --- a/lib/MyApp.pm +++ b/lib/MyApp.pm @@ -87,7 +87,7 @@ sub startup ($self) { # '/' removed. $r->get('/')->to('book#books', page_number => 1)->name('home'); $r->get('/')->to('book#books')->name('books'); - $r->get('/about')->to('home#about'); + $r->get('/about')->to('book#about'); $r->get('/authors/')->to('book#authors')->name('authors'); $r->get('/author//')->to('book#author')->name('author'); $r->post('/set_rpp')->to('book#set_rpp')->name('set_rpp'); diff --git a/lib/MyApp/Controller/Home.pm b/lib/MyApp/Controller/Home.pm deleted file mode 100644 index 478f6b1..0000000 --- a/lib/MyApp/Controller/Home.pm +++ /dev/null @@ -1,8 +0,0 @@ -package MyApp::Controller::Home; -use Mojo::Base 'Mojolicious::Controller', -signatures; - -# No need for a method for either 'index' or 'about'. -# sub index ($self) { -# } - -1; diff --git a/templates/home/about.html.ep b/templates/book/about.html.ep similarity index 100% rename from templates/home/about.html.ep rename to templates/book/about.html.ep diff --git a/templates/home/index.html.ep b/templates/home/index.html.ep deleted file mode 100644 index 252ad49..0000000 --- a/templates/home/index.html.ep +++ /dev/null @@ -1,12 +0,0 @@ -% layout 'default'; -% title 'Home'; -

Home page

- -

Pages that don't require login:

- -

<%= link_to("About" => 'about') %>

-

<%= link_to("Books" => 'books' => { page_number => 1 }) %>

-

<%= link_to("Authors" => 'authors' => { page_number => 1 }) %>

- -

For this, you'll need to log in, then MyApp will redirect you:

-

<%= link_to("Account" => 'account') %>