card 1.15.4 → 1.15.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/config/initializers/recaptcha.rb +1 -1
  4. data/db/migrate_core_cards/20141208162106_add_ace_script.rb +2 -4
  5. data/db/migrate_core_cards/20150508212032_menu_compatibility.rb +1 -2
  6. data/db/migrate_core_cards/20150605115802_add_performance_log_card.rb +7 -0
  7. data/lib/card/content.rb +6 -0
  8. data/lib/card/log.rb +110 -17
  9. data/lib/card/query.rb +31 -21
  10. data/lib/cardio.rb +1 -0
  11. data/mod/01_core/set/all/collection.rb +42 -8
  12. data/mod/01_core/set/all/permissions.rb +21 -21
  13. data/mod/01_core/set/all/templating.rb +18 -12
  14. data/mod/01_core/spec/set/all/collection_spec.rb +7 -1
  15. data/mod/01_history/set/all/content_history.rb +14 -12
  16. data/mod/02_basic_types/set/type/pointer.rb +54 -24
  17. data/mod/03_machines/lib/javascript/wagn_mod.js.coffee +1 -1
  18. data/mod/03_machines/lib/stylesheets/style_cards.scss +3 -0
  19. data/mod/03_machines/set/type/scss.rb +5 -5
  20. data/mod/05_email/set/right/follow.rb +3 -3
  21. data/mod/05_standard/set/all/rich_html/content.rb +17 -13
  22. data/mod/05_standard/set/self/performance_log.rb +92 -0
  23. data/mod/05_standard/set/type/search_type.rb +15 -17
  24. data/spec/lib/card/content_spec.rb +12 -0
  25. metadata +4 -17
  26. data/db/seed/README.md +0 -2
  27. data/db/seed/new/card_actions.yml +0 -4495
  28. data/db/seed/new/card_acts.yml +0 -7
  29. data/db/seed/new/card_changes.yml +0 -29416
  30. data/db/seed/new/card_references.yml +0 -4348
  31. data/db/seed/new/cards.yml +0 -28134
  32. data/db/seed/test/fixtures/.gitkeep +0 -0
  33. data/db/seed/test/fixtures/card_actions.yml +0 -6336
  34. data/db/seed/test/fixtures/card_acts.yml +0 -841
  35. data/db/seed/test/fixtures/card_changes.yml +0 -34632
  36. data/db/seed/test/fixtures/card_references.yml +0 -5783
  37. data/db/seed/test/fixtures/cards.yml +0 -32803
  38. data/db/seed/test/fixtures/mao2.jpg +0 -0
  39. data/db/seed/test/fixtures/rails.gif +0 -0
  40. data/db/seed/test/seed.rb +0 -201
@@ -1,201 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
- require 'timecop'
3
-
4
- class SharedData
5
- #attr_accessor :users
6
- USERS = [
7
- 'Joe User', 'Joe Admin', 'Joe Camel', 'Sample User', 'No count',
8
- 'u1', 'u2', 'u3',
9
- 'Big Brother', 'Optic fan', 'Sunglasses fan', 'Narcissist'
10
- ]
11
-
12
- def self.account_args hash
13
- { "+*account" => { "+*password" =>'joe_pass' }.merge( hash ) }
14
- end
15
-
16
- def self.add_test_data
17
-
18
- Card::Cache.reset_global
19
- Card::Env.reset
20
- Card::Auth.as_bot
21
-
22
- Card.create! :name=>"Joe User", :type_code=>'user', :content=>"I'm number two", :subcards=>account_args( '+*email'=>'joe@user.com' )
23
- Card.create! :name=>"Joe Admin", :type_code=>'user', :content=>"I'm number one", :subcards=>account_args( '+*email'=>'joe@admin.com' )
24
- Card.create! :name=>"Joe Camel", :type_code=>'user', :content=>"Mr. Buttz", :subcards=>account_args( '+*email'=>'joe@camel.com' )
25
-
26
- Card['Joe Admin'].fetch(:trait=>:roles, :new=>{:type_code=>'pointer'}).items = [ Card::AdministratorID ]
27
-
28
- Card.create! :name=>'signup alert email+*to', :content=>'signups@wagn.org'
29
-
30
- # generic, shared attribute card
31
- color = Card.create! :name=>"color"
32
- basic = Card.create! :name=>"Basic Card"
33
-
34
- # data for testing users and account requests
35
-
36
- Card.create! :type_code=>'user', :name=>"No Count", :content=>"I got no account"
37
-
38
-
39
- Card.create! :name=>"Sample User", :type_code=>'user', :subcards=>account_args('+*email'=>'sample@user.com', '+*password'=>'sample_pass')
40
-
41
- # CREATE A CARD OF EACH TYPE
42
-
43
- Card.create! :type_id=>Card::SignupID, :name=>"Sample Signup" #, :email=>"invitation@request.com"
44
- #above still necessary? try commenting out above and 'Sign up' below
45
- Card::Auth.current_id = Card::WagnBotID # need to reset after creating sign up, which changes current_id for extend phase
46
-
47
- Card::Auth.createable_types.each do |type|
48
- next if ['User', 'Sign up', 'Set', 'Number'].include? type
49
- Card.create! :type=>type, :name=>"Sample #{type}"
50
- end
51
-
52
-
53
-
54
- # data for role_test.rb
55
-
56
- Card.create! :name=>"u1", :type_code=>'user', :subcards=>account_args('+*email'=>'u1@user.com', '+*password'=>'u1_pass')
57
- Card.create! :name=>"u2", :type_code=>'user', :subcards=>account_args('+*email'=>'u2@user.com', '+*password'=>'u2_pass')
58
- Card.create! :name=>"u3", :type_code=>'user', :subcards=>account_args('+*email'=>'u3@user.com', '+*password'=>'u3_pass')
59
-
60
- r1 = Card.create!( :type_code=>'role', :name=>'r1' )
61
- r2 = Card.create!( :type_code=>'role', :name=>'r2' )
62
- r3 = Card.create!( :type_code=>'role', :name=>'r3' )
63
- r4 = Card.create!( :type_code=>'role', :name=>'r4' )
64
-
65
- Card['u1'].fetch( :trait=>:roles, :new=>{} ).items = [ r1, r2, r3 ]
66
- Card['u2'].fetch( :trait=>:roles, :new=>{} ).items = [ r1, r2, r4 ]
67
- Card['u3'].fetch( :trait=>:roles, :new=>{} ).items = [ r1, r4, Card::AdministratorID ]
68
-
69
- c1 = Card.create! :name=>'c1'
70
- c2 = Card.create! :name=>'c2'
71
- c3 = Card.create! :name=>'c3'
72
-
73
- # cards for rename_test
74
- # FIXME: could probably refactor these..
75
- z = Card.create! :name=>"Z", :content=>"I'm here to be referenced to"
76
- a = Card.create! :name=>"A", :content=>"Alpha [[Z]]"
77
- b = Card.create! :name=>"B", :content=>"Beta {{Z}}"
78
- t = Card.create! :name=>"T", :content=>"Theta"
79
- x = Card.create! :name=>"X", :content=>"[[A]] [[A+B]] [[T]]"
80
- y = Card.create! :name=>"Y", :content=>"{{B}} {{A+B}} {{A}} {{T}}"
81
- ab = Card.create! :name => "A+B", :content => "AlphaBeta"
82
-
83
- Card.create! :name=>"One+Two+Three"
84
- Card.create! :name=>"Four+One+Five"
85
-
86
- # for wql & permissions
87
- %w{ A+C A+D A+E C+A D+A F+A A+B+C }.each do |name| Card.create!(:name=>name) end
88
- Card.create! :type_code=>'cardtype', :name=>"Cardtype A", :codename=>"cardtype_a"
89
- Card.create! :type_code=>'cardtype', :name=>"Cardtype B", :codename=>"cardtype_b"
90
- Card.create! :type_code=>'cardtype', :name=>"Cardtype C", :codename=>"cardtype_c"
91
- Card.create! :type_code=>'cardtype', :name=>"Cardtype D", :codename=>"cardtype_d"
92
- Card.create! :type_code=>'cardtype', :name=>"Cardtype E", :codename=>"cardtype_e"
93
- Card.create! :type_code=>'cardtype', :name=>"Cardtype F", :codename=>"cardtype_f"
94
-
95
- Card.create! :name=>'basicname', :content=>'basiccontent'
96
- Card.create! :type_code=>'cardtype_a', :name=>"type-a-card", :content=>"type_a_content"
97
- Card.create! :type_code=>'cardtype_b', :name=>"type-b-card", :content=>"type_b_content"
98
- Card.create! :type_code=>'cardtype_c', :name=>"type-c-card", :content=>"type_c_content"
99
- Card.create! :type_code=>'cardtype_d', :name=>"type-d-card", :content=>"type_d_content"
100
- Card.create! :type_code=>'cardtype_e', :name=>"type-e-card", :content=>"type_e_content"
101
- Card.create! :type_code=>'cardtype_f', :name=>"type-f-card", :content=>"type_f_content"
102
-
103
- #warn "current user #{User.session_user.inspect}. always ok? #{Card::Auth.always_ok?}"
104
- c = Card.create! :name=>'revtest', :content=>'first'
105
- c.update_attributes! :content=>'second'
106
- c.update_attributes! :content=>'third'
107
- #Card.create! :type_code=>'cardtype', :name=>'*priority'
108
-
109
- # for template stuff
110
- Card.create! :type_id=>Card::CardtypeID, :name=> "UserForm"
111
- Card.create! :name=>"UserForm+*type+*structure", :content=>"{{+name}} {{+age}} {{+description}}"
112
-
113
- Card::Auth.current_id = Card['joe_user'].id
114
- Card.create!( :name=>"JoeLater", :content=>"test")
115
- Card.create!( :name=>"JoeNow", :content=>"test")
116
-
117
- Card::Auth.current_id = Card::WagnBotID
118
- Card.create!(:name=>"AdminNow", :content=>"test")
119
-
120
- Card.create :name=>'Cardtype B+*type+*create', :type=>'Pointer', :content=>'[[r1]]'
121
-
122
- Card.create! :type=>"Cardtype", :name=>"Book"
123
- Card.create! :name=>"Book+*type+*structure", :content=>"by {{+author}}, design by {{+illustrator}}"
124
- Card.create! :name => "Iliad", :type=>"Book"
125
-
126
-
127
- ### -------- Notification data ------------
128
- Timecop.freeze(Cardio.future_stamp - 1.day) do
129
- # fwiw Timecop is apparently limited by ruby Time object, which goes only to 2037 and back to 1900 or so.
130
- # whereas DateTime can represent all dates.
131
-
132
-
133
- followers = {
134
- 'John' => ['John Following', 'All Eyes On Me'],
135
- 'Sara' => ['Sara Following', 'All Eyes On Me', 'Optic+*type', 'Google Glass'],
136
- 'Big Brother' => ['All Eyes on Me', 'Look at me+*self', 'Optic+*type', 'lens+*right', 'Optic+tint+*type plus right', ['*all','*created'], ['*all','*edited']],
137
- 'Optic fan' => ['Optic+*type'],
138
- 'Sunglasses fan' => ['Sunglasses'],
139
- 'Narcissist' => [['*all','*created'], ['*all','*edited']]
140
- }
141
-
142
- followers.each do |name, follow|
143
- user = Card.create! :name=>name, :type_code=>'user', :subcards=>account_args('+*email'=>"#{name.parameterize}@user.com", '+*password'=>"#{name.parameterize}_pass")
144
- end
145
-
146
- Card.create! :name => "All Eyes On Me"
147
- Card.create! :name => "No One Sees Me"
148
- Card.create! :name => "Look At Me"
149
- Card.create! :name => "Optic", :type => "Cardtype"
150
- Card.create! :name => "Sara Following"
151
- Card.create! :name => "John Following", :content => "{{+her}}"
152
- Card.create! :name => "John Following+her"
153
- magnifier = Card.create! :name => "Magnifier+lens"
154
-
155
- Card::Auth.current_id = Card['Narcissist'].id
156
- magnifier.update_attributes! :content=>"zoom in"
157
- Card.create! :name => "Sunglasses", :type=>"Optic", :content=>"{{+tint}}{{+lens}}"
158
-
159
- Card::Auth.current_id = Card['Optic fan'].id
160
- Card.create! :name => "Google glass", :type=>"Optic", :content=>"{{+price}}"
161
-
162
- Card::Auth.current_id = Card::WagnBotID
163
- Card.create! :name=>'Google glass+*self+*follow_fields', :content=>''
164
- Card.create! :name=>'Sunglasses+*self+*follow_fields', :content=>"[[#{Card[:includes].name}]]\n[[_self+price]]\n[[_self+producer]]"
165
- Card.create! :name => "Sunglasses+tint"
166
- Card.create! :name => "Sunglasses+price"
167
-
168
- followers.each do |name, follow|
169
- user = Card[name]
170
- follow.each do |f|
171
- user.follow *f
172
- end
173
- end
174
- end
175
-
176
-
177
- ## --------- create templated permissions -------------
178
- ctt = Card.create! :name=> 'Cardtype E+*type+*default'
179
-
180
-
181
- ## --------- Fruit: creatable by anon but not readable ---
182
- f = Card.create! :type=>"Cardtype", :name=>"Fruit"
183
- Card.create! :name=>'Fruit+*type+*create', :type=>'Pointer', :content=>'[[Anyone]]'
184
- Card.create! :name=>'Fruit+*type+*read', :type=>'Pointer', :content=>'[[Administrator]]'
185
-
186
- # codenames for card_accessor tests
187
- Card.create! :name=>'*write', :codename=>:write
188
-
189
- # -------- For toc testing: ------------
190
-
191
- Card.create! :name=>"OnneHeading", :content => "<h1>This is one heading</h1>\r\n<p>and some text</p>"
192
- Card.create! :name=>'TwwoHeading', :content => "<h1>One Heading</h1>\r\n<p>and some text</p>\r\n<h2>And a Subheading</h2>\r\n<p>and more text</p>"
193
- Card.create! :name=>'ThreeHeading', :content =>"<h1>A Heading</h1>\r\n<p>and text</p>\r\n<h2>And Subhead</h2>\r\n<p>text</p>\r\n<h1>And another top Heading</h1>"
194
-
195
- # -------- For history testing: -----------
196
- first = Card.create! :name=>"First", :content => 'egg'
197
- first.update_attributes! :content=> 'chicken'
198
- first.update_attributes! :content=> 'chick'
199
-
200
- end
201
- end