From 1c21bdd7cff2ae54da16613cabc58b2e4a8d5cbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Fri, 26 Jan 2018 21:12:04 +0100 Subject: [PATCH] blog-panel to index --- www/data/css/styles.css | 44 +++++++++++++++++++ www/data/css/styles.min.css | 8 ++++ www/data/css/styles.scss | 1 + www/data/css/styles_blogpanel.scss | 44 +++++++++++++++++++ www/fragments/blogview_euler_single.php | 2 +- www/fragments/panel_blog.php | 33 ++++++++++++++ .../{eulerpanel.php => panel_euler.php} | 0 .../{programspanel.php => panel_programs.php} | 0 ...unge93_runner.php => widget_befunge93.php} | 0 ...{bfjoust_runner.php => widget_bfjoust.php} | 0 www/index.php | 1 - www/internals/ParsedownCustom.php | 4 +- www/internals/blog.php | 2 +- www/pages/blog_list.php | 2 +- www/pages/main.php | 6 ++- 15 files changed, 139 insertions(+), 8 deletions(-) create mode 100644 www/data/css/styles_blogpanel.scss create mode 100644 www/fragments/panel_blog.php rename www/fragments/{eulerpanel.php => panel_euler.php} (100%) rename www/fragments/{programspanel.php => panel_programs.php} (100%) rename www/fragments/{befunge93_runner.php => widget_befunge93.php} (100%) rename www/fragments/{bfjoust_runner.php => widget_bfjoust.php} (100%) diff --git a/www/data/css/styles.css b/www/data/css/styles.css index 4042d7d..d2b25e9 100644 --- a/www/data/css/styles.css +++ b/www/data/css/styles.css @@ -1153,6 +1153,50 @@ html, body { .programs_pnl_bottom_1, .programs_pnl_bottom_2 { flex-direction: row; } } /* 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 { border: 1px solid #888; background: #F8F8F8; diff --git a/www/data/css/styles.min.css b/www/data/css/styles.min.css index a41d41c..f41c2ac 100644 --- a/www/data/css/styles.min.css +++ b/www/data/css/styles.min.css @@ -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_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 .hsplit{display:flex;flex-direction:row;flex-wrap:nowrap} .bfjoust_runner_owner .hsplit_1{flex:1;margin:4px} diff --git a/www/data/css/styles.scss b/www/data/css/styles.scss index c5948b4..12a1138 100644 --- a/www/data/css/styles.scss +++ b/www/data/css/styles.scss @@ -15,5 +15,6 @@ @import 'styles_eulerpanel'; @import 'styles_programspanel'; +@import 'styles_blogpanel'; @import 'styles_bfjoustrunner'; @import 'styles_befungerunner'; \ No newline at end of file diff --git a/www/data/css/styles_blogpanel.scss b/www/data/css/styles_blogpanel.scss new file mode 100644 index 0000000..3803656 --- /dev/null +++ b/www/data/css/styles_blogpanel.scss @@ -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; } +} \ No newline at end of file diff --git a/www/fragments/blogview_euler_single.php b/www/fragments/blogview_euler_single.php index 3b154ad..4792acd 100644 --- a/www/fragments/blogview_euler_single.php +++ b/www/fragments/blogview_euler_single.php @@ -56,7 +56,7 @@ $max = ceil($max / 20) * 20; 'speed' => $problem['steps'] < 500000 ? 2 : 3, 'editable' => false, ]; - echo require (__DIR__ . '/../fragments/befunge93_runner.php'); + echo require (__DIR__ . '/../fragments/widget_befunge93.php'); if ($problem['abbreviated']) echo 'This program is too big to display/execute here, click [download] to get the full program.
'; ?> diff --git a/www/fragments/panel_blog.php b/www/fragments/panel_blog.php new file mode 100644 index 0000000..4dd168b --- /dev/null +++ b/www/fragments/panel_blog.php @@ -0,0 +1,33 @@ + + +
+ +
+ New posts +
+
+ + \n"; + echo "
" . $post['date'] . "
\n"; + echo "
" . $post['title'] . "
\n"; + echo "\n"; + + } + + ?> + +
+ +
\ No newline at end of file diff --git a/www/fragments/eulerpanel.php b/www/fragments/panel_euler.php similarity index 100% rename from www/fragments/eulerpanel.php rename to www/fragments/panel_euler.php diff --git a/www/fragments/programspanel.php b/www/fragments/panel_programs.php similarity index 100% rename from www/fragments/programspanel.php rename to www/fragments/panel_programs.php diff --git a/www/fragments/befunge93_runner.php b/www/fragments/widget_befunge93.php similarity index 100% rename from www/fragments/befunge93_runner.php rename to www/fragments/widget_befunge93.php diff --git a/www/fragments/bfjoust_runner.php b/www/fragments/widget_bfjoust.php similarity index 100% rename from www/fragments/bfjoust_runner.php rename to www/fragments/widget_bfjoust.php diff --git a/www/index.php b/www/index.php index 4516e54..60691f2 100644 --- a/www/index.php +++ b/www/index.php @@ -189,5 +189,4 @@ try { //TODO optimize image sizes for display/download (? - auto?) //TODO send cache header (?) //TODO programs add [license] -//TODO last 3 blog entries on /index/ (?) //TODO global uncached error logger -> send by mail diff --git a/www/internals/ParsedownCustom.php b/www/internals/ParsedownCustom.php index b64e70b..52589b9 100644 --- a/www/internals/ParsedownCustom.php +++ b/www/internals/ParsedownCustom.php @@ -76,7 +76,7 @@ class ParsedownCustom extends ParsedownExtra $PARAM_CODE_LEFT = trim($split[0]); $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) @@ -90,6 +90,6 @@ class ParsedownCustom extends ParsedownExtra 'speed' => $Element['b93_speed'], 'editable' => $Element['b93_editable'], ]; - return require (__DIR__ . '/../fragments/befunge93_runner.php'); + return require (__DIR__ . '/../fragments/widget_befunge93.php'); } } \ No newline at end of file diff --git a/www/internals/blog.php b/www/internals/blog.php index 42740af..6c8ea6c 100644 --- a/www/internals/blog.php +++ b/www/internals/blog.php @@ -21,7 +21,7 @@ class Blog return $d; } - public static function listAllOrderedDescending() + public static function listAllNewestFirst() { $data = self::listAll(); usort($data, function($a, $b) { return strcasecmp($b['date'], $a['date']); }); diff --git a/www/pages/blog_list.php b/www/pages/blog_list.php index 9e82301..d36423a 100644 --- a/www/pages/blog_list.php +++ b/www/pages/blog_list.php @@ -4,7 +4,7 @@ require_once (__DIR__ . '/../internals/base.php'); require_once (__DIR__ . '/../internals/blog.php'); -$allposts = Blog::listAllOrderedDescending(); +$allposts = Blog::listAllNewestFirst(); ?> diff --git a/www/pages/main.php b/www/pages/main.php index b55c436..d98d875 100644 --- a/www/pages/main.php +++ b/www/pages/main.php @@ -16,9 +16,11 @@
- + - + + +