From 67dcc7c4f8e441d09d90255be138bda525fc2de5 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Sat, 12 Oct 2013 12:38:49 +0200 Subject: [PATCH] Better looking post view --- public_html/media/css/core.css | 34 +++++------- public_html/media/css/post-view.css | 61 ++++++++++---------- public_html/media/css/upload.css | 5 +- src/Controllers/PostController.php | 8 ++- src/Views/layout-normal.phtml | 12 ++-- src/Views/post-upload.phtml | 12 ++-- src/Views/post-view.phtml | 86 +++++++++++++++-------------- 7 files changed, 115 insertions(+), 103 deletions(-) diff --git a/public_html/media/css/core.css b/public_html/media/css/core.css index 55c59c6d..9f791da9 100644 --- a/public_html/media/css/core.css +++ b/public_html/media/css/core.css @@ -37,6 +37,10 @@ body { list-style-type: none; } +.main-wrapper { + margin: 0 1.5em; +} + #top-nav li { display: inline-block; } @@ -71,31 +75,23 @@ body { 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 { + display: block; clear: both; } #sidebar { float: left; - width: 25%; - margin-right: 1em; + width: 256px; + margin-right: 2em; +} + +#sidebar .sidebar-unit { + margin: 0 0 2em 0; + padding: 1em; + border: 1px solid #eee; + padding-left: 0; + border-left: 0; } #sidebar h1 { diff --git a/public_html/media/css/post-view.css b/public_html/media/css/post-view.css index fcd05019..26a466d1 100644 --- a/public_html/media/css/post-view.css +++ b/public_html/media/css/post-view.css @@ -1,13 +1,13 @@ +#sidebar { + width: 200px; +} + .post-wrapper { /*text-align: center;*/ } +img, embed { - width: 100%; - height: 500px; - margin: 0 auto; -} -img { max-width: 100%; } @@ -21,6 +21,22 @@ img { color: silver; } +nav { + margin-bottom: 2em; +} +nav .left { + float: left; +} +nav .right { + float: right; +} +nav a.inactive { + color: silver; +} +nav a.inactive i[class*='icon-'] { + background-color: silver; +} + i.icon-prev { background-position: -12px -1px; } @@ -41,36 +57,23 @@ i.icon-dl { background-position: -22px -1px; } -nav .left { - float: left; +.permalink { + margin: 1em 0; } -nav .right { - float: right; +.permalink .icon-dl { + vertical-align: middle; + margin-right: 1em; } -nav a.inactive { - color: silver; +.permalink span { + vertical-align: middle; } -nav a.inactive i[class*='icon-'] { - background-color: silver; -} -#sidebar h1 { - margin-top: 1em; +.permalink .ext:after { + content: ', '; } -.dl-box { - float: left; - margin: 0 2em 0 1em; -} -.dl-box span { - display: block; - text-align: center; - font-size: small; -} - -.details-box { - font-size: small; +.details { line-height: 1.33em; } -.details-box .key { +.details .key { margin-right: 0.5em; } diff --git a/public_html/media/css/upload.css b/public_html/media/css/upload.css index 8bd3044a..b1dc1c2c 100644 --- a/public_html/media/css/upload.css +++ b/public_html/media/css/upload.css @@ -17,10 +17,9 @@ font-size: 150%; text-align: center; vertical-align: middle; - height: 200px; - width: 100%; + height: 300px; display: table-cell; - border: 3px dashed #eee; + border: 3px dashed #ddd; } #file-handler.active { background: #eee; diff --git a/src/Controllers/PostController.php b/src/Controllers/PostController.php index b86c183e..279c25e1 100644 --- a/src/Controllers/PostController.php +++ b/src/Controllers/PostController.php @@ -136,15 +136,19 @@ class PostController #$mimeType = $suppliedFile['type']; $mimeType = mime_content_type($suppliedFile['tmp_name']); + $imageWidth = null; + $imageHeight = null; switch ($mimeType) { case 'image/gif': case 'image/png': case 'image/jpeg': $postType = PostType::Image; + list ($imageWidth, $imageHeight) = getimagesize($suppliedFile['tmp_name']); break; case 'application/x-shockwave-flash': $postType = PostType::Flash; + list ($imageWidth, $imageHeight) = getimagesize($suppliedFile['tmp_name']); break; default: throw new SimpleException('Invalid file type "' . $mimeType . '"'); @@ -180,12 +184,14 @@ class PostController $dbPost->name = $name; $dbPost->orig_name = basename($suppliedFile['name']); $dbPost->file_hash = $fileHash; + $dbPost->file_size = filesize($suppliedFile['tmp_name']); $dbPost->mime_type = $mimeType; $dbPost->safety = $suppliedSafety; $dbPost->upload_date = time(); $dbPost->sharedTag = $dbTags; $dbPost->user = $this->context->user; - $dbPost->size = filesize($suppliedFile['tmp_name']); + $dbPost->image_width = $imageWidth; + $dbPost->image_height = $imageHeight; move_uploaded_file($suppliedFile['tmp_name'], $path); R::store($dbPost); diff --git a/src/Views/layout-normal.phtml b/src/Views/layout-normal.phtml index 6e99f616..78c57027 100644 --- a/src/Views/layout-normal.phtml +++ b/src/Views/layout-normal.phtml @@ -26,18 +26,18 @@ if (PrivilegesHelper::confirm($this->context->user, Privilege::ListPosts)) $nav []= ['Browse', \Chibi\UrlHelper::route('post', 'list')]; - if (PrivilegesHelper::confirm($this->context->user, Privilege::ListComments)) - $nav []= ['Comments', \Chibi\UrlHelper::route('comment', 'list')]; - if (PrivilegesHelper::confirm($this->context->user, Privilege::ListPosts)) $nav []= ['Favorites', \Chibi\UrlHelper::route('post', 'favorites')]; - if (PrivilegesHelper::confirm($this->context->user, Privilege::ListTags)) - $nav []= ['Tags', \Chibi\UrlHelper::route('tag', 'list')]; - if (PrivilegesHelper::confirm($this->context->user, Privilege::UploadPost)) $nav []= ['Upload', \Chibi\UrlHelper::route('post', 'upload')]; + if (PrivilegesHelper::confirm($this->context->user, Privilege::ListComments)) + $nav []= ['Comments', \Chibi\UrlHelper::route('comment', 'list')]; + + if (PrivilegesHelper::confirm($this->context->user, Privilege::ListTags)) + $nav []= ['Tags', \Chibi\UrlHelper::route('tag', 'list')]; + if (PrivilegesHelper::confirm($this->context->user, Privilege::ListUsers)) $nav []= ['Users', \Chibi\UrlHelper::route('user', 'list')]; diff --git a/src/Views/post-upload.phtml b/src/Views/post-upload.phtml index dd0dd49b..b87091ed 100644 --- a/src/Views/post-upload.phtml +++ b/src/Views/post-upload.phtml @@ -5,11 +5,13 @@
diff --git a/src/Views/post-view.phtml b/src/Views/post-view.phtml index 44339a8b..d3790aab 100644 --- a/src/Views/post-view.phtml +++ b/src/Views/post-view.phtml @@ -29,45 +29,7 @@
-
-

details

- - -
- - -
- Date: - context->transport->post->upload_date) ?> -
- -
- Safety: - context->transport->post->safety) ?> -
-
-
- -
+ + + @@ -94,7 +100,7 @@ context->transport->post->type == PostType::Image): ?> <?php echo $this->context->transport->post->name ?> context->transport->post->type == PostType::Flash): ?> - +