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