From c3458007168e293bd88aeb256c73779de32a30a9 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Sat, 5 Oct 2013 22:52:55 +0200 Subject: [PATCH] Placeholder stylesheets Now I can look at this. --- public_html/media/css/core.css | 79 ++++++++++++++++++++++++++ src/Bootstrap.php | 2 + src/Controllers/CommentController.php | 1 + src/Controllers/IndexController.php | 1 + src/Controllers/PostController.php | 18 ++++++ src/Views/layout-normal.phtml | 80 +++++++++++++++++---------- 6 files changed, 152 insertions(+), 29 deletions(-) create mode 100644 public_html/media/css/core.css diff --git a/public_html/media/css/core.css b/public_html/media/css/core.css new file mode 100644 index 00000000..20975579 --- /dev/null +++ b/public_html/media/css/core.css @@ -0,0 +1,79 @@ +body { + background: white; + color: black; + margin: 0; + padding: 0; + font-family: sans-serif; + font-size: 12pt; +} + +#content { + padding: 0; + margin: 1.5em 0.75em; +} + +nav { + background: #eee; + color: black; +} + +nav ul { + margin: 0; + padding: 0; + list-style-type: none; +} + +nav li { + display: inline-block; +} + +nav li input, +nav li a { + color: black; + display: inline-block; + margin-bottom: 3px; + text-decoration: none; +} + +nav li a { + padding: 0.2em 0.75em; + outline: 0; +} + +nav li.search { + background: white; + margin: 0 0.25em; + padding: 0.2em 0.5em; +} + +nav li a:focus, +nav li a:hover { + color: firebrick; + border-bottom: 3px solid firebrick; + margin-bottom: 0; +} + +nav li.search input { + border: 0; +} + +.main-wrapper { + margin: 0 auto; + min-width: 700px; + width: 80%; + max-width: 1000px; +} + +/* small screens */ +@media (max-width: 699px), (max-device-width: 699px) { + .main-wrapper { + min-width: 0; + width: 95%; + max-width: 700px; + } +} + + +.clear { + clear: both; +} diff --git a/src/Bootstrap.php b/src/Bootstrap.php index b89ccbdd..75cfa1a1 100644 --- a/src/Bootstrap.php +++ b/src/Bootstrap.php @@ -28,6 +28,8 @@ class Bootstrap session_start(); $this->context->title = $this->config->main->title; + $this->context->stylesheets = ['core.css']; + $this->context->layoutName = isset($_GET['json']) ? 'layout-json' : 'layout-normal'; diff --git a/src/Controllers/CommentController.php b/src/Controllers/CommentController.php index b76c70e6..556b6889 100644 --- a/src/Controllers/CommentController.php +++ b/src/Controllers/CommentController.php @@ -6,6 +6,7 @@ class CommentController */ public function listAction() { + $this->context->activeSection = 'comments'; $this->context->subTitle = 'comments'; throw new Exception('Not implemented'); } diff --git a/src/Controllers/IndexController.php b/src/Controllers/IndexController.php index 7aeb998a..25002e47 100644 --- a/src/Controllers/IndexController.php +++ b/src/Controllers/IndexController.php @@ -7,6 +7,7 @@ class IndexController */ public function indexAction() { + $this->context->activeSection = 'home'; $this->context->subTitle = 'home'; } } diff --git a/src/Controllers/PostController.php b/src/Controllers/PostController.php index 78232405..24167d9d 100644 --- a/src/Controllers/PostController.php +++ b/src/Controllers/PostController.php @@ -8,7 +8,17 @@ class PostController */ public function listAction($query = null) { + #redirect requests in form of /posts/?query=... to canonical address + $formQuery = InputHelper::get('query'); + if (!empty($formQuery)) + { + $url = \Chibi\UrlHelper::route('post', 'list', ['query' => $formQuery]); + \Chibi\UrlHelper::forward($url); + return; + } + $this->context->subTitle = 'browsing posts'; + $this->context->searchQuery = $query; throw new Exception('Not implemented'); } @@ -29,4 +39,12 @@ class PostController $this->context->subTitle = 'showing @' . $id; throw new Exception('Not implemented'); } + + /** + * @route /favorites + */ + public function favoritesAction() + { + $this->listAction('favmin:1'); + } } diff --git a/src/Views/layout-normal.phtml b/src/Views/layout-normal.phtml index fc1d74e2..8b4da758 100644 --- a/src/Views/layout-normal.phtml +++ b/src/Views/layout-normal.phtml @@ -7,41 +7,63 @@ <?php echo $this->context->title ?> + context->stylesheets as $name): ?> + + -
- renderView() ?> +
+
+ renderView() ?> +