1
0

blog-panel to index

This commit is contained in:
Mike Schwörer 2018-01-26 21:12:04 +01:00
parent c3566d9338
commit 1c21bdd7cf
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
15 changed files with 139 additions and 8 deletions

View File

@ -1153,6 +1153,50 @@ html, body {
.programs_pnl_bottom_1, .programs_pnl_bottom_2 { .programs_pnl_bottom_1, .programs_pnl_bottom_2 {
flex-direction: row; } } flex-direction: row; } }
/* 400px */ /* 400px */
.blog_pnl_content {
display: flex;
align-items: center;
flex-direction: column; }
.blogpnl_base {
width: 100%;
border: solid 1px #444;
margin: 10px 5px;
color: #333;
text-decoration: none;
background-color: #BBB; }
.blogpnl_date {
background-color: #AAA;
color: #333; }
.blogpnl_base:hover {
border: solid 1px black;
background-color: white;
color: black; }
.blogpnl_base:hover .blogpnl_date {
background-color: white;
color: black;
border-bottom: 1px solid black; }
.blogpnl_date {
background-color: #AAA;
border-bottom: 1px solid transparent;
padding: 2px;
font-size: 0.8em;
font-style: italic; }
.blogpnl_title {
font-weight: bold;
font-size: 1.2em;
text-align: left;
margin: 2px 0 2px 10px; }
@media (max-width: 850px) {
.blogpnl_title {
text-align: center; } }
/* 400px */
.bfjoust_runner_owner { .bfjoust_runner_owner {
border: 1px solid #888; border: 1px solid #888;
background: #F8F8F8; background: #F8F8F8;

View File

@ -278,6 +278,14 @@ html,body{margin:0;padding:0;height:100%}
.programs_pnl_bottom_sub_top{margin-left:4px;margin-right:6px} .programs_pnl_bottom_sub_top{margin-left:4px;margin-right:6px}
.programs_pnl_bottom_1,.programs_pnl_bottom_2{flex-direction:row} .programs_pnl_bottom_1,.programs_pnl_bottom_2{flex-direction:row}
} }
.blog_pnl_content{display:flex;align-items:center;flex-direction:column}
.blogpnl_base{width:100%;border:solid 1px #444;margin:10px 5px;color:#333;text-decoration:none;background-color:#BBB}
.blogpnl_date{background-color:#AAA;color:#333}
.blogpnl_base:hover{border:solid 1px black;background-color:white;color:black}
.blogpnl_base:hover .blogpnl_date{background-color:white;color:black;border-bottom:1px solid black}
.blogpnl_date{background-color:#AAA;border-bottom:1px solid transparent;padding:2px;font-size:.8em;font-style:italic}
.blogpnl_title{font-weight:bold;font-size:1.2em;text-align:left;margin:2px 0 2px 10px}
@media(max-width:850px){.blogpnl_title{text-align:center}}
.bfjoust_runner_owner{border:1px solid #888;background:#f8f8f8;padding:6px} .bfjoust_runner_owner{border:1px solid #888;background:#f8f8f8;padding:6px}
.bfjoust_runner_owner .hsplit{display:flex;flex-direction:row;flex-wrap:nowrap} .bfjoust_runner_owner .hsplit{display:flex;flex-direction:row;flex-wrap:nowrap}
.bfjoust_runner_owner .hsplit_1{flex:1;margin:4px} .bfjoust_runner_owner .hsplit_1{flex:1;margin:4px}

View File

@ -15,5 +15,6 @@
@import 'styles_eulerpanel'; @import 'styles_eulerpanel';
@import 'styles_programspanel'; @import 'styles_programspanel';
@import 'styles_blogpanel';
@import 'styles_bfjoustrunner'; @import 'styles_bfjoustrunner';
@import 'styles_befungerunner'; @import 'styles_befungerunner';

View File

@ -0,0 +1,44 @@
@import 'styles_config';
.blog_pnl_content {
display: flex;
align-items: center;
flex-direction: column;
}
.blogpnl_base {
width: 100%;
border: solid 1px #444;
margin: 10px 5px;
color: $COL_TEXT_DARK;
text-decoration: none;
background-color: #BBB;
}
.blogpnl_date { background-color: #AAA; color: $COL_TEXT_DARK; }
.blogpnl_base:hover { border: solid 1px $COL_COMPLEXHOVER_BRD; background-color: $COL_COMPLEXHOVER_BG; color: $COL_COMPLEXHOVER_FG; }
.blogpnl_base:hover .blogpnl_date { background-color: $COL_COMPLEXHOVER_BG; color: $COL_COMPLEXHOVER_FG; border-bottom: 1px solid $COL_COMPLEXHOVER_BRD; }
.blogpnl_date {
background-color: #AAA;
border-bottom: 1px solid transparent;
padding: 2px;
font-size: 0.8em;
font-style: italic;
}
.blogpnl_title {
font-weight: bold;
font-size: 1.2em;
text-align: left;
margin: 2px 0 2px 10px;
}
@include rdmedia_range(0,1) {
.blogpnl_title { text-align: center; }
}

View File

@ -56,7 +56,7 @@ $max = ceil($max / 20) * 20;
'speed' => $problem['steps'] < 500000 ? 2 : 3, 'speed' => $problem['steps'] < 500000 ? 2 : 3,
'editable' => false, 'editable' => false,
]; ];
echo require (__DIR__ . '/../fragments/befunge93_runner.php'); echo require (__DIR__ . '/../fragments/widget_befunge93.php');
if ($problem['abbreviated']) echo '<i>This program is too big to display/execute here, click [download] to get the full program. </i><br/>'; if ($problem['abbreviated']) echo '<i>This program is too big to display/execute here, click [download] to get the full program. </i><br/>';
?> ?>

View File

@ -0,0 +1,33 @@
<?php
require_once(__DIR__ . '/../internals/blog.php');
$allposts = Blog::listAllNewestFirst();
?>
<div class="index_pnl_base">
<div class="index_pnl_header">
<a href="/blog">New posts</a>
</div>
<div class="index_pnl_content blog_pnl_content">
<?php
for ($i=0; $i<3; $i++)
{
$post = $allposts[$i];
if (!$post['visible']) continue;
echo "<a class='blogpnl_base' href='" . $post['url'] . "'>\n";
echo "<div class='blogpnl_date'>" . $post['date'] . "</div>\n";
echo "<div class='blogpnl_title'>" . $post['title'] . "</div>\n";
echo "</a>\n";
}
?>
</div>
</div>

View File

@ -189,5 +189,4 @@ try {
//TODO optimize image sizes for display/download (? - auto?) //TODO optimize image sizes for display/download (? - auto?)
//TODO send cache header (?) //TODO send cache header (?)
//TODO programs add [license] //TODO programs add [license]
//TODO last 3 blog entries on /index/ (?)
//TODO global uncached error logger -> send by mail //TODO global uncached error logger -> send by mail

View File

@ -76,7 +76,7 @@ class ParsedownCustom extends ParsedownExtra
$PARAM_CODE_LEFT = trim($split[0]); $PARAM_CODE_LEFT = trim($split[0]);
$PARAM_CODE_RIGHT = trim($split[1]); $PARAM_CODE_RIGHT = trim($split[1]);
return require (__DIR__ . '/../fragments/bfjoust_runner.php'); return require (__DIR__ . '/../fragments/widget_bfjoust.php');
} }
protected function handleBef93(array $Element) protected function handleBef93(array $Element)
@ -90,6 +90,6 @@ class ParsedownCustom extends ParsedownExtra
'speed' => $Element['b93_speed'], 'speed' => $Element['b93_speed'],
'editable' => $Element['b93_editable'], 'editable' => $Element['b93_editable'],
]; ];
return require (__DIR__ . '/../fragments/befunge93_runner.php'); return require (__DIR__ . '/../fragments/widget_befunge93.php');
} }
} }

View File

@ -21,7 +21,7 @@ class Blog
return $d; return $d;
} }
public static function listAllOrderedDescending() public static function listAllNewestFirst()
{ {
$data = self::listAll(); $data = self::listAll();
usort($data, function($a, $b) { return strcasecmp($b['date'], $a['date']); }); usort($data, function($a, $b) { return strcasecmp($b['date'], $a['date']); });

View File

@ -4,7 +4,7 @@
require_once (__DIR__ . '/../internals/base.php'); require_once (__DIR__ . '/../internals/base.php');
require_once (__DIR__ . '/../internals/blog.php'); require_once (__DIR__ . '/../internals/blog.php');
$allposts = Blog::listAllOrderedDescending(); $allposts = Blog::listAllNewestFirst();
?> ?>
<head> <head>

View File

@ -16,9 +16,11 @@
<div id="content" class="content-responsive"> <div id="content" class="content-responsive">
<?php include (__DIR__ . '/../fragments/eulerpanel.php'); ?> <?php include (__DIR__ . '/../fragments/panel_euler.php'); ?>
<?php include (__DIR__ . '/../fragments/programspanel.php'); ?> <?php include (__DIR__ . '/../fragments/panel_programs.php'); ?>
<?php include (__DIR__ . '/../fragments/panel_blog.php'); ?>
</div> </div>