Add translation interface feature setting
Allow to enable/disable translation interface at frontend
This commit is contained in:
committed by
voodoorai2000
parent
3176be43d9
commit
7e3f0b5c18
@@ -6,6 +6,14 @@ module TranslatableFormHelper
|
||||
end
|
||||
end
|
||||
|
||||
def translations_interface_enabled?
|
||||
Setting["feature.translation_interface"].present? || backend_translations_enabled?
|
||||
end
|
||||
|
||||
def backend_translations_enabled?
|
||||
(controller.class.parents & [Admin, Management, Valuation]).any?
|
||||
end
|
||||
|
||||
class TranslatableFormBuilder < FoundationRailsHelper::FormBuilder
|
||||
attr_accessor :translations
|
||||
|
||||
|
||||
@@ -116,6 +116,8 @@ en:
|
||||
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. Also custom pages and menus can be created in the "Custom pages" and "Custom content blocks" sections'
|
||||
translation_interface: "Translation interface"
|
||||
translation_interface_description: "Displays the manual translation interface that allows users to enter their content in all application available languages. This option only affects user application forms and independently will always be active in the administration panel."
|
||||
valuation_comment_notification: "Valuation comment notification"
|
||||
valuation_comment_notification_description: "Send an email to all associated users except valuation commenter to budget investment when a new valuation comment is created"
|
||||
map:
|
||||
|
||||
@@ -116,6 +116,8 @@ es:
|
||||
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. También se pueden crear páginas y menús personalizados en las secciones "Personalizar páginas" y "Personalizar bloques"'
|
||||
translation_interface: "Interfaz de traducción"
|
||||
translation_interface_description: "Muestra la interfaz de traducción manual permitiendo a los usuarios introducir sus contenidos en todos los idiomas disponibles de la aplicación si así lo desean. Esta opción solo afecta a las vistas de usuarios de la aplicación, en el panel de administración está activa siempre."
|
||||
valuation_comment_notification: "Notificar comentarios de evaluación"
|
||||
valuation_comment_notification_description: "Envía un email a todos los usuarios menos al que haya comentado asociados a un presupuesto participativo cuando se cree un nuevo comentario de evaluación"
|
||||
map:
|
||||
|
||||
@@ -24,11 +24,16 @@ describe "Budget Investments" do
|
||||
context "Concerns" do
|
||||
it_behaves_like "notifiable in-app", Budget::Investment
|
||||
it_behaves_like "relationable", Budget::Investment
|
||||
it_behaves_like "new_translatable",
|
||||
"budget_investment",
|
||||
"new_budget_investment_path",
|
||||
%w[title],
|
||||
{ "description" => :ckeditor }
|
||||
context "Translatable at front end" do
|
||||
before do
|
||||
Setting["feature.translation_interface"] = true
|
||||
end
|
||||
it_behaves_like "new_translatable",
|
||||
"budget_investment",
|
||||
"new_budget_investment_path",
|
||||
%w[title],
|
||||
{ "description" => :ckeditor }
|
||||
end
|
||||
end
|
||||
|
||||
context "Load" do
|
||||
|
||||
@@ -11,16 +11,21 @@ describe "Debates" do
|
||||
context "Concerns" do
|
||||
it_behaves_like "notifiable in-app", Debate
|
||||
it_behaves_like "relationable", Debate
|
||||
it_behaves_like "new_translatable",
|
||||
"debate",
|
||||
"new_debate_path",
|
||||
%w[title],
|
||||
{ "description" => :ckeditor }
|
||||
it_behaves_like "edit_translatable",
|
||||
"debate",
|
||||
"edit_debate_path",
|
||||
%w[title],
|
||||
{ "description" => :ckeditor }
|
||||
context "Translatable at front end" do
|
||||
before do
|
||||
Setting["feature.translation_interface"] = true
|
||||
end
|
||||
it_behaves_like "new_translatable",
|
||||
"debate",
|
||||
"new_debate_path",
|
||||
%w[title],
|
||||
{ "description" => :ckeditor }
|
||||
it_behaves_like "edit_translatable",
|
||||
"debate",
|
||||
"edit_debate_path",
|
||||
%w[title],
|
||||
{ "description" => :ckeditor }
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Index" do
|
||||
|
||||
@@ -15,16 +15,21 @@ describe "Proposals" do
|
||||
context "Concerns" do
|
||||
it_behaves_like "notifiable in-app", Proposal
|
||||
it_behaves_like "relationable", Proposal
|
||||
it_behaves_like "new_translatable",
|
||||
"proposal",
|
||||
"new_proposal_path",
|
||||
%w[title summary],
|
||||
{ "description" => :ckeditor }
|
||||
it_behaves_like "edit_translatable",
|
||||
"proposal",
|
||||
"edit_proposal_path",
|
||||
%w[title summary],
|
||||
{ "description" => :ckeditor }
|
||||
context "Translatable at front end" do
|
||||
before do
|
||||
Setting["feature.translation_interface"] = true
|
||||
end
|
||||
it_behaves_like "new_translatable",
|
||||
"proposal",
|
||||
"new_proposal_path",
|
||||
%w[title summary],
|
||||
{ "description" => :ckeditor }
|
||||
it_behaves_like "edit_translatable",
|
||||
"proposal",
|
||||
"edit_proposal_path",
|
||||
%w[title summary],
|
||||
{ "description" => :ckeditor }
|
||||
end
|
||||
end
|
||||
|
||||
context "Index" do
|
||||
|
||||
Reference in New Issue
Block a user