Browse Source

use #depth computron

pull/1/head
Nicolae Claudius 13 years ago
parent
commit
f971478f90
  1. 9
      app/helpers/domains_helper.rb

9
app/helpers/domains_helper.rb

@ -9,10 +9,9 @@ module DomainsHelper
# Adds a visual cue if the record is shared via permissions feature.
def domain_name_column(record)
elements = []
@previous_records ||= []
level = @previous_records.reduce(0) { |acc, r| record.subdomain_of?(r) ? acc + 1 : acc }
if level > 0
(level - 1).times do # indent
depth = record.depth
if depth > 1 && @previous_record && record.subdomain_of?(@previous_record)
(depth - 2).times do # indent
elements << '<span class="ui-icon ui-icon-blank"></span>'
end
elements << '<span class="ui-icon ui-icon-carat-1-sw"></span>'
@ -25,7 +24,7 @@ module DomainsHelper
data-content="This domain was shared with you by #{h who}"></i>
HTM
end
@previous_records << record
@previous_record = record
elements.join.html_safe
end
end
Loading…
Cancel
Save