Module: PopulateMe::Mongo::Plug::ClassMethods
- Defined in:
- lib/populate_me/mongo/plug.rb
Instance Attribute Summary collapse
-
#populate_config ⇒ Object
Returns the value of attribute populate_config.
Instance Method Summary collapse
-
#sortable_on_that_page?(r) ⇒ Boolean
def list_view® @list_options = {:request=>r, :destination=>r.fullpath, :path=>r.script_name, :filter=>r } @list_options.store(:sortable,sortable_on_that_page?) out = list_view_header out << many_to_many_picker unless populate_config.nil? out << “<ul class=‘nut-tree #if @list_options #:nut_tree_class‘ id=’#selfself.name‘ rel=’#href=":path">list_options/#selfself.name‘>” self.find(@list_options||{}).each {|m| out << m.to_nutshell } out << “</ul>” end.
Instance Attribute Details
#populate_config ⇒ Object
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
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 |