Merge pull request #7122 from opf/fix/impressum-link

[29697] Add link to impressum on homescreen and help dropdown

[ci skip]
pull/7132/head
Oliver Günther 6 years ago committed by GitHub
commit 2d3308be22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/views/homescreen/index.html.erb
  2. 18
      config/initializers/homescreen.rb
  3. 2
      config/locales/en.yml
  4. 4
      docs/configuration/configuration.md
  5. 9
      lib/open_project/configuration.rb
  6. 34
      lib/open_project/static/links.rb
  7. 7
      lib/redmine/menu_manager/top_menu/help_menu.rb

@ -49,7 +49,7 @@ See docs/COPYRIGHT.rdoc for more details.
<% if show_homescreen_links? && @homescreen[:links].any? %>
<section class="homescreen--links">
<% @homescreen[:links].each do |link| %>
<% title = I18n.t(link[:label], scope: 'homescreen.links') %>
<% title = I18n.t(link[:label], scope: 'homescreen.links', default: I18n.t(link[:label])) %>
<a class="homescreen--links--item" href="<%= link[:url] %>" target="_blank" title="<%= title %>">
<%= op_icon(link[:icon]) %>
<%= title %>

@ -67,28 +67,36 @@ OpenProject::Static::Homescreen.manage :blocks do |blocks|
end
OpenProject::Static::Homescreen.manage :links do |links|
static_links = OpenProject::Static::Links.links
link_hash = OpenProject::Static::Links.links
links.push(
{
label: :user_guides,
icon: 'icon-context icon-rename',
url: static_links[:user_guides][:href]
url: link_hash[:user_guides][:href]
},
{
label: :glossary,
icon: 'icon-context icon-glossar',
url: static_links[:glossary][:href]
url: link_hash[:glossary][:href]
},
{
label: :shortcuts,
icon: 'icon-context icon-shortcuts',
url: static_links[:shortcuts][:href]
url: link_hash[:shortcuts][:href]
},
{
label: :boards,
icon: 'icon-context icon-forums',
url: static_links[:boards][:href]
url: link_hash[:boards][:href]
}
)
if impressum_link = link_hash[:impressum]
links.push({
label: impressum_link[:label],
url: impressum_link[:href],
icon: 'icon-context icon-info1'
})
end
end

@ -1339,6 +1339,7 @@ en:
label_hierarchy_leaf: "Hierarchy leaf"
label_home: "Home"
label_subject_or_id: "Subject or ID"
label_impressum: "Impressum"
label_in: "in"
label_in_less_than: "in less than"
label_in_more_than: "in more than"
@ -1471,6 +1472,7 @@ en:
label_previous_week: "Previous week"
label_principal_invite_via_email: " or invite new users via email"
label_principal_search: "Add existing users or groups"
label_privacy_policy: "Data privacy and security policy"
label_product_version: "Product version"
label_professional_support: "Professional support"
label_profile: "Profile"

@ -192,6 +192,10 @@ for the migration.
You can override the default help menu of OpenProject by specifying a `force_help_link` option to
the configuration. This value is used for the href of the help link, and the default dropdown is removed.
### Setting an impressum (legal notice) link
You can set a impressum link for your OpenProject instance by setting `impressum_link` to an absolute URL.
### hidden menu items
*default: {}*

@ -44,8 +44,6 @@ module OpenProject
'autologin_cookie_path' => '/',
'autologin_cookie_secure' => false,
'database_cipher_key' => nil,
'force_help_link' => nil,
'force_formatting_help_link' => nil,
'show_community_links' => true,
'log_level' => 'info',
'scm_git_command' => nil,
@ -70,6 +68,13 @@ module OpenProject
'rails_force_ssl' => false,
'rails_asset_host' => nil,
# Additional / overridden help links
'force_help_link' => nil,
'force_formatting_help_link' => nil,
# Impressum link to be set, nil by default (= hidden)
'impressum_link' => nil,
# user configuration
'default_comment_sort_order' => 'asc',

@ -37,7 +37,7 @@ module OpenProject
end
def help_link
OpenProject::Configuration.force_help_link.presence || links[:user_guides]
OpenProject::Configuration.force_help_link.presence || static_links[:user_guides]
end
def [](name)
@ -45,6 +45,34 @@ module OpenProject
end
def links
@links ||= static_links.merge(dynamic_links)
end
def has?(name)
@links.key? name
end
private
def dynamic_links
dynamic = {
help: {
href: help_link,
label: 'top_menu.help_and_support'
}
}
if impressum_link = OpenProject::Configuration.impressum_link
dynamic[:impressum] = {
href: impressum_link,
label: :label_impressum
}
end
dynamic
end
def static_links
{
upsale: {
href: 'https://www.openproject.org/enterprise-edition',
@ -90,6 +118,10 @@ module OpenProject
href: 'https://www.openproject.org/release-notes/',
label: :label_release_notes
},
data_privacy: {
href: 'https://www.openproject.org/data-privacy-and-security/',
label: :label_privacy_policy
},
report_bug: {
href: 'https://www.openproject.org/development/report-a-bug/',
label: :label_report_bug

@ -32,6 +32,7 @@ require 'open_project/static/links'
module Redmine::MenuManager::TopMenu::HelpMenu
def render_help_top_menu_node(item = help_menu_item)
cache_key = OpenProject::Cache::CacheKey.key('help_top_menu_node',
OpenProject::Static::Links.links,
I18n.locale,
OpenProject::Static::Links.help_link)
Rails.cache.fetch(cache_key) do
@ -117,6 +118,12 @@ module Redmine::MenuManager::TopMenu::HelpMenu
class: 'drop-down--help-headline',
title: l('top_menu.additional_resources')
end
if OpenProject::Static::Links.has? :impressum
result << static_link_item(:impressum)
end
result << static_link_item(:data_privacy)
result << static_link_item(
:website,
href_suffix: "/?utm_source=unknown&utm_medium=op-instance&utm_campaign=website-help-menu"

Loading…
Cancel
Save