parlement 0.8 → 0.9

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.
Files changed (70) hide show
  1. data/CHANGES +22 -0
  2. data/Rakefile +2 -2
  3. data/app/controllers/account_controller.rb +20 -7
  4. data/app/controllers/application.rb +17 -4
  5. data/app/controllers/elt_controller.rb +1 -10
  6. data/app/controllers/person_controller.rb +1 -1
  7. data/app/helpers/elt_helper.rb +14 -0
  8. data/app/models/elt.rb +2 -0
  9. data/app/models/mail.rb +6 -5
  10. data/app/models/person.rb +5 -0
  11. data/app/views/account/_login.rhtml +52 -48
  12. data/app/views/account/_show.rhtml +13 -12
  13. data/app/views/elt/_choice.rhtml +11 -2
  14. data/app/views/elt/_elt.rhtml +38 -50
  15. data/app/views/elt/new.rhtml +8 -8
  16. data/app/views/elt/show.rhtml +21 -12
  17. data/app/views/layouts/top.rhtml +1 -0
  18. data/app/views/person/_listElts.rhtml +47 -26
  19. data/app/views/person/show.rhtml +8 -18
  20. data/config/environment.rb +6 -3
  21. data/db/ROOT/fr.txt +34 -31
  22. data/db/ROOT/parlement/test.txt +6 -4
  23. data/db/development_structure.sql +18 -20
  24. data/public/engine_files/login_engine/stylesheets/login_engine.css +81 -0
  25. data/public/images/ParlementLogo_fr.png +0 -0
  26. data/public/images/comments.gif +0 -0
  27. data/public/images/vote_minus.png +0 -0
  28. data/public/images/vote_plus.png +0 -0
  29. data/public/images/vote_plus_minus.svg +79 -0
  30. data/public/images/write.png +0 -0
  31. data/public/images/write.svg +70 -0
  32. data/public/javascripts/mybehaviour.js +3 -4
  33. data/public/stylesheets/default.css +449 -0
  34. data/public/stylesheets/live_tree.css +62 -0
  35. data/public/stylesheets/scaffold.css +74 -0
  36. data/script/about +3 -0
  37. data/script/benchmarker +19 -0
  38. data/script/breakpointer +3 -0
  39. data/script/console +3 -0
  40. data/script/create_db +7 -0
  41. data/script/destroy +3 -0
  42. data/script/generate +3 -0
  43. data/script/plugin +3 -0
  44. data/script/profiler +34 -0
  45. data/script/runner +3 -0
  46. data/script/server +3 -0
  47. data/test/unit/elt_test.rb +11 -0
  48. data/test/unit/mail_test.rb +29 -0
  49. metadata +27 -40
  50. data/test/fixtures/attachments.yml +0 -13
  51. data/test/fixtures/choices.yml +0 -13
  52. data/test/fixtures/elts.yml +0 -36
  53. data/test/fixtures/img.png +0 -0
  54. data/test/fixtures/mail/avatar +0 -249
  55. data/test/fixtures/mail/mail_ruby +0 -39
  56. data/test/fixtures/mail/mail_rubyChild +0 -30
  57. data/test/fixtures/mail/mail_rubyChild2 +0 -30
  58. data/test/fixtures/mail/mail_rubyWithAttachment +0 -7932
  59. data/test/fixtures/mail/mail_rubyWithSubject +0 -27
  60. data/test/fixtures/mails.yml +0 -13
  61. data/test/fixtures/people.yml +0 -68
  62. data/test/fixtures/subscribers.yml +0 -14
  63. data/test/fixtures/users.yml +0 -41
  64. data/test/functional/account_controller_test.rb +0 -317
  65. data/test/functional/elt_controller_test.rb +0 -87
  66. data/test/functional/person_controller_test.rb +0 -18
  67. data/test/functional/subscriber_controller_test.rb +0 -128
  68. data/test/mocks/test/time.rb +0 -17
  69. data/test/mocks/test/user_notify.rb +0 -16
  70. data/test/test_helper.rb +0 -72
@@ -0,0 +1,62 @@
1
+ .live_tree {
2
+ border: 1px solid black;
3
+ padding: 5px;
4
+ overflow: auto;
5
+ width: 100%;
6
+ height: 100%;
7
+ }
8
+
9
+ .live_tree_branch, .live_tree_root {
10
+ list-style-type: none;
11
+ margin-left: 0;
12
+ padding-left: 1em;
13
+ }
14
+
15
+ .live_tree_root {
16
+ padding: 0;
17
+ margin: 0;
18
+ white-space: nowrap;
19
+ }
20
+
21
+ .live_tree_loading_tree {
22
+ color: black;
23
+ }
24
+
25
+ .live_tree_searching {
26
+ margin-bottom: 10px;
27
+ }
28
+
29
+ .live_tree_item {
30
+ }
31
+
32
+ a.live_tree_branch_expand_link {
33
+ }
34
+
35
+ a.live_tree_branch_collapse_link {
36
+ }
37
+
38
+ .live_tree_item_icon {
39
+ color: #048;
40
+ border-style: none;
41
+ margin-right: 0.5ex;
42
+ }
43
+
44
+ .live_tree_check_box {
45
+ }
46
+
47
+ .live_tree_loading_icon {
48
+ margin-right: 0.5ex;
49
+ }
50
+
51
+ a.live_tree_item_link {
52
+ color: black;
53
+ }
54
+
55
+ .live_tree_item_name {
56
+ color: black;
57
+ }
58
+
59
+ .live_tree_active_item_name {
60
+ background-color: #048;
61
+ color: white;
62
+ }
@@ -0,0 +1,74 @@
1
+ body { background-color: #fff; color: #333; }
2
+
3
+ body, p, ol, ul, td {
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ pre {
10
+ background-color: #eee;
11
+ padding: 10px;
12
+ font-size: 11px;
13
+ }
14
+
15
+ a { color: #000; }
16
+ a:visited { color: #666; }
17
+ a:hover { color: #fff; background-color:#000; }
18
+
19
+ .fieldWithErrors {
20
+ padding: 2px;
21
+ background-color: red;
22
+ display: table;
23
+ }
24
+
25
+ #ErrorExplanation {
26
+ width: 400px;
27
+ border: 2px solid 'red';
28
+ padding: 7px;
29
+ padding-bottom: 12px;
30
+ margin-bottom: 20px;
31
+ background-color: #f0f0f0;
32
+ }
33
+
34
+ #ErrorExplanation h2 {
35
+ text-align: left;
36
+ font-weight: bold;
37
+ padding: 5px 5px 5px 15px;
38
+ font-size: 12px;
39
+ margin: -7px;
40
+ background-color: #c00;
41
+ color: #fff;
42
+ }
43
+
44
+ #ErrorExplanation p {
45
+ color: #333;
46
+ margin-bottom: 0;
47
+ padding: 5px;
48
+ }
49
+
50
+ #ErrorExplanation ul li {
51
+ font-size: 12px;
52
+ list-style: square;
53
+ }
54
+
55
+ div.uploadStatus {
56
+ margin: 5px;
57
+ }
58
+
59
+ div.progressBar {
60
+ margin: 5px;
61
+ }
62
+
63
+ div.progressBar div.border {
64
+ background-color: #fff;
65
+ border: 1px solid grey;
66
+ width: 100%;
67
+ }
68
+
69
+ div.progressBar div.background {
70
+ background-color: #333;
71
+ height: 18px;
72
+ width: 0%;
73
+ }
74
+
data/script/about ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/about'
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/ruby1.8
2
+
3
+ if ARGV.empty?
4
+ puts "Usage: benchmarker times 'Person.expensive_way' 'Person.another_expensive_way' ..."
5
+ exit
6
+ end
7
+
8
+ require File.dirname(__FILE__) + '/../config/environment'
9
+ require 'benchmark'
10
+ include Benchmark
11
+
12
+ # Don't include compilation in the benchmark
13
+ ARGV[1..-1].each { |expression| eval(expression) }
14
+
15
+ bm(6) do |x|
16
+ ARGV[1..-1].each_with_index do |expression, idx|
17
+ x.report("##{idx + 1}") { ARGV[0].to_i.times { eval(expression) } }
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/breakpointer'
data/script/console ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/console'
data/script/create_db ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.dirname(__FILE__) + '/../config/environment'
4
+ require 'rubygems'
5
+ require_gem 'db_structure'
6
+
7
+ DBStructure::db_structure
data/script/destroy ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/destroy'
data/script/generate ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/generate'
data/script/plugin ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/plugin'
data/script/profiler ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/ruby1.8
2
+ if ARGV.empty?
3
+ $stderr.puts "Usage: profiler 'Person.expensive_method(10)' [times]"
4
+ exit(1)
5
+ end
6
+
7
+ # Keep the expensive require out of the profile.
8
+ $stderr.puts 'Loading Rails...'
9
+ require File.dirname(__FILE__) + '/../config/environment'
10
+
11
+ # Define a method to profile.
12
+ if ARGV[1] and ARGV[1].to_i > 1
13
+ eval "def profile_me() #{ARGV[1]}.times { #{ARGV[0]} } end"
14
+ else
15
+ eval "def profile_me() #{ARGV[0]} end"
16
+ end
17
+
18
+ # Use the ruby-prof extension if available. Fall back to stdlib profiler.
19
+ begin
20
+ require 'prof'
21
+ $stderr.puts 'Using the ruby-prof extension.'
22
+ Prof.clock_mode = Prof::GETTIMEOFDAY
23
+ Prof.start
24
+ profile_me
25
+ results = Prof.stop
26
+ require 'rubyprof_ext'
27
+ Prof.print_profile(results, $stderr)
28
+ rescue LoadError
29
+ $stderr.puts 'Using the standard Ruby profiler.'
30
+ Profiler__.start_profile
31
+ profile_me
32
+ Profiler__.stop_profile
33
+ Profiler__.print_profile($stderr)
34
+ end
data/script/runner ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/runner'
data/script/server ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/server'
@@ -35,5 +35,16 @@ class EltTest < Test::Unit::TestCase
35
35
  assert_equal -1, vote.result
36
36
  assert_equal 1, vote.parent.result
37
37
  end
38
+
39
+ def test_position
40
+ e = @elt.children.new
41
+ e.subject = "Test de position"
42
+ e.body = "position: 3.0"
43
+ e.save
44
+ @elt.add_child e
45
+ e.publish
46
+
47
+ assert_equal 3, e.position
48
+ end
38
49
  end
39
50
 
@@ -42,6 +42,13 @@ class MailTest < Test::Unit::TestCase
42
42
  assert_equal 'TEST_with_subject', Elt.find('TEST_with_subject').id
43
43
  end
44
44
 
45
+ def test_receiveAnon
46
+ ActionMailer::Base.deliveries = []
47
+ Mail.receive(TMail::Mail.parse(read_fixture('mail_rubyWithSubject').to_s))
48
+
49
+ assert_nil Elt.find('test_parlement').person
50
+ end
51
+
45
52
  def test_receiveWithAttachment
46
53
  ActionMailer::Base.deliveries = []
47
54
 
@@ -171,6 +178,28 @@ class MailTest < Test::Unit::TestCase
171
178
  assert elt.body =~ /même/
172
179
  end
173
180
 
181
+ def test_receive_accents
182
+ ActionMailer::Base.deliveries = []
183
+
184
+ mailsCount = Mail.count
185
+ eltsCount = Elt.count
186
+ deliveredMailsCount = ActionMailer::Base.deliveries.size
187
+
188
+
189
+ mailFile = TMail::Mail.parse(read_fixture('accents').to_s)
190
+ elt = Mail.receive(mailFile).elt
191
+
192
+ #print mailFile.to_yaml
193
+ #puts
194
+ #puts mailFile.type_param('charset')
195
+
196
+ #puts elt.subject
197
+ #puts elt.body
198
+
199
+ assert elt.subject =~ / légitime défense/
200
+ assert elt.body =~ /éêè à ça/
201
+ end
202
+
174
203
  def test_receive_no_choice
175
204
  ActionMailer::Base.deliveries = []
176
205
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: parlement
5
5
  version: !ruby/object:Gem::Version
6
- version: "0.8"
7
- date: 2006-09-16 00:00:00 +02:00
6
+ version: "0.9"
7
+ date: 2006-10-10 00:00:00 +02:00
8
8
  summary: Trusted Direct Democracy on a forum
9
9
  require_paths:
10
10
  - lib
@@ -157,13 +157,22 @@ files:
157
157
  - public/images/Sleep-Deprivation-5.JPG
158
158
  - public/images/indicator.gif
159
159
  - public/images/smile.png
160
+ - public/images/comments.gif
160
161
  - public/images/eltBackground.svg
161
162
  - public/images/world.png
162
163
  - public/images/world.svg
163
164
  - public/images/eltBackground.jng
165
+ - public/images/ParlementLogo_fr.png
164
166
  - public/images/ParlementLogo.png
167
+ - public/images/vote_plus.png
168
+ - public/images/vote_minus.png
169
+ - public/images/vote_plus_minus.svg
170
+ - public/images/write.png
171
+ - public/images/write.svg
165
172
  - public/engine_files/README
166
173
  - public/engine_files/login_engine
174
+ - public/engine_files/login_engine/stylesheets
175
+ - public/engine_files/login_engine/stylesheets/login_engine.css
167
176
  - public/javascripts/prototype.js
168
177
  - public/javascripts/effects.js
169
178
  - public/javascripts/dragdrop.js
@@ -177,44 +186,22 @@ files:
177
186
  - public/javascripts/ie7-load.htc
178
187
  - public/javascripts/application.js
179
188
  - public/javascripts/mybehaviour.js
180
- - test/fixtures
181
- - test/functional
182
- - test/mocks
183
- - test/unit
184
- - test/test_helper.rb
185
- - test/fixtures/elts.yml
186
- - test/fixtures/users.yml
187
- - test/fixtures/people.yml
188
- - test/fixtures/attachments.yml
189
- - test/fixtures/mails.yml
190
- - test/fixtures/notifier
191
- - test/fixtures/mail
192
- - test/fixtures/subscribers.yml
193
- - test/fixtures/mail_notify
194
- - test/fixtures/choices.yml
195
- - test/fixtures/img.png
196
- - test/fixtures/mail/mail_ruby
197
- - test/fixtures/mail/mail_rubyWithSubject
198
- - test/fixtures/mail/mail_rubyWithAttachment
199
- - test/fixtures/mail/mail_rubyChild
200
- - test/fixtures/mail/mail_rubyChild2
201
- - test/fixtures/mail/avatar
202
- - test/functional/subscriber_controller_test.rb
203
- - test/functional/account_controller_test.rb
204
- - test/functional/person_controller_test.rb
205
- - test/functional/elt_controller_test.rb
206
- - test/mocks/development
207
- - test/mocks/test
208
- - test/mocks/test/user_notify.rb
209
- - test/mocks/test/time.rb
210
- - test/unit/mail_test.rb
211
- - test/unit/elt_test.rb
212
- - test/unit/notifier_test.rb
213
- - test/unit/person_test.rb
214
- - test/unit/attachment_test.rb
215
- - test/unit/mail_notify_test.rb
216
- - test/unit/subscriber_test.rb
217
- - test/unit/choice_test.rb
189
+ - public/stylesheets/scaffold.css
190
+ - public/stylesheets/default.css
191
+ - public/stylesheets/live_tree.css
192
+ - script/console
193
+ - script/destroy
194
+ - script/generate
195
+ - script/server
196
+ - script/runner
197
+ - script/benchmarker
198
+ - script/profiler
199
+ - script/breakpointer
200
+ - script/performance
201
+ - script/process
202
+ - script/create_db
203
+ - script/about
204
+ - script/plugin
218
205
  - vendor/plugins
219
206
  - vendor/plugins/login_engine
220
207
  - vendor/plugins/engines
@@ -1,13 +0,0 @@
1
- # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
- zeroth_attachments:
3
- id: 0
4
- elt_id: mail
5
- created_on: 2006-03-02
6
- first_attachments:
7
- id: 1
8
- elt_id: mail
9
- created_on: 2006-03-02
10
- another_attachments:
11
- id: 2
12
- elt_id: mail
13
- created_on: 2006-03-02
@@ -1,13 +0,0 @@
1
- # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
- first:
3
- id: 1
4
- elt_id: ROOT
5
- person_id: echarp
6
- created_on: 2006-03-02
7
- value: 1
8
- another:
9
- id: 2
10
- elt_id: ROOT
11
- person_id: echarp
12
- created_on: 2006-03-02
13
- value: 1
@@ -1,36 +0,0 @@
1
- # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
- first_elts:
3
- id: ROOT
4
- lft: 1
5
- rgt: 10
6
- elts_count: 3
7
- second_elts:
8
- id: 0
9
- parent_id: ROOT
10
- subject: zeroth element
11
- body: zeroeth element
12
- lft: 2
13
- rgt: 3
14
- elts_count: 0
15
- another_elts:
16
- id: 1
17
- parent_id: ROOT
18
- subject: Another element
19
- lft: 4
20
- rgt: 5
21
- elts_count: 0
22
- mail:
23
- id: mail
24
- parent_id: ROOT
25
- subject: Mails
26
- body: The different mailing lists managed on this server
27
- lft: 6
28
- rgt: 9
29
- elts_count: 0
30
- mailList:
31
- id: mailList
32
- parent_id: mail
33
- subject: Mail list
34
- body: One mailing lists managed on this server
35
- lft: 7
36
- rgt: 8