Module: PopulateMe::Mongo::Plug::ClassMethods

Defined in:
lib/populate_me/mongo/plug.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#populate_configObject

Returns the value of attribute populate_config.



28
29
30
# File 'lib/populate_me/mongo/plug.rb', line 28

def populate_config
  @populate_config
end

Instance Method Details

#sortable_on_that_page?(r) ⇒ Boolean

def list_view®

@list_options = {:request=>r, :destination=>r.fullpath, :path=>r.script_name, :filter=>r['filter'] }
@list_options.store(:sortable,sortable_on_that_page?)
out = list_view_header
out << many_to_many_picker unless populate_config[:minilist_class].nil?
out << "<ul class='nut-tree #{'sortable' if @list_options[:sortable]} #{populate_config[:nut_tree_class]}' id='#{self.name}' rel='#{@list_options[:path]}/#{self.name}'>"
self.find(@list_options[:filter]||{}).each {|m| out << m.to_nutshell }
out << "</ul>"

end

Returns:

  • (Boolean)


40
41
42
# File 'lib/populate_me/mongo/plug.rb', line 40

def sortable_on_that_page?(r)
  @schema.key?('position') && (@schema['position'][:scope].nil? || (r['filter']||{}).key?(@schema['position'][:scope]))
end