diff --git a/README.md b/README.md index 44a0e52..11ed8f7 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,7 @@ The following keys are used in the project: - `tos`: Terms of Service - `privacy`: Data privacy policy - `imprint`: Imprint +- `instance-info`: Information about the instance, displayed on the landing page ## Cleanup task diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 95f2992..b4a2bb8 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,4 +1,10 @@ class HomeController < ApplicationController def index + content = Content.for('instance-info', I18n.locale) + unless content.nil? + markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, extensions = {}) + @instance_info_text = markdown.render(content.content) + @instance_info_title = content.title + end end end diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml index f8cddbb..6884078 100644 --- a/app/views/home/index.html.haml +++ b/app/views/home/index.html.haml @@ -62,3 +62,9 @@ privacy_policy: link_to(t('privacy_policy'), privacy_path), github_project: link_to('GitHub', 'https://github.com/HopHubProject')).each do |text| %p= text.html_safe + + -if @instance_info_text.present? + .col-12.col-lg-9 + .shadow.p-3.mb-5.bg-body.rounded + %h1= @instance_info_title + = @instance_info_text.html_safe diff --git a/test/controllers/home_controller_test.rb b/test/controllers/home_controller_test.rb index 3244bc5..353c2f2 100644 --- a/test/controllers/home_controller_test.rb +++ b/test/controllers/home_controller_test.rb @@ -5,6 +5,10 @@ class HomeControllerTest < ActionDispatch::IntegrationTest define_method("test_should_get_index_#{locale}") do get root_url, params: { locale: locale } assert_response :success + + c = Content.for('instance-info', locale) + assert_match c.content, @response.body + assert_match c.title, @response.body end define_method("test_should_get_imprint_#{locale}") do diff --git a/test/fixtures/contents.yml b/test/fixtures/contents.yml index 2bbdf50..8d92994 100644 --- a/test/fixtures/contents.yml +++ b/test/fixtures/contents.yml @@ -35,3 +35,10 @@ privacy_en: locale: en fallback: true content: Privacy EN + +instance_info_en: + name: instance-info + title: Instance Info + locale: en + fallback: true + content: Instance Info EN