diff --git a/public_html/media/css/post-list.css b/public_html/media/css/post-list.css index 16d3e68a..abf10abf 100644 --- a/public_html/media/css/post-list.css +++ b/public_html/media/css/post-list.css @@ -15,13 +15,17 @@ width: 100%; } form.aligned { + margin: 0 auto; width: 24em; text-align: left; - margin: 0 auto; } form.aligned label.left { width: 7em; } form h1 { - text-align: center; + display: none; +} + +li.mass-tag { + float: right; } diff --git a/src/Controllers/PostController.php b/src/Controllers/PostController.php index 9a899fd5..0bc47da8 100644 --- a/src/Controllers/PostController.php +++ b/src/Controllers/PostController.php @@ -63,7 +63,9 @@ class PostController { $this->context->stylesheets []= 'post-small.css'; $this->context->stylesheets []= 'post-list.css'; + $this->context->stylesheets []= 'tabs.css'; $this->context->stylesheets []= 'paginator.css'; + $this->context->viewName = 'post-list-wrapper'; if ($this->context->user->hasEnabledEndlessScrolling()) $this->context->scripts []= 'paginator-endless.js'; if ($source == 'mass-tag') @@ -150,7 +152,6 @@ class PostController public function favoritesAction($page = 1) { $this->listAction('favmin:1', $page); - $this->context->viewName = 'post-list'; } @@ -163,7 +164,6 @@ class PostController public function randomAction($page = 1) { $this->listAction('order:random', $page); - $this->context->viewName = 'post-list'; } diff --git a/src/Helpers/TextHelper.php b/src/Helpers/TextHelper.php index 40356bf2..9fc3777d 100644 --- a/src/Helpers/TextHelper.php +++ b/src/Helpers/TextHelper.php @@ -48,6 +48,14 @@ class TextHelper return $string; } + public static function humanCaseToKebabCase($string) + { + $string = trim($string); + $string = str_replace(' ', '-', $string); + $string = strtolower($string); + return $string; + } + public static function resolveConstant($constantName, $className = null) { $constantName = self::kebabCaseToCamelCase($constantName); diff --git a/src/Views/layout-normal.phtml b/src/Views/layout-normal.phtml index 0cf0d62b..57c416f4 100644 --- a/src/Views/layout-normal.phtml +++ b/src/Views/layout-normal.phtml @@ -27,12 +27,6 @@ if (PrivilegesHelper::confirm(Privilege::ListPosts)) $nav []= ['Browse', \Chibi\UrlHelper::route('post', 'list')]; - if (PrivilegesHelper::confirm(Privilege::ListPosts)) - $nav []= ['Random', \Chibi\UrlHelper::route('post', 'random')]; - - if (PrivilegesHelper::confirm(Privilege::ListPosts)) - $nav []= ['Favorites', \Chibi\UrlHelper::route('post', 'favorites')]; - if (PrivilegesHelper::confirm(Privilege::UploadPost)) $nav []= ['Upload', \Chibi\UrlHelper::route('post', 'upload')]; @@ -42,9 +36,6 @@ if (PrivilegesHelper::confirm(Privilege::ListTags)) $nav []= ['Tags', \Chibi\UrlHelper::route('tag', 'list')]; - if (PrivilegesHelper::confirm(Privilege::MassTag)) - $nav []= ['Mass tag', \Chibi\UrlHelper::route('post', 'list', ['query' => isset($this->context->transport->searchQuery) ? htmlspecialchars($this->context->transport->searchQuery) : '', 'source' => 'mass-tag'])]; - if (PrivilegesHelper::confirm(Privilege::ListUsers)) $nav []= ['Users', \Chibi\UrlHelper::route('user', 'list')]; diff --git a/src/Views/post-list-wrapper.phtml b/src/Views/post-list-wrapper.phtml new file mode 100644 index 00000000..49fc6702 --- /dev/null +++ b/src/Views/post-list-wrapper.phtml @@ -0,0 +1,33 @@ + isset($this->context->transport->searchQuery) ? htmlspecialchars($this->context->transport->searchQuery) : '', 'source' => 'mass-tag', 'page' => $this->context->transport->paginator->page])]; + +$activeTab = 0; +if ($this->context->route->simpleActionName == 'random') $activeTab = 1; +if ($this->context->route->simpleActionName == 'favorites') $activeTab = 2; +if ($this->context->source == 'mass-tag') $activeTab = 3; +?> + +