1 contributor
<%
my $dbi = app->dbi;
my $op = param('op') // '';
my $book_id = param('book-id');
my $books = $dbi->model('book')->select(['id', 'short_name'])->all;
my $content;
if ($book_id) {
$content = $dbi->model('book')->select(
'content',
where => {id => $book_id}
)->value;
}
%>
% layout 'common';
<div id="container">
<div id="boxA">
<h1>口語訳聖書オンライン語句検索</h1>
</div>
<div id="boxB">
<div style="margin-bottom:5px">
<%= text_field 'word' , style => "width:160px"%>
<button style="width:50px;padding:2px;">検索</button>
</div>
<div style="margin-bottom:10px;">
<a href="<%= url_for('/') %>" style="color:blue">聖書</a>
</div>
<div style="border:1px solid gray;width:218px;height:400px;overflow:auto;padding:5px">
<ul style="list-style-type:none">
% for my $book (@$books) {
<li><a class="book" id="<%= "book-$book->{id}" %>" href="<%= url_for->query('book-id' => $book->{id}) %>"><%= $book->{short_name} %></a></li>
% }
</ul>
</div>
</div>
<div id="boxC">
<p>
% if ($book_id) {
%== $content
% }
</p>
</div>
<div id="boxD">
<div style="border-top:1px solid #AAAAAA;padding-top:10px;">
This site is create by
<a href="http://d.hatena.ne.jp/perlcodesample">Perl</a> +
<a href="http://d.hatena.ne.jp/perlcodesample/20140319/1395203665">Mojolicious</a>.
Auther is <a href="https://twitter.com/yukikimoto2">Yuki kimoto</a>.
</div>
</div>
</div>