From 5bcb650b54992952e7d6e60dbf69c6983008ee79 Mon Sep 17 00:00:00 2001 From: Mantas Masalskis Date: Mon, 20 Apr 2020 13:28:53 +0200 Subject: [PATCH] Fixes #2598 - RTL writing system support in Public KB --- .../knowledge_base/search_item.coffee | 9 ++- .../app/lib/mixins/view_helpers.coffee | 7 ++ .../knowledge_base/_reader_pagination.jst.eco | 2 + .../views/knowledge_base/navigation.jst.eco | 2 +- .../app/views/knowledge_base/reader.jst.eco | 1 + .../knowledge_base_public/language.js | 1 + .../knowledge_base_public/search.js | 6 +- app/assets/stylesheets/knowledge_base.scss | 71 +++++++++++-------- app/assets/stylesheets/zammad.scss | 71 ++++++++++++------- app/helpers/knowledge_base_helper.rb | 4 ++ .../public/_inline_stylesheet.html.erb | 4 ++ .../public/_top_banner.html.erb | 1 + app/views/layouts/knowledge_base.html.erb | 6 +- 13 files changed, 122 insertions(+), 63 deletions(-) diff --git a/app/assets/javascripts/app/controllers/knowledge_base/search_item.coffee b/app/assets/javascripts/app/controllers/knowledge_base/search_item.coffee index a042d1ce2..25476bcc1 100644 --- a/app/assets/javascripts/app/controllers/knowledge_base/search_item.coffee +++ b/app/assets/javascripts/app/controllers/knowledge_base/search_item.coffee @@ -11,13 +11,16 @@ class App.KnowledgeBaseSearchItem extends App.Controller @render() data: -> + extraAttributes = @object.parent().attributesForRendering(App.KnowledgeBaseLocale.localeFor(@object)) + output = @details || {} - output['url'] = @object?.uiUrl("search-return/#{@pathSuffix}") || '#' - output['state'] = @object.parent().attributesForRendering(App.KnowledgeBaseLocale.localeFor(@object)).state + output.url = @object?.uiUrl("search-return/#{@pathSuffix}") || '#' + output.state = extraAttributes.state + output.iconFont = extraAttributes.iconFont output render: -> - @html App.view('knowledge_base/search_item')(data: @data()) + @html App.view('knowledge_base/search_item')(data: @data(), iconset: @object.parent().knowledge_base().iconset) searchLinkClicked: -> # setup history and let it continue, no need to prevent default action or bubbling if window.history? and @return_path? diff --git a/app/assets/javascripts/app/lib/mixins/view_helpers.coffee b/app/assets/javascripts/app/lib/mixins/view_helpers.coffee index 213aba1be..ccad90de6 100644 --- a/app/assets/javascripts/app/lib/mixins/view_helpers.coffee +++ b/app/assets/javascripts/app/lib/mixins/view_helpers.coffee @@ -232,3 +232,10 @@ App.ViewHelpers = replacePlaceholder: (template, items, encodeLink = false) -> App.Utils.replaceTags(template, items, encodeLink) + + # prints value depending on direction of active locale + dir: (ltr, rtl) -> + if App.i18n.dir() == 'ltr' + ltr + else + rtl diff --git a/app/assets/javascripts/app/views/knowledge_base/_reader_pagination.jst.eco b/app/assets/javascripts/app/views/knowledge_base/_reader_pagination.jst.eco index cb6c0b011..4eaa997a9 100644 --- a/app/assets/javascripts/app/views/knowledge_base/_reader_pagination.jst.eco +++ b/app/assets/javascripts/app/views/knowledge_base/_reader_pagination.jst.eco @@ -1,6 +1,7 @@ <% if @previousAnswer: %> <%- @Icon('arrow-left') %> +
<%= @previousAnswer.title %>
<% end %> @@ -8,6 +9,7 @@ <% if @nextAnswer: %> <%= @nextAnswer.title %> +
<%- @Icon('arrow-right') %>
<% end %> diff --git a/app/assets/javascripts/app/views/knowledge_base/navigation.jst.eco b/app/assets/javascripts/app/views/knowledge_base/navigation.jst.eco index 8ce1e0555..10fe6e7ee 100644 --- a/app/assets/javascripts/app/views/knowledge_base/navigation.jst.eco +++ b/app/assets/javascripts/app/views/knowledge_base/navigation.jst.eco @@ -36,7 +36,7 @@ -