From ee0677e31c96d184d4dc9c532cc782847ca77387 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 14 Mar 2017 06:12:10 +0100 Subject: [PATCH] Improved http_type translation. --- .../20170314000001_fixed_translation.rb | 33 +++++++++++++++++++ db/seeds.rb | 2 +- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20170314000001_fixed_translation.rb diff --git a/db/migrate/20170314000001_fixed_translation.rb b/db/migrate/20170314000001_fixed_translation.rb new file mode 100644 index 000000000..1bd3d3647 --- /dev/null +++ b/db/migrate/20170314000001_fixed_translation.rb @@ -0,0 +1,33 @@ +class FixedTranslation < ActiveRecord::Migration + def up + + # return if it's a new setup + return if !Setting.find_by(name: 'system_init_done') + + settings_update = [ + { + 'name' => 'http_type', + 'title' => 'HTTP type', + 'description' => 'Define the http protocol of your instance.', + }, + ] + + settings_update.each { |setting| + fetched_setting = Setting.find_by(name: setting['name']) + next if !fetched_setting + + if setting['title'] + fetched_setting.title = setting['title'] + end + + if setting['description'] + fetched_setting.description = setting['description'] + end + + fetched_setting.save! + } + + Translation.load + + end +end diff --git a/db/seeds.rb b/db/seeds.rb index 5f6be2982..b663c423e 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -245,7 +245,7 @@ Setting.create_if_not_exists( title: 'HTTP type', name: 'http_type', area: 'System::Base', - description: 'Defines the type of protocol used by the web server to serve the application. If https protocol will be used instead of plain http, it must be specified in here. Since this has no effect on the web server\'s settings or behavior, it will not change the method of access to the application and, if it is wrong, it will not prevent you from logging into the application. This setting is used as a variable, #{setting.http_type} which is found in all forms of messaging used by the application, to build links to the tickets within your system.', + description: 'Define the http protocol of your instance.', options: { form: [ {