Class: Ecm::Downloads::DownloadCategory

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
FriendlyId
Defined in:
app/models/ecm/downloads/download_category.rb

Instance Method Summary collapse

Instance Method Details

#display_codeObject

public methods



39
40
41
# File 'app/models/ecm/downloads/download_category.rb', line 39

def display_code
  "<%= render_download_category '#{self.name}' %>"
end

#index_nameObject



43
44
45
46
47
48
49
# File 'app/models/ecm/downloads/download_category.rb', line 43

def index_name
  if self.root?
    "[#{self.locale}] #{self.name}"
  else
    "#{'&#160;&#160;&#160;&#160;' * self.level} |--&#160;#{self.name}".html_safe
  end  
end

#to_sObject



51
52
53
# File 'app/models/ecm/downloads/download_category.rb', line 51

def to_s
  name
end

#tree_nameObject



55
56
57
58
59
60
61
62
63
# File 'app/models/ecm/downloads/download_category.rb', line 55

def tree_name
  root_prefix = (self.root?) ? "[#{self.locale}] " : ""
    
  if ecm_downloads_downloads_count < 1
    "#{root_prefix}#{to_s}" 
  else 
    "#{root_prefix}#{to_s} (#{ecm_downloads_downloads_count})"     
  end
end