Sha256: 7dbcb63617331d58eeecedbacb227095b91273622def2edb3992b2acd2a509f8

Contents?: true

Size: 484 Bytes

Versions: 6

Compression:

Stored size: 484 Bytes

Contents

class GeoZone < ActiveRecord::Base
  acts_as_tree

  def to_jstree(element_to_count)
    hash = {}
    hash[:attributes] = { :id => "#{self.class.to_s.underscore}_#{id}", :type => 'folder' }
    hash[:data] = { :title => "#{name}<span>#{self.send(element_to_count).count}</span>", :attributes => { :class => 'big-icons', :style => 'category_picture' }}
    unless children.empty?
      hash[:children] = children.collect{ |g| g.to_jstree(element_to_count)}
    end
    hash
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
forgeos_core-1.9.5.rc2 app/models/geo_zone.rb
forgeos_core-1.9.5.rc1 app/models/geo_zone.rb
forgeos_core-1.9.4 app/models/geo_zone.rb
forgeos_core-1.9.3 app/models/geo_zone.rb
forgeos_core-1.9.2 app/models/geo_zone.rb
forgeos_core-1.9.1 app/models/geo_zone.rb