FIX: Relative links in translations should work with subfolder

This commit is contained in:
Gerhard Schlager
2018-11-07 17:59:42 +01:00
parent 5c845c5877
commit 24e5be3f0c
32 changed files with 217 additions and 116 deletions

View File

@ -28,9 +28,10 @@ unless Rails.env.test?
create_static_page_topic('tos_topic_id', 'tos_topic.title', "tos_topic.body", nil, staff, "terms of service", company_domain: "company_domain",
company_full_name: "company_full_name",
company_name: "company_short_name")
company_name: "company_short_name",
base_path: Discourse.base_path)
create_static_page_topic('guidelines_topic_id', 'guidelines_topic.title', "guidelines_topic.body", nil, staff, "guidelines")
create_static_page_topic('guidelines_topic_id', 'guidelines_topic.title', "guidelines_topic.body", nil, staff, "guidelines", base_path: Discourse.base_path)
create_static_page_topic('privacy_topic_id', 'privacy_topic.title', "privacy_topic.body", nil, staff, "privacy policy")
end
@ -38,15 +39,15 @@ end
if seed_welcome_topics
puts "Seeding welcome topics"
PostCreator.create(Discourse.system_user, raw: I18n.t('assets_topic_body'), title: I18n.t('assets_topic_title'), skip_validations: true, category: staff ? staff.name : nil)
PostCreator.create(Discourse.system_user, raw: I18n.t('assets_topic_body', base_path: Discourse.base_path), title: I18n.t('assets_topic_title'), skip_validations: true, category: staff ? staff.name : nil)
post = PostCreator.create(Discourse.system_user, raw: I18n.t('discourse_welcome_topic.body'), title: I18n.t('discourse_welcome_topic.title'), skip_validations: true)
post = PostCreator.create(Discourse.system_user, raw: I18n.t('discourse_welcome_topic.body', base_path: Discourse.base_path), title: I18n.t('discourse_welcome_topic.title'), skip_validations: true)
post.topic.update_pinned(true, true)
TopicCustomField.create(topic_id: post.topic.id, name: "is_welcome_topic", value: "true")
lounge = Category.find_by(id: SiteSetting.lounge_category_id)
if lounge
post = PostCreator.create(Discourse.system_user, raw: I18n.t('lounge_welcome.body'), title: I18n.t('lounge_welcome.title'), skip_validations: true, category: lounge.name)
post = PostCreator.create(Discourse.system_user, raw: I18n.t('lounge_welcome.body', base_path: Discourse.base_path), title: I18n.t('lounge_welcome.title'), skip_validations: true, category: lounge.name)
post.topic.update_pinned(true)
end

View File

@ -5,7 +5,7 @@ class MigrateTosSetting < ActiveRecord::Migration[4.2]
label = nil
I18n.overrides_disabled do
label = I18n.t("terms_of_service.signup_form_message")
label = I18n.t("terms_of_service.signup_form_message", base_path: "")
end
res = execute("SELECT value FROM site_texts WHERE text_type = 'tos_signup_form_message'")

View File

@ -1,7 +1,7 @@
class FixTosName < ActiveRecord::Migration[4.2]
def up
I18n.overrides_disabled do
execute DB.sql_fragment('UPDATE user_fields SET name = ? WHERE name = ?', I18n.t('terms_of_service.title'), I18n.t("terms_of_service.signup_form_message"))
execute DB.sql_fragment('UPDATE user_fields SET name = ? WHERE name = ?', I18n.t('terms_of_service.title'), I18n.t("terms_of_service.signup_form_message", base_path: ""))
end
end