Revision aeab6f88
Added by Amos Benari about 12 years ago
- ID aeab6f885dc212dcbb47d9f88cbf9fa1de7ea27a
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 = truncate(group.to_s.gsub(group.name, ""), :length => max_length - group.name.size)
|
||
nesting = group.to_s.gsub(group.name, "")
|
||
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(
|
||
content_tag(:span,
|
||
content_tag(:span, nesting, :class => "gray") + group.name, options),
|
||
content_tag(:span, nesting, :class => "gray") + name, options),
|
||
hash_for_edit_hostgroup_path(:id => group))
|
||
end
|
||
|
Also available in: Unified diff
fixed a bug in the host-group truncation function.