From 5b2c6c0608b558de13e4ef0716bdda9965903d54 Mon Sep 17 00:00:00 2001 From: Herb Daily Date: Sun, 1 Apr 2012 15:52:01 -0300 Subject: [PATCH] fix mat path tests --- lib/marley/joints/forum.rb | 3 +- lib/marley/joints/tags.rb | 1 + rdoc/orm_materialized_path_plugin.rdoc | 39 +++++++++++++------------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/lib/marley/joints/forum.rb b/lib/marley/joints/forum.rb index 42b2d76..3305ad1 100644 --- a/lib/marley/joints/forum.rb +++ b/lib/marley/joints/forum.rb @@ -50,7 +50,8 @@ def section_nav self.reggae_link(:new, 'New Post'), self.reggae_link(:list, 'All Posts'), self.reggae_link(:recent_topics, 'Recent Topics'), - Marley::ReggaeSection.new({:title => 'Public Tags', :navigation => MR::PublicTag.filter(:id => topics.select(:messages__id)).map{|t| reggae_link('list',t.tag,"#{resource_name}[_public_tags]=#{t.tag}")}}) + Marley::ReggaeSection.new({:title => 'Public Tags', :navigation => MR::PublicTag.group(:tag).map{|t| reggae_link('list',t[:tag],"#{resource_name}[_public_tags]=#{t.tag}")}}), + Marley::ReggaeSection.new({:title => 'Private Tags', :navigation => MR::PrivateTag.current_user_ds.join(:messages_tags,:tags_id => :tags__id).join(:messages,:messages__id => :message_id).filter(:message_type => 'PublicMessage').group(:tag).map{|t| reggae_link('list',t[:tag],"#{resource_name}[_private_tags]=#{t.tag}")}}) ] end def recent_topics diff --git a/lib/marley/joints/tags.rb b/lib/marley/joints/tags.rb index ca003ec..a0e5ee3 100644 --- a/lib/marley/joints/tags.rb +++ b/lib/marley/joints/tags.rb @@ -72,6 +72,7 @@ class PublicTag < Tag end class PrivateTag < Tag MR::User.join_to(self) if MR::User + Marley.plugin(:current_user_methods).apply(self) def self.list_dataset(params={}) current_user_ds.order(:tag) end diff --git a/rdoc/orm_materialized_path_plugin.rdoc b/rdoc/orm_materialized_path_plugin.rdoc index 758d43b..42e44ab 100644 --- a/rdoc/orm_materialized_path_plugin.rdoc +++ b/rdoc/orm_materialized_path_plugin.rdoc @@ -3,46 +3,47 @@ examples: >> MR::Tree.new(:name => 'asdf').save.reggae_instance -=> [:instance, {:schema=> [[:integer, :id, 2, 1], [:text, :name, 0, "asdf"], [:text, :path, 0, nil]], :url=>"/tree/1", :new_rec=>false, :name=>"tree", :actions=>nil}, []] +=> [:instance, {:schema=> [[:integer, :id, 2, 1], [:text, :name, 0, "asdf"]], :url=>"/tree/1", :new_rec=>false, :name=>"tree", :actions=>nil}, []] >> MR::Tree[1].new_child.reggae_instance -=> [:instance, {:schema=>[[:text, :name, 0, nil], [:text, :path, 0, "1-"]], :url=>"/tree/", :new_rec=>true, :name=>"tree", :actions=>nil}, nil] +=> [:instance, {:schema=>[[:text, :name, 0, nil]], :url=>"/tree/", :new_rec=>true, :name=>"tree", :actions=>nil}, nil] >> MR::Tree[1].new_child.save.reggae_instance -=> [:instance, {:schema=> [[:integer, :id, 2, 2], [:text, :name, 0, nil], [:text, :path, 0, "1-"]], :url=>"/tree/2", :new_rec=>false, :name=>"tree", :actions=>nil}, []] +=> [:instance, {:schema=> [[:integer, :id, 2, 2], [:text, :name, 0, nil]], :url=>"/tree/2", :new_rec=>false, :name=>"tree", :actions=>nil}, []] >> MR::Tree[1].new_child.save.reggae_instance -=> [:instance, {:schema=> [[:integer, :id, 2, 3], [:text, :name, 0, nil], [:text, :path, 0, "1-"]], :url=>"/tree/3", :new_rec=>false, :name=>"tree", :actions=>nil}, []] +=> [:instance, {:schema=> [[:integer, :id, 2, 3], [:text, :name, 0, nil]], :url=>"/tree/3", :new_rec=>false, :name=>"tree", :actions=>nil}, []] >> MR::Tree[1].new_child.save.reggae_instance -=> [:instance, {:schema=> [[:integer, :id, 2, 4], [:text, :name, 0, nil], [:text, :path, 0, "1-"]], :url=>"/tree/4", :new_rec=>false, :name=>"tree", :actions=>nil}, []] +=> [:instance, {:schema=> [[:integer, :id, 2, 4], [:text, :name, 0, nil]], :url=>"/tree/4", :new_rec=>false, :name=>"tree", :actions=>nil}, []] >> MR::Tree[2].new_child.save.reggae_instance -=> [:instance, {:schema=> [[:integer, :id, 2, 5], [:text, :name, 0, nil], [:text, :path, 0, "1-2-"]], :url=>"/tree/5", :new_rec=>false, :name=>"tree", :actions=>nil}, []] +=> [:instance, {:schema=> [[:integer, :id, 2, 5], [:text, :name, 0, nil]], :url=>"/tree/5", :new_rec=>false, :name=>"tree", :actions=>nil}, []] >> MR::Tree[5].new_child.save.reggae_instance -=> [:instance, {:schema=> [[:integer, :id, 2, 6], [:text, :name, 0, nil], [:text, :path, 0, "1-2-5-"]], :url=>"/tree/6", :new_rec=>false, :name=>"tree", :actions=>nil}, []] +=> [:instance, {:schema=> [[:integer, :id, 2, 6], [:text, :name, 0, nil]], :url=>"/tree/6", :new_rec=>false, :name=>"tree", :actions=>nil}, []] >> MR::Tree[3].new_child.save.reggae_instance -=> [:instance, {:schema=> [[:integer, :id, 2, 7], [:text, :name, 0, nil], [:text, :path, 0, "1-3-"]], :url=>"/tree/7", :new_rec=>false, :name=>"tree", :actions=>nil}, []] +=> [:instance, {:schema=> [[:integer, :id, 2, 7], [:text, :name, 0, nil]], :url=>"/tree/7", :new_rec=>false, :name=>"tree", :actions=>nil}, []] >> MR::Tree[3].new_child.save.reggae_instance -=> [:instance, {:schema=> [[:integer, :id, 2, 8], [:text, :name, 0, nil], [:text, :path, 0, "1-3-"]], :url=>"/tree/8", :new_rec=>false, :name=>"tree", :actions=>nil}, []] +=> [:instance, {:schema=> [[:integer, :id, 2, 8], [:text, :name, 0, nil]], :url=>"/tree/8", :new_rec=>false, :name=>"tree", :actions=>nil}, []] >> MR::Tree[3].new_child.save.reggae_instance -=> [:instance, {:schema=> [[:integer, :id, 2, 9], [:text, :name, 0, nil], [:text, :path, 0, "1-3-"]], :url=>"/tree/9", :new_rec=>false, :name=>"tree", :actions=>nil}, []] +=> [:instance, {:schema=> [[:integer, :id, 2, 9], [:text, :name, 0, nil]], :url=>"/tree/9", :new_rec=>false, :name=>"tree", :actions=>nil}, []] >> MR::Tree[3].new_child.save.reggae_instance -=> [:instance, {:schema=> [[:integer, :id, 2, 10], [:text, :name, 0, nil], [:text, :path, 0, "1-3-"]], :url=>"/tree/10", :new_rec=>false, :name=>"tree", :actions=>nil}, []] +=> [:instance, {:schema=> [[:integer, :id, 2, 10], [:text, :name, 0, nil]], :url=>"/tree/10", :new_rec=>false, :name=>"tree", :actions=>nil}, []] >> MR::Tree[1].new_child.save.reggae_instance -=> [:instance, {:schema=> [[:integer, :id, 2, 11], [:text, :name, 0, nil], [:text, :path, 0, "1-"]], :url=>"/tree/11", :new_rec=>false, :name=>"tree", :actions=>nil}, []] +=> [:instance, {:schema=> [[:integer, :id, 2, 11], [:text, :name, 0, nil]], :url=>"/tree/11", :new_rec=>false, :name=>"tree", :actions=>nil}, []] >> MR::Tree[1].new_child.save.reggae_instance -=> [:instance, {:schema=> [[:integer, :id, 2, 12], [:text, :name, 0, nil], [:text, :path, 0, "1-"]], :url=>"/tree/12", :new_rec=>false, :name=>"tree", :actions=>nil}, []] +=> [:instance, {:schema=> [[:integer, :id, 2, 12], [:text, :name, 0, nil]], :url=>"/tree/12", :new_rec=>false, :name=>"tree", :actions=>nil}, []] >> MR::Tree[2].new_child.save.reggae_instance -=> [:instance, {:schema=> [[:integer, :id, 2, 13], [:text, :name, 0, nil], [:text, :path, 0, "1-2-"]], :url=>"/tree/13", :new_rec=>false, :name=>"tree", :actions=>nil}, []] +=> [:instance, {:schema=> [[:integer, :id, 2, 13], [:text, :name, 0, nil]], :url=>"/tree/13", :new_rec=>false, :name=>"tree", :actions=>nil}, []] >> MR::Tree[5].new_child.save.reggae_instance -=> [:instance, {:schema=> [[:integer, :id, 2, 14], [:text, :name, 0, nil], [:text, :path, 0, "1-2-5-"]], :url=>"/tree/14", :new_rec=>false, :name=>"tree", :actions=>nil}, []] +=> [:instance, {:schema=> [[:integer, :id, 2, 14], [:text, :name, 0, nil]], :url=>"/tree/14", :new_rec=>false, :name=>"tree", :actions=>nil}, []] >> MR::Tree[3].new_child.save.reggae_instance -=> [:instance, {:schema=> [[:integer, :id, 2, 15], [:text, :name, 0, nil], [:text, :path, 0, "1-3-"]], :url=>"/tree/15", :new_rec=>false, :name=>"tree", :actions=>nil}, []] +=> [:instance, {:schema=> [[:integer, :id, 2, 15], [:text, :name, 0, nil]], :url=>"/tree/15", :new_rec=>false, :name=>"tree", :actions=>nil}, []] >> MR::Tree[7].new_child.save.reggae_instance -=> [:instance, {:schema=> [[:integer, :id, 2, 16], [:text, :name, 0, nil], [:text, :path, 0, "1-3-7-"]], :url=>"/tree/16", :new_rec=>false, :name=>"tree", :actions=>nil}, []] +=> [:instance, {:schema=> [[:integer, :id, 2, 16], [:text, :name, 0, nil]], :url=>"/tree/16", :new_rec=>false, :name=>"tree", :actions=>nil}, []] >> MR::Tree[13].new_child.save.reggae_instance -=> [:instance, {:schema=> [[:integer, :id, 2, 17], [:text, :name, 0, nil], [:text, :path, 0, "1-2-13-"]], :url=>"/tree/17", :new_rec=>false, :name=>"tree", :actions=>nil}, []] +=> [:instance, {:schema=> [[:integer, :id, 2, 17], [:text, :name, 0, nil]], :url=>"/tree/17", :new_rec=>false, :name=>"tree", :actions=>nil}, []] + >> MR::Tree[1].values_tree -=> [1, "asdf", nil, [[2, nil, "1-", [], [5, nil, "1-2-", [], [6, nil, "1-2-5-", []], [14, nil, "1-2-5-", []]], [13, nil, "1-2-", [], [17, nil, "1-2-13-", []]]], [3, nil, "1-", [], [7, nil, "1-3-", [], [16, nil, "1-3-7-", []]], [8, nil, "1-3-", []], [9, nil, "1-3-", []], [10, nil, "1-3-", []], [15, nil, "1-3-", []]], [4, nil, "1-", []], [11, nil, "1-", []], [12, nil, "1-", []]]] +=> [1, "asdf", [[2, nil, [[5, nil, [[6, nil, []], [14, nil, []]]], [13, nil, [[17, nil, []]]]]], [3, nil, [[7, nil, [[16, nil, []]]], [8, nil, []], [9, nil, []], [10, nil, []], [15, nil, []]]], [4, nil, []], [11, nil, []], [12, nil, []]]]