Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

add a badge icon to the enterprise feture menu item

bsatarnejad222f76292360
diff --git a/lib/redmine/menu_manager/menu_helper.rb b/lib/redmine/menu_manager/menu_helper.rb
index 177cf6e71e8..67f8ddfcd32 100644
--- a/lib/redmine/menu_manager/menu_helper.rb
+++ b/lib/redmine/menu_manager/menu_helper.rb
@@ -170,6 +170,9 @@ module Redmine::MenuManager::MenuHelper
lang: menu_item_locale(item)) do
''.html_safe + caption + badge_for(item)
end
+ if item.enterprise_feature.present? && !EnterpriseToken.allows_to?(item.enterprise_feature) && !EnterpriseToken.current
+ link_text << (' '.html_safe + spot_icon('spot-icon spot-icon_enterprise-badge'))
+ end
link_text << (' '.html_safe + op_icon(item.icon_after)) if item.icon_after.present?
html_options = item.html_options(selected:)
html_options[:title] ||= selected ? t(:description_current_position) + caption : caption
diff --git a/lib/redmine/menu_manager/menu_item.rb b/lib/redmine/menu_manager/menu_item.rb
index e764d92a60b..129c7c93a56 100644
--- a/lib/redmine/menu_manager/menu_item.rb
+++ b/lib/redmine/menu_manager/menu_item.rb
@@ -37,7 +37,8 @@ class Redmine::MenuManager::MenuItem < Redmine::MenuManager::TreeNode
:child_menus,
:last,
:partial,
- :engine
+ :engine,
+ :enterprise_feature
def initialize(name, url, options)
raise ArgumentError, "Invalid option :if for menu item '#{name}'" if options[:if] && !options[:if].respond_to?(:call)
@@ -55,6 +56,7 @@ class Redmine::MenuManager::MenuItem < Redmine::MenuManager::TreeNode
@param = options[:param] || :project_id
@icon = options[:icon]
@icon_after = options[:icon_after]
+ @enterprise_feature = options[:enterprise_feature]
@caption = options[:caption]
@context = options[:context]
@html_options = options[:html].nil? ? {} : options[:html].dup