diff --git a/app/Http/Home/Controllers/WidgetController.php b/app/Http/Home/Controllers/WidgetController.php index 1d558745..f7dd3843 100644 --- a/app/Http/Home/Controllers/WidgetController.php +++ b/app/Http/Home/Controllers/WidgetController.php @@ -9,6 +9,7 @@ namespace App\Http\Home\Controllers; use App\Caches\FeaturedArticleList as FeaturedArticleListCache; use App\Caches\FeaturedCourseList as FeaturedCourseListCache; +use App\Caches\FeaturedQuestionList as FeaturedQuestionListCache; use App\Services\Logic\Article\TopAuthorList as TopAuthorListService; use App\Services\Logic\Question\HotQuestionList as HotQuestionListService; use App\Services\Logic\Question\TopAnswererList as TopAnswererListService; @@ -63,6 +64,20 @@ class WidgetController extends Controller $this->view->setVar('articles', $articles); } + /** + * @Get("/featured/questions", name="home.widget.featured_questions") + */ + public function featuredQuestionsAction() + { + $cache = new FeaturedQuestionListCache(); + + $questions = $cache->get(); + + $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); + $this->view->pick('widget/featured_questions'); + $this->view->setVar('questions', $questions); + } + /** * @Get("/hot/questions", name="home.widget.hot_questions") */ diff --git a/app/Http/Home/Views/search/index.volt b/app/Http/Home/Views/search/index.volt index 0533bb49..7532e58c 100644 --- a/app/Http/Home/Views/search/index.volt +++ b/app/Http/Home/Views/search/index.volt @@ -57,17 +57,8 @@ {% endblock %} -{% block inline_js %} +{% block include_js %} - + {{ js_include('home/js/search.index.js') }} {% endblock %} \ No newline at end of file diff --git a/app/Http/Home/Views/search/sidebar.volt b/app/Http/Home/Views/search/sidebar.volt index d5083cdb..9d23d64f 100644 --- a/app/Http/Home/Views/search/sidebar.volt +++ b/app/Http/Home/Views/search/sidebar.volt @@ -10,6 +10,17 @@ {% endif %} +{% if type == 'course' %} + {% set load_url = url({'for':'home.widget.featured_courses'}) %} +
+{% elseif type == 'article' %} + {% set load_url = url({'for':'home.widget.featured_articles'}) %} + +{% elseif type == 'question' %} + {% set load_url = url({'for':'home.widget.featured_questions'}) %} + +{% endif %} + {% if related_queries %}