Easier to maintain template structure

This the head and footer don't have to be included everytime and the hierarchy is easier to read
This commit is contained in:
Pierre Rudloff 2022-02-03 21:38:29 +01:00
parent de74808459
commit ac8c53375a
11 changed files with 201 additions and 195 deletions

View File

@ -1,8 +1,8 @@
{include file='inc/head.tpl'}
<div class="wrapper">
<main class="main error">
{extends file='page.tpl'}
{block name='main'}
<div class="error">
{include file="inc/logo.tpl"}
<h2>{t}An error occurred{/t}</h2>
<p><i>{$error|escape|nl2br}</i></p>
</main>
{include file='inc/footer.tpl'}
</div>
{/block}

View File

@ -1,5 +1,5 @@
{include file='inc/head.tpl'}
{include file='inc/header.tpl'}
{extends file='page.tpl'}
{block name='main'}
{include file='inc/logo.tpl'}
<h2 class="titre">{t}Supported websites{/t}</h2>
<div class="tripleliste">
@ -9,4 +9,4 @@
{/foreach}
</ul>
</div>
{include file='inc/footer.tpl'}
{/block}

View File

@ -1,4 +1,3 @@
</div>
<footer class="small-font">
<div class="footer_wrapper">
{include file='snippets/dev.tpl' assign=dev}
@ -21,9 +20,3 @@
{t params=['@youtubedl'=>$youtubedl]}Based on @youtubedl{/t}
</div>
</footer>
</div>
{if isset($debug_render)}
{$debug_render->render()}
{/if}
</body>
</html>

View File

@ -1,5 +1,3 @@
<!doctype html>
<html lang="{$locale->getLocale()->getBcp47()}">
<head>
<meta charset="UTF-8"/>
<meta name=viewport content="width=device-width, initial-scale=1"/>
@ -27,5 +25,3 @@
{$debug_render->renderHead()}
{/if}
</head>
<body>
<div class="page {$class}">

View File

@ -27,4 +27,3 @@
</div>
{/if}
</header>
<div class="wrapper">

View File

@ -1,5 +1,8 @@
<h1 class="logobis">
<a class="logocompatible" href="{base_url}">
<span class="logocompatiblemask"><img src="{base_url}/img/logocompatiblemask.png" width="447" height="107"
alt="{$config->appName}"/></span>
</a></h1>
<span class="logocompatiblemask">
<img src="{base_url}/img/logocompatiblemask.png" width="447" height="107"
alt="{$config->appName}"/>
</span>
</a>
</h1>

View File

@ -1,6 +1,5 @@
{include file='inc/head.tpl'}
{include file='inc/header.tpl'}
<main class="main">
{extends file='page.tpl'}
{block name='main'}
<div><img class="logo" src="{base_url}/img/logo.png"
alt="{$config->appName}" width="328" height="284"></div>
<form action="{path_for name="info"}">
@ -20,17 +19,22 @@
{if $config->convert}
<div class="mp3 small-font">
<div class="mp3-inner">
<input type="checkbox" id="audio" class="audio" name="audio" {($config->defaultAudio) ? 'checked' : ''}>
<input type="checkbox" id="audio" class="audio"
name="audio" {($config->defaultAudio) ? 'checked' : ''}>
<label for="audio"><span class="ui"></span>
{t}Audio only (MP3){/t}
</label>
{if $config->convertSeek}
<div class="seekOptions">
<label for="from">{t}From{/t}</label> <input type="text" pattern="(\d+:)?(\d+:)?\d+(\.\d+)?"
placeholder="HH:MM:SS" value="" name="from"
<label for="from">{t}From{/t}</label> <input type="text"
pattern="(\d+:)?(\d+:)?\d+(\.\d+)?"
placeholder="HH:MM:SS" value=""
name="from"
id="from"/>
<label for="to">{t}to{/t}</label> <input type="text" pattern="(\d+:)?(\d+:)?\d+(\.\d+)?"
placeholder="HH:MM:SS" value="" name="to" id="to"/>
<label for="to">{t}to{/t}</label> <input type="text"
pattern="(\d+:)?(\d+:)?\d+(\.\d+)?"
placeholder="HH:MM:SS" value="" name="to"
id="to"/>
</div>
{/if}
</div>
@ -44,6 +48,4 @@
<a class="bookmarklet small-font"
href="javascript:window.location='{$domain}{path_for name='info' queryParams=['url' => '%url%']}'.replace('%url%', encodeURIComponent(location.href));">{t}Bookmarklet{/t}</a>
</div>
</main>
{include file='inc/footer.tpl'}
{/block}

View File

@ -1,7 +1,6 @@
{include file="inc/head.tpl"}
<div class="wrapper">
{extends file='page.tpl'}
{block name='main'}
<div itemscope itemtype="https://schema.org/VideoObject">
<main class="main">
{include file="inc/logo.tpl"}
{include file='snippets/title.tpl' assign=title}
<p id="download_intro">
@ -103,6 +102,5 @@
{/if}
<input class="downloadBtn" type="submit" value="{t}Download{/t}"/><br/>
</form>
</main>
</div>
{include file="inc/footer.tpl"}
{/block}

18
templates/page.tpl Normal file
View File

@ -0,0 +1,18 @@
<!doctype html>
<html lang="{$locale->getLocale()->getBcp47()}">
{include file='inc/head.tpl'}
<body>
<div class="page {$class}">
{include file='inc/header.tpl'}
<div class="wrapper">
<main class="main">
{block name="main"}{/block}
</main>
</div>
{include file='inc/footer.tpl'}
</div>
{if isset($debug_render)}
{$debug_render->render()}
{/if}
</body>
</html>

View File

@ -1,6 +1,5 @@
{include file='inc/head.tpl'}
<div class="wrapper">
<main class="main">
{extends file='page.tpl'}
{block name='main'}
{include file="inc/logo.tpl"}
<h2>{t}This video is protected{/t}</h2>
<p>{t}You need a password in order to download this video.{/t}</p>
@ -10,5 +9,4 @@
<br/><br/>
<input class="downloadBtn" type="submit" value="{t}Download{/t}"/>
</form>
</main>
{include file='inc/footer.tpl'}
{/block}

View File

@ -1,6 +1,5 @@
{include file="inc/head.tpl"}
<div class="wrapper">
<main class="main">
{extends file='page.tpl'}
{block name='main'}
{include file="inc/logo.tpl"}
{if isset($video->title)}
@ -15,7 +14,8 @@
{/if}
{foreach $video->entries as $entry}
<div class="playlist-entry">
<h3 class="playlist-entry-title"><a target="_blank" href="{strip}
<h3 class="playlist-entry-title">
<a target="_blank" href="{strip}
{if isset($entry->ie_key) and $entry->ie_key == Youtube and !filter_var($entry->url, FILTER_VALIDATE_URL)}
https://www.youtube.com/watch?v=
{/if}
@ -30,12 +30,11 @@
{else}
{$entry->title}
{/if}
</a></h3>
</a>
</h3>
<a target="_blank" class="downloadBtn"
href="{path_for name="download"}?url={$entry->url}">{t}Download{/t}</a>
<a target="_blank" href="{path_for name="info"}?url={$entry->url}">{t}More options{/t}</a>
</div>
{/foreach}
</main>
{include file="inc/footer.tpl"}
{/block}