diff --git a/Dockerfile b/Dockerfile index 1567585..6d81a0a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -88,5 +88,9 @@ RUN echo 'deb https://packages.tideways.com/apt-packages debian main' > /etc/apt # Copy custom supervisor's configs and scripts # Netcat is used to connect to a memcached server RUN apt-get update && apt-get install -y netcat -COPY ./services /opt/docker/etc/supervisor.d/ -COPY ./services /opt/docker/bin/service.d/ \ No newline at end of file +COPY ./services/*.conf /opt/docker/etc/supervisor.d/ +COPY ./services/*.sh /opt/docker/bin/service.d/ + +# Ensure the service files are already executable +RUN chmod +x /opt/docker/bin/service.d/flush_cache.sh +RUN chmod +x /opt/docker/bin/service.d/tideways.sh \ No newline at end of file diff --git a/services/tideways.conf b/services/tideways.conf index 40e9068..0866828 100644 --- a/services/tideways.conf +++ b/services/tideways.conf @@ -6,9 +6,9 @@ priority=10 command=/opt/docker/bin/service.d/tideways.sh process_name=%(program_name)s startsecs=0 -startretries=0 +startretries=3 autostart=true -autorestart=false +autorestart=true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr diff --git a/vanilla/applications/vanilla/controllers/class.categoriescontroller.php b/vanilla/applications/vanilla/controllers/class.categoriescontroller.php index d3aeb2e..6bcaff8 100644 --- a/vanilla/applications/vanilla/controllers/class.categoriescontroller.php +++ b/vanilla/applications/vanilla/controllers/class.categoriescontroller.php @@ -150,12 +150,21 @@ private function getCategoryTree($category = null, $displayAs = null, $recent = case 'Default': case 'Nested': default: - $categoryTree = $this->CategoryModel - ->setJoinUserCategory(true) - ->getChildTree( - $categoryIdentifier ?: null, - ['depth' => CategoryModel::instance()->getMaxDisplayDepth() ?: 10] - ); + // FIX: https://github.com/topcoder-platform/forums/issues/487 + if( $categoryIdentifier != -1 && $categoryIdentifier != null) { + $categoryTree = $this->CategoryModel + ->setJoinUserCategory(true) + ->getChildTree( + $categoryIdentifier, + ['depth' => CategoryModel::instance()->getMaxDisplayDepth() ?: 10] + ); + } else { + $categoryTree = $this->CategoryModel + ->setJoinUserCategory(true) + ->getChildTree(-1, ['maxdepth' => 3, + 'collapsecategories' => false, + 'permission' => 'PermsDiscussionsView']); + } } if ($recent) { @@ -293,6 +302,9 @@ public function index($categoryIdentifier = '', $page = '0') { $this->setData('CategorySort', $sort); if ($categoryIdentifier == '') { + // Add jquery-accordion ui + $this->addJsFile('jquery-ui-1.10.0.custom.min.js'); + $this->addJsFile('home.js'); $this->fireEvent('EnableFollowingFilter', [ 'CategoryIdentifier' => $categoryIdentifier, 'EnableFollowingFilter' => &$this->enableFollowingFilter diff --git a/vanilla/applications/vanilla/controllers/class.discussioncontroller.php b/vanilla/applications/vanilla/controllers/class.discussioncontroller.php index 177aa68..78e40e9 100644 --- a/vanilla/applications/vanilla/controllers/class.discussioncontroller.php +++ b/vanilla/applications/vanilla/controllers/class.discussioncontroller.php @@ -125,7 +125,10 @@ public function index($DiscussionID = '', $DiscussionStub = '', $Page = '') { Gdn_Theme::section($CategoryCssClass); } - $this->setData('Breadcrumbs', $this->buildBreadcrumbs($this->CategoryID)); + $ancestors = $this->buildBreadcrumbs($this->CategoryID); + array_push($ancestors, ['Name' => $this->Discussion->Name]); + + $this->setData('Breadcrumbs', $ancestors); // Setup $this->title($this->Discussion->Name); diff --git a/vanilla/applications/vanilla/controllers/class.vanillacontroller.php b/vanilla/applications/vanilla/controllers/class.vanillacontroller.php index 5bbdc6d..c43dc9f 100644 --- a/vanilla/applications/vanilla/controllers/class.vanillacontroller.php +++ b/vanilla/applications/vanilla/controllers/class.vanillacontroller.php @@ -102,7 +102,6 @@ protected function buildBreadcrumbs($CategoryID) { } } - array_unshift($ancestors, self::ROOT_CATEGORY); return $ancestors; } } diff --git a/vanilla/applications/vanilla/js/home.js b/vanilla/applications/vanilla/js/home.js new file mode 100644 index 0000000..770972e --- /dev/null +++ b/vanilla/applications/vanilla/js/home.js @@ -0,0 +1,8 @@ +jQuery(document).ready(function($) { + $(".CategoryAccordion").accordion({ header: ".CategoryAccordionHeader", + animate:false, + collapsible: true, + active: 0, heightStyle: "content" , + icons: { "header": "icon icon-chevron-down", "activeHeader": "icon icon-chevron-up" }}); + + }); diff --git a/vanilla/applications/vanilla/views/categories/all.php b/vanilla/applications/vanilla/views/categories/all.php index ff24923..a43f03d 100644 --- a/vanilla/applications/vanilla/views/categories/all.php +++ b/vanilla/applications/vanilla/views/categories/all.php @@ -19,4 +19,8 @@ } echo ''; $categories = $this->data('CategoryTree'); -writeCategoryList($categories, 1); +if(!is_null($this->Category)) { + writeCategoryList($categories, 1); +} else { + writeCategoryAccordion($categories, 1); +} diff --git a/vanilla/applications/vanilla/views/categories/helper_functions.php b/vanilla/applications/vanilla/views/categories/helper_functions.php index 30d869e..f67b5ae 100644 --- a/vanilla/applications/vanilla/views/categories/helper_functions.php +++ b/vanilla/applications/vanilla/views/categories/helper_functions.php @@ -363,6 +363,68 @@ function writeTableRow($row, $depth = 1) { } endif; +if (!function_exists('writeCategoryAccordion')): + /** + * Renders a category list (modern view). + * + * @param $categories + * @param int $depth + */ + function writeCategoryAccordion($categories, $depth = 1) { + if (empty($categories)) { + echo '