From 28cc6b593865cd946ed8abe795363a8e8414a393 Mon Sep 17 00:00:00 2001 From: Georg Gadinger Date: Fri, 31 Mar 2017 22:21:19 +0200 Subject: [PATCH] Certain features can now be enabled/disabled from config --- app/views/layouts/_header.html.haml | 3 ++- app/views/shared/_sidebar.html.haml | 3 ++- config/justask.yml.example | 8 ++++++++ config/routes.rb | 4 ++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/views/layouts/_header.html.haml b/app/views/layouts/_header.html.haml index 6296893c..0c07ee32 100644 --- a/app/views/layouts/_header.html.haml +++ b/app/views/layouts/_header.html.haml @@ -22,7 +22,8 @@ %ul.nav.navbar-nav = nav_entry t('views.navigation.timeline'), root_path = nav_entry t('views.navigation.inbox'), "/inbox", badge: inbox_count - = nav_entry t('views.navigation.discover'), discover_path + - if APP_CONFIG.dig(:features, :discover, :enabled) + = nav_entry t('views.navigation.discover'), discover_path %ul.nav.navbar-nav.navbar-right - unless @user.nil? - unless @user == current_user diff --git a/app/views/shared/_sidebar.html.haml b/app/views/shared/_sidebar.html.haml index 2f14e14e..645f2e8d 100644 --- a/app/views/shared/_sidebar.html.haml +++ b/app/views/shared/_sidebar.html.haml @@ -25,7 +25,8 @@ .panel.panel-default.hidden-xs .list-group = list_group_item t('views.general.timeline'), root_path - = list_group_item t('views.general.public'), public_timeline_path + - if APP_CONFIG.dig(:features, :public, :enabled) + = list_group_item t('views.general.public'), public_timeline_path - current_user.groups.each do |group| = list_group_item group.display_name, group_timeline_path(group.name) - unless @group.nil? diff --git a/config/justask.yml.example b/config/justask.yml.example index 821464e5..6af4a606 100644 --- a/config/justask.yml.example +++ b/config/justask.yml.example @@ -12,6 +12,14 @@ anonymous_name: "Anonymous" # How many items (questions, answers, ...) do you want to show per page? items_per_page: 10 +features: + # "Discover" page + discover: + enabled: true + # Public timeline + public: + enabled: true + # OAuth tokens sharing: twitter: diff --git a/config/routes.rb b/config/routes.rb index 8723e78b..a3a6dc72 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -103,8 +103,8 @@ Rails.application.routes.draw do match '/unsubscribe', to: 'subscription#unsubscribe', via: :post, as: :unsubscribe_answer end - match '/discover', to: 'discover#index', via: :get, as: :discover - match '/public', to: 'public#index', via: :get, as: :public_timeline + match '/discover', to: 'discover#index', via: :get, as: :discover if APP_CONFIG.dig(:features, :discover, :enabled) + match '/public', to: 'public#index', via: :get, as: :public_timeline if APP_CONFIG.dig(:features, :public, :enabled) match '/group/:group_name', to: 'group#index', via: :get, as: :group_timeline match '/notifications(/:type)', to: 'notifications#index', via: :get, as: :notifications, defaults: {type: 'new'}