Browse Source

Merge pull request #58 from nonmakina/sidebarFix

Fixes the sidebar so that it doesn't use iframes.
pull/40/head
towards-a-new-leftypol 3 years ago
committed by GitHub
parent
commit
9934d4c178
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 79
      templates/themes/categories/frames.html
  2. 30
      templates/themes/categories/news.html
  3. 22
      templates/themes/categories/sidebar.html
  4. 31
      templates/themes/categories/theme.php

79
templates/themes/categories/frames.html

@ -4,16 +4,77 @@
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="stylesheet" media="screen" href="{{ config.url_stylesheet }}">
<style type="text/css">
iframe{border:none;margin:0;padding:0;height:99%;position:absolute}
iframe#sidebar{left:0;top:0;width:15%}
iframe#main{border-left:1px solid black;left:15%;top:0;width:85%}
</style>
<title>{{ settings.title }}</title>
<link rel="stylesheet" media="screen" href="{{ config.url_stylesheet }}">
<style type="text/css">
.sidebar {
width: 200px;
border-right-color: gray;
border-right-style: solid;
border-width: 2px;
margin-right: 15px;
}
.content {
width: 100%;
}
body {
display: flex;
height: 100vh;
}
fieldset {
margin: 10px;
}
legend {
width: 100%;
margin-left: -15px;
background: #98E;
border: 1px solid white;
color: white;
font-weight: bold;
padding: 5px 5px
}
ul {
margin: 0;
padding: 0
}
li {
list-style: none;
padding: 0 4px;
margin: 0 4px
}
li a.system {
font-weight: bold;
}
@media (max-width:768px) {
.sidebar {
width: 80vw;
border: none;
}
.main {
flex-direction: column;
align-items: center;
}
.boardlist {
display: none;
}
footer {
display: none;
}
}
</style>
<title>{{ settings.title }}</title>
</head>
<body>
<iframe src="{{ settings.file_sidebar }}" id="sidebar" name="sidebar"></iframe>
<iframe src="{{ settings.file_news }}" id="main" name="main"></iframe>
{% include 'themes/categories/' ~ settings.file_sidebar %}
{% include 'themes/categories/' ~ settings.file_news %}
</body>
</html>

30
templates/themes/categories/news.html

@ -1,18 +1,11 @@
{% filter remove_whitespace %}
<!doctype html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>{{ settings.title }}</title>
<link rel="stylesheet" media="screen" href="{{ config.url_stylesheet }}"/>
</head>
<body>
{{ boardlist.top }}
{{ boardlist.top }}
<div class="content">
<header>
<h1>{{ settings.title }}</h1>
<div class="subtitle">{{ settings.subtitle }}</div>
</header>
<div class="ban">
{% if not news %}
<p style="text-align:center" class="unimportant">{% trans %}(No news to show.){% endtrans %}</p>
@ -30,13 +23,12 @@
{% endfor %}
{% endif %}
</div>
<footer>
<p class="unimportant" style="margin-top:20px;text-align:center;">- Tinyboard +
<a href="https://engine.vichan.net/">vichan</a> {{ config.version }} -
<br>Tinyboard Copyright &copy; 2010-2014 Tinyboard Development Group
<br><a href="https://engine.vichan.net/">vichan</a> Copyright &copy; 2012-2016 vichan-devel</p>
</footer>
</body>
</html>
<footer>
<p class="unimportant" style="margin-top:20px;text-align:center;">- Tinyboard +
<a href="https://engine.vichan.net/">vichan</a> {{ config.version }} -
<br>Tinyboard Copyright &copy; 2010-2014 Tinyboard Development Group
<br><a href="https://engine.vichan.net/">vichan</a> Copyright &copy; 2012-2016 vichan-devel</p>
</footer>
</div>
{% endfilter %}

22
templates/themes/categories/sidebar.html

@ -1,21 +1,5 @@
{% filter remove_whitespace %}
<!doctype html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>{{ settings.title }}</title>
<link rel="stylesheet" media="screen" href="{{ config.url_stylesheet }}"/>
<style type="text/css">
fieldset{margin:10px 0}
legend{width:100%;margin-left:-15px;background:#98E;border:1px solid white;color:white;font-weight:bold;padding:5px 5px}
ul{margin:0;padding:0}
li{list-style:none;padding:0 4px;margin: 0 4px}
li a.system{font-weight:bold}
</style>
<base target="main"/>
</head>
<body>
<div class="sidebar">
<fieldset>
<legend>{{ settings.title }}</legend>
<ul>
@ -50,6 +34,6 @@
{% endfor %}
</fieldset>
{% endfor %}
</body>
</html>
</div>
{% endfilter %}

31
templates/themes/categories/theme.php

@ -28,8 +28,17 @@
// Build homepage
public static function homepage($settings) {
global $config;
return Element('themes/categories/frames.html', Array('config' => $config, 'settings' => $settings));
return Element(
'themes/categories/frames.html',
Array(
'config' => $config,
'settings' => $settings,
'categories' => Categories::getCategories($config),
'boardlist' => createBoardlist(false)
)
);
}
// Build news page
@ -43,7 +52,7 @@
'settings' => $settings,
'config' => $config,
'news' => $news,
'boardlist' => createBoardlist(false)
'boardlist' => createBoardlist(false)
));
}
@ -51,6 +60,14 @@
public static function sidebar($settings) {
global $config, $board;
return Element('themes/categories/sidebar.html', Array(
'settings' => $settings,
'config' => $config,
'categories' => Categories::getCategories($config)
));
}
private static function getCategories($config) {
$categories = $config['categories'];
foreach ($categories as &$boards) {
@ -61,12 +78,8 @@
$board = Array('title' => $title, 'uri' => sprintf($config['board_path'], $board));
}
}
return Element('themes/categories/sidebar.html', Array(
'settings' => $settings,
'config' => $config,
'categories' => $categories
));
return $categories;
}
};

Loading…
Cancel
Save