marley 0.8.2 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,6 +25,7 @@ module Marley
25
25
  else
26
26
  Marley::ReggaeInstanceList.new(
27
27
  :name => resource_name,
28
+ :actions => {:get => :reply},
28
29
  :schema => t[0].reggae_schema(true),
29
30
  :items => t.map{|t| t.thread_vals},
30
31
  :recursive => true
@@ -50,7 +51,8 @@ module Marley
50
51
  self.reggae_link(:new, 'New Post'),
51
52
  self.reggae_link(:list, 'All Posts'),
52
53
  self.reggae_link(:recent_topics, 'Recent Topics'),
53
- Marley::ReggaeSection.new({:title => 'Public Tags', :navigation => MR::PublicTag.filter(:id => topics.all.map{|t|}).map{|t| reggae_link('list',t.tag,"#{resource_name}[_public_tags]=#{t.tag}")}})
54
+ Marley::ReggaeSection.new({:title => 'Public Tags', :navigation => MR::PublicTag.group(:tag).map{|t| reggae_link('list',t[:tag],"#{resource_name}[_public_tags]=#{t.tag}")}}),
55
+ Marley::ReggaeSection.new({:title => 'Private Tags', :navigation => MR::PrivateTag.current_user_ds.join(:messages_tags,:tag_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}")}})
54
56
  ]
55
57
  end
56
58
  def recent_topics
@@ -72,6 +72,7 @@ module Marley
72
72
  end
73
73
  class PrivateTag < Tag
74
74
  MR::User.join_to(self) if MR::User
75
+ Marley.plugin(:current_user_methods).apply(self)
75
76
  def self.list_dataset(params={})
76
77
  current_user_ds.order(:tag)
77
78
  end
@@ -21,7 +21,7 @@ module Marley
21
21
  module ClassMethods
22
22
  def current_user; $request && $request[:user]; end
23
23
  def current_user_class; current_user.class; end
24
- def current_user_ds; filter(@owner_col.to_sym => current_user[:id]); end
24
+ def current_user_ds; filter("#{table_name}__#{@owner_col}".to_sym => current_user[:id]); end
25
25
  def requires_user?(verb=nil,meth=nil);true;end
26
26
  def authorize_rest_get(meth)
27
27
  model_actions[:get].to_a.include?(meth.to_sym) && !current_user.new?
@@ -6,9 +6,9 @@ require 'factory_girl'
6
6
  Sequel::Model.send(:alias_method, :save!, :save)
7
7
 
8
8
  USERS=5
9
- TOPICS=40
9
+ TOPICS=5
10
10
  TAGS=3
11
- REPLIES=4
11
+ REPLIES=2
12
12
  FactoryGirl.define do
13
13
  [:name,:title,:tag,:message].each do |seq|
14
14
  sequence seq do |n|
@@ -3,46 +3,47 @@
3
3
  examples:
4
4
 
5
5
  >> MR::Tree.new(:name => 'asdf').save.reggae_instance
6
- => [:instance, {:schema=> [[:integer, :id, 2, 1], [:text, :name, 0, "asdf"], [:text, :path, 0, nil]], :url=>"/tree/1", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
6
+ => [:instance, {:schema=> [[:integer, :id, 2, 1], [:text, :name, 0, "asdf"]], :url=>"/tree/1", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
7
7
  >> MR::Tree[1].new_child.reggae_instance
8
- => [:instance, {:schema=>[[:text, :name, 0, nil], [:text, :path, 0, "1-"]], :url=>"/tree/", :new_rec=>true, :name=>"tree", :actions=>nil}, nil]
8
+ => [:instance, {:schema=>[[:text, :name, 0, nil]], :url=>"/tree/", :new_rec=>true, :name=>"tree", :actions=>nil}, nil]
9
9
  >> MR::Tree[1].new_child.save.reggae_instance
10
- => [:instance, {:schema=> [[:integer, :id, 2, 2], [:text, :name, 0, nil], [:text, :path, 0, "1-"]], :url=>"/tree/2", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
10
+ => [:instance, {:schema=> [[:integer, :id, 2, 2], [:text, :name, 0, nil]], :url=>"/tree/2", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
11
11
  >> MR::Tree[1].new_child.save.reggae_instance
12
- => [:instance, {:schema=> [[:integer, :id, 2, 3], [:text, :name, 0, nil], [:text, :path, 0, "1-"]], :url=>"/tree/3", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
12
+ => [:instance, {:schema=> [[:integer, :id, 2, 3], [:text, :name, 0, nil]], :url=>"/tree/3", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
13
13
  >> MR::Tree[1].new_child.save.reggae_instance
14
- => [:instance, {:schema=> [[:integer, :id, 2, 4], [:text, :name, 0, nil], [:text, :path, 0, "1-"]], :url=>"/tree/4", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
14
+ => [:instance, {:schema=> [[:integer, :id, 2, 4], [:text, :name, 0, nil]], :url=>"/tree/4", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
15
15
  >> MR::Tree[2].new_child.save.reggae_instance
16
- => [: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}, []]
16
+ => [:instance, {:schema=> [[:integer, :id, 2, 5], [:text, :name, 0, nil]], :url=>"/tree/5", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
17
17
  >> MR::Tree[5].new_child.save.reggae_instance
18
- => [: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}, []]
18
+ => [:instance, {:schema=> [[:integer, :id, 2, 6], [:text, :name, 0, nil]], :url=>"/tree/6", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
19
19
  >> MR::Tree[3].new_child.save.reggae_instance
20
- => [: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}, []]
20
+ => [:instance, {:schema=> [[:integer, :id, 2, 7], [:text, :name, 0, nil]], :url=>"/tree/7", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
21
21
 
22
22
  >> MR::Tree[3].new_child.save.reggae_instance
23
- => [: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}, []]
23
+ => [:instance, {:schema=> [[:integer, :id, 2, 8], [:text, :name, 0, nil]], :url=>"/tree/8", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
24
24
  >> MR::Tree[3].new_child.save.reggae_instance
25
- => [: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}, []]
25
+ => [:instance, {:schema=> [[:integer, :id, 2, 9], [:text, :name, 0, nil]], :url=>"/tree/9", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
26
26
  >> MR::Tree[3].new_child.save.reggae_instance
27
- => [: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}, []]
27
+ => [:instance, {:schema=> [[:integer, :id, 2, 10], [:text, :name, 0, nil]], :url=>"/tree/10", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
28
28
 
29
29
  >> MR::Tree[1].new_child.save.reggae_instance
30
- => [:instance, {:schema=> [[:integer, :id, 2, 11], [:text, :name, 0, nil], [:text, :path, 0, "1-"]], :url=>"/tree/11", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
30
+ => [:instance, {:schema=> [[:integer, :id, 2, 11], [:text, :name, 0, nil]], :url=>"/tree/11", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
31
31
  >> MR::Tree[1].new_child.save.reggae_instance
32
- => [:instance, {:schema=> [[:integer, :id, 2, 12], [:text, :name, 0, nil], [:text, :path, 0, "1-"]], :url=>"/tree/12", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
32
+ => [:instance, {:schema=> [[:integer, :id, 2, 12], [:text, :name, 0, nil]], :url=>"/tree/12", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
33
33
  >> MR::Tree[2].new_child.save.reggae_instance
34
- => [: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}, []]
34
+ => [:instance, {:schema=> [[:integer, :id, 2, 13], [:text, :name, 0, nil]], :url=>"/tree/13", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
35
35
  >> MR::Tree[5].new_child.save.reggae_instance
36
- => [: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}, []]
36
+ => [:instance, {:schema=> [[:integer, :id, 2, 14], [:text, :name, 0, nil]], :url=>"/tree/14", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
37
37
  >> MR::Tree[3].new_child.save.reggae_instance
38
- => [: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}, []]
38
+ => [:instance, {:schema=> [[:integer, :id, 2, 15], [:text, :name, 0, nil]], :url=>"/tree/15", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
39
39
 
40
40
  >> MR::Tree[7].new_child.save.reggae_instance
41
- => [: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}, []]
41
+ => [:instance, {:schema=> [[:integer, :id, 2, 16], [:text, :name, 0, nil]], :url=>"/tree/16", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
42
42
  >> MR::Tree[13].new_child.save.reggae_instance
43
- => [: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}, []]
43
+ => [:instance, {:schema=> [[:integer, :id, 2, 17], [:text, :name, 0, nil]], :url=>"/tree/17", :new_rec=>false, :name=>"tree", :actions=>nil}, []]
44
+
44
45
 
45
46
  >> MR::Tree[1].values_tree
46
- => [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-", []]]]
47
+ => [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, []]]]
47
48
 
48
49
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marley
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Herb Daily
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2012-04-01 00:00:00 -03:00
12
+ date: 2012-04-02 00:00:00 -03:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency