Revision 1c03cb48
Added by Sam Kottler almost 12 years ago
- ID 1c03cb48d7236f96b84b8eb68a17f04abb88db9b
app/helpers/hosts_and_hostgroups_helper.rb | ||
---|---|---|
def hostgroup_name group, max_length = 1000
|
||
return if group.blank?
|
||
options = (group.to_s.size > max_length) ? {:'data-original-title'=> group.to_s, :rel=>'twipsy'} : {}
|
||
nesting = group.to_s.gsub(group.name, "")
|
||
nesting = group.to_s.gsub(/[^\/]+\/?$/, "")
|
||
nesting = truncate(nesting, :length => max_length - group.name.size) if nesting.size > 0
|
||
name = truncate(group.name.to_s, :length => max_length - nesting.size)
|
||
link_to_if_authorized(
|
Also available in: Unified diff
Fixes #1789 - Parent hostgroup name is truncated when its sub-group is a sub-string of the parent hostgroup name