add a badge icon to the enterprise feture menu item

pull/11544/head
bsatarnejad 2 years ago committed by Oliver Günther
parent 37b00f839e
commit 222f762923
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 3
      lib/redmine/menu_manager/menu_helper.rb
  2. 4
      lib/redmine/menu_manager/menu_item.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

@ -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

Loading…
Cancel
Save