Adds setting to enable or disable help page

This commit is contained in:
decabeza
2018-09-28 18:59:28 +02:00
parent 2c22ab347d
commit dd11a040a6
7 changed files with 48 additions and 8 deletions

View File

@@ -1,6 +1,9 @@
class PagesController < ApplicationController
include FeatureFlags
skip_authorization_check
feature_flag :help_page, if: lambda { params[:id] == "help/index" }
def show
@custom_page = SiteCustomization::Page.published.find_by(slug: params[:id])
@banners = Banner.in_section('help_page').with_active

View File

@@ -54,13 +54,15 @@
title: t("shared.go_to_page") + t("layouts.header.budgets") %>
</li>
<% end %>
<% if feature?(:help_page) %>
<li>
<%= link_to t("layouts.header.help"),
<%= layout_menu_link_to t("layouts.header.help"),
help_path,
current_page?(help_path),
accesskey: "6",
class: ("is-active" if current_page?(help_path)),
title: t("shared.go_to_page") + t("layouts.header.help") %>
</li>
<% end %>
<%= raw content_block("subnavigation_right", I18n.locale) %>
</ul>

View File

@@ -119,3 +119,5 @@ en:
guides_description: "Displays a guide to differences between proposals and investment projects if there is an active participatory budget"
public_stats: "Public stats"
public_stats_description: "Display public stats in the Administration panel"
help_page: "Help page"
help_page_description: "Displays a Help menu that contains a page with an info section about each enabled feature"

View File

@@ -119,3 +119,5 @@ es:
guides_description: "Muestra una guía de diferencias entre las propuestas y los proyectos de gasto si hay un presupuesto participativo activo"
public_stats: "Estadísticas públicas"
public_stats_description: "Muestra las estadísticas públicas en el panel de Administración"
help_page: "Página de Ayuda"
help_page_description: "Muestra un menú Ayuda que contiene una página con una sección de información sobre cada funcionalidad habilitada."

View File

@@ -49,6 +49,7 @@ section "Creating Settings" do
Setting.create(key: 'feature.public_stats', value: "true")
Setting.create(key: 'feature.guides', value: nil)
Setting.create(key: 'feature.user.skip_verification', value: "true")
Setting.create(key: 'feature.help_page', value: "true")
Setting.create(key: 'per_page_code_head', value: "")
Setting.create(key: 'per_page_code_body', value: "")

View File

@@ -89,6 +89,7 @@ Setting['feature.map'] = nil
Setting['feature.allow_images'] = true
Setting['feature.allow_attached_documents'] = true
Setting['feature.guides'] = nil
Setting['feature.help_page'] = true
# Spending proposals feature flags
Setting['feature.spending_proposal_features.voting_allowed'] = nil

View File

@@ -0,0 +1,29 @@
require 'rails_helper'
feature 'Help page' do
context 'Index' do
scenario 'Help menu and page is visible if feature is enabled' do
Setting['feature.help_page'] = true
visit root_path
expect(page).to have_link 'Help'
within('#navigation_bar') do
click_link 'Help'
end
expect(page).to have_content('CONSUL is a platform for citizen participation')
end
scenario 'Help menu and page is hidden if feature is disabled' do
Setting['feature.help_page'] = nil
visit root_path
expect(page).not_to have_link 'Help'
end
end
end