parlement 0.4 → 0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +9 -0
- data/README +9 -3
- data/app/helpers/elt_helper.rb +2 -2
- data/app/helpers/mailman.rb +4 -5
- data/app/models/choice.rb +4 -0
- data/app/models/elt.rb +31 -43
- data/app/models/mail.rb +68 -50
- data/app/models/mail_notify.rb +4 -4
- data/app/models/person.rb +2 -0
- data/app/views/account/_show.rhtml +7 -7
- data/app/views/elt/_elt.rhtml +65 -59
- data/app/views/elt/_list.rhtml +25 -7
- data/app/views/elt/new.rhtml +9 -9
- data/app/views/elt/show.rhtml +18 -6
- data/app/views/layouts/top.rhtml +9 -2
- data/app/views/mail_notify/publish.text.html.rhtml +4 -1
- data/app/views/person/_listElts.rhtml +2 -1
- data/app/views/person/show.rhtml +1 -3
- data/config/environment.rb +1 -1
- data/db/ROOT/parlement/ddRing.txt +1 -1
- data/db/ROOT/parlement/news/release0.4.txt +15 -0
- data/db/ROOT/parlement/news/release0.5.txt +3 -0
- data/db/ROOT/parlement/our-constitution.txt +11 -0
- data/db/ROOT/parlement/top-politics.txt +8 -10
- data/db/development_structure.sql +33 -21
- data/db/migrate/001_create_choices.rb +27 -0
- data/db/schema.sql +4 -3
- data/test/fixtures/choices.yml +13 -0
- data/test/fixtures/mail/mail_ruby +7 -0
- data/test/fixtures/mail/mail_rubyChild +3 -1
- data/test/fixtures/mail/mail_rubyChild2 +30 -0
- data/test/fixtures/subscribers.yml +3 -0
- data/test/unit/choice_test.rb +10 -0
- data/test/unit/mail_notify_test.rb +2 -2
- data/test/unit/mail_test.rb +52 -28
- data/test/unit/subscriber_test.rb +8 -1
- metadata +12 -2
data/app/views/elt/new.rhtml
CHANGED
@@ -4,10 +4,12 @@
|
|
4
4
|
|
5
5
|
<%= error_messages_for 'elt' %>
|
6
6
|
|
7
|
-
|
7
|
+
<!--
|
8
|
+
<span id="author_<%= @elt.parent_id %>">
|
8
9
|
<%= render :partial => 'account/show',
|
9
10
|
:locals => { :divId => 'author_'+@elt.parent_id } %>
|
10
|
-
</
|
11
|
+
</span>
|
12
|
+
-->
|
11
13
|
|
12
14
|
<%= form_remote_tag(
|
13
15
|
:update => 'eltSubs_'+@elt.parent_id,
|
@@ -38,14 +40,14 @@
|
|
38
40
|
<%= text_field 'elt', 'position', 'size' => 1, 'align' => 'right' %>
|
39
41
|
</div>
|
40
42
|
|
41
|
-
|
42
|
-
<%= text_area 'elt', 'body' %>
|
43
|
+
<%= text_area 'elt', 'body' %>
|
43
44
|
|
45
|
+
<div class="eltNewButtons">
|
44
46
|
<%= submit_to_remote('Preview', 'Preview',
|
45
47
|
:update => 'eltNewPreview_'+@elt.parent_id,
|
46
48
|
:url => { :action => 'create', :submit => :preview },
|
47
49
|
:loaded => visual_effect(:BlindDown, 'eltNewPreview_'+@elt.parent_id)) %>
|
48
|
-
<%= submit_tag 'Propose' %>
|
50
|
+
<%= submit_tag 'Propose!' %>
|
49
51
|
|
50
52
|
<%= render :partial => '/help',
|
51
53
|
:locals => { :divId => 'body'+@elt.parent_id, :content => '
|
@@ -91,11 +93,9 @@
|
|
91
93
|
</div>
|
92
94
|
<a href="http://hobix.com/textile/quick.html">Textile Reference</a>
|
93
95
|
' } %>
|
96
|
+
</div>
|
94
97
|
|
95
|
-
|
96
|
-
|
97
|
-
</div>
|
98
|
-
</p>
|
98
|
+
<span class="eltNew" id="eltNewPreview_<%= @elt.parent_id %>"/>
|
99
99
|
|
100
100
|
<!--[eoform:elt]-->
|
101
101
|
<%= end_form_tag %>
|
data/app/views/elt/show.rhtml
CHANGED
@@ -1,4 +1,20 @@
|
|
1
1
|
<div class="sidebar">
|
2
|
+
<h3 class="boxTitle">Electoral list</h3>
|
3
|
+
<div class="box">
|
4
|
+
All voters:
|
5
|
+
<span class="result" style="float: none">
|
6
|
+
<%= Choice.count :select => 'person_id', :distinct => true %>
|
7
|
+
</span>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<h3 class="boxTitle">Identity</h3>
|
11
|
+
<div class="box">
|
12
|
+
<div id="author_<%= @elt.id %>">
|
13
|
+
<%= render :partial => 'account/show',
|
14
|
+
:locals => { :divId => 'author_'+@elt.id } %>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
|
2
18
|
<% if @elt.children.count > 0 %>
|
3
19
|
<h3 class="boxTitle">Titres</h3>
|
4
20
|
<% end %>
|
@@ -7,6 +23,7 @@
|
|
7
23
|
<ul>
|
8
24
|
<% for elt in @elt.children.reverse[0...PAGE_ELT_LENGTH] %>
|
9
25
|
<li class="boxLine" title="<%= elt.created_on.strftime('%d/%m') %>">
|
26
|
+
<span class="result"><%= sprintf("%+d", elt.result) %></span>
|
10
27
|
<%= link_to elt.subject, :id => elt %>
|
11
28
|
</li>
|
12
29
|
<% end %>
|
@@ -18,11 +35,6 @@
|
|
18
35
|
|
19
36
|
<h3 class="boxTitle">Subscribe</h3>
|
20
37
|
<div class="box">
|
21
|
-
<div id="author_<%= @elt.id %>">
|
22
|
-
<%= render :partial => 'account/show',
|
23
|
-
:locals => { :divId => 'author_'+@elt.id } %>
|
24
|
-
</div>
|
25
|
-
|
26
38
|
<div id="subscription">
|
27
39
|
<%= link_to_remote(((@session[:person] and @elt.subscribers.include?(@session[:person])) ? 'Unsubscribe!' : 'Subscribe!'),
|
28
40
|
:update => 'subscription',
|
@@ -30,12 +42,12 @@
|
|
30
42
|
:loaded => visual_effect(:BlindDown, 'subscription')) %>
|
31
43
|
</div>
|
32
44
|
|
33
|
-
<div class="boxLine"><%= @elt.subscribers.size %> subscriber(s)</div>
|
34
45
|
<div class="boxLine">
|
35
46
|
<% @elt.subscribers.each do |i| %>
|
36
47
|
<%= link_to(i.name, :controller => 'person', :action => 'show', :id => i) %>
|
37
48
|
<% end %>
|
38
49
|
</div>
|
50
|
+
<div class="boxLineR"><%= @elt.subscribers.size %> subscriber(s)</div>
|
39
51
|
</div>
|
40
52
|
</div>
|
41
53
|
|
data/app/views/layouts/top.rhtml
CHANGED
@@ -45,13 +45,20 @@
|
|
45
45
|
<p class="version">
|
46
46
|
<a href="<%= url_for :controller => 'elt', :action => 'show', :id => '' %>">
|
47
47
|
v<%= PARLEMENT_VERSION %></a>
|
48
|
-
<a href="http://www.pagerank.net/" title="Search Engine Optimization"
|
49
|
-
<img src="http://www.pagerank.net/pagerank.gif" alt="Search Engine Optimization"
|
48
|
+
<a href="http://www.pagerank.net/" title="Search Engine Optimization">
|
49
|
+
<img src="http://www.pagerank.net/pagerank.gif" alt="Search Engine Optimization"/>
|
50
50
|
</a>
|
51
51
|
<a href="http://validator.w3.org/check?uri=referer">
|
52
52
|
<img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict"/>
|
53
53
|
</a>
|
54
54
|
</p>
|
55
|
+
|
56
|
+
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
|
57
|
+
</script>
|
58
|
+
<script type="text/javascript">
|
59
|
+
_uacct = "UA-317241-1";
|
60
|
+
urchinTracker();
|
61
|
+
</script>
|
55
62
|
</body>
|
56
63
|
</html>
|
57
64
|
|
@@ -26,6 +26,7 @@
|
|
26
26
|
</head>
|
27
27
|
|
28
28
|
<body>
|
29
|
+
<!--
|
29
30
|
<div class="links">
|
30
31
|
<a class="title" href="http://leparlement.org">Parlement</a>
|
31
32
|
<div class="signets">
|
@@ -33,7 +34,7 @@
|
|
33
34
|
<a href="http://www.gnu.org/licenses/gpl.html">GPL</a>
|
34
35
|
</div>
|
35
36
|
</div>
|
36
|
-
|
37
|
+
-->
|
37
38
|
<div class="elt">
|
38
39
|
<h1><%= textilize_without_paragraph @elt.subject %></h1>
|
39
40
|
|
@@ -41,6 +42,8 @@
|
|
41
42
|
<%= RedCloth.new(@elt.body).to_html%>
|
42
43
|
</div>
|
43
44
|
</div>
|
45
|
+
|
46
|
+
<a class="title" href="http://leparlement.org">Parlement</a>
|
44
47
|
</body>
|
45
48
|
</html>
|
46
49
|
|
@@ -24,7 +24,8 @@ e = Elt.find_all("person_id = '#{person.id}'",
|
|
24
24
|
:complete => visual_effect(:BlindDown, 'personElts_'+person.id.to_s)) if e_pages.current.previous %>
|
25
25
|
|
26
26
|
<% for elt in e.reverse[0...PAGE_ELT_LENGTH] %>
|
27
|
-
<div class="
|
27
|
+
<div class="elt">
|
28
|
+
<span class="result"><%= sprintf("%+d", elt.result) %></span>
|
28
29
|
<%= elt.created_on.strftime('%d/%m %H:%M') %>
|
29
30
|
<%= link_to(elt.subject, :controller => 'elt', :action => 'show', :id => elt) %>
|
30
31
|
(<%= elt.children.size %> sub)
|
data/app/views/person/show.rhtml
CHANGED
@@ -6,9 +6,7 @@
|
|
6
6
|
<div class="box">
|
7
7
|
<% for elt in @person.subscribed_elts.reverse[0...PAGE_ELT_LENGTH] %>
|
8
8
|
<div class="boxLine">
|
9
|
-
<span
|
10
|
-
<%= elt.created_on.strftime('%d/%m') %>
|
11
|
-
</span>
|
9
|
+
<span class="result"><%= sprintf("%+d", elt.result) %></span>
|
12
10
|
<%= link_to(elt.subject, :controller => 'elt', :action => 'show', :id => elt) %>
|
13
11
|
</div>
|
14
12
|
<% end %>
|
data/config/environment.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
Version 0.4
|
2
|
+
|
3
|
+
Evolutions and corrections
|
4
|
+
|
5
|
+
* bug correction in the regexp managing title display
|
6
|
+
* bug managing incoming mails into the "lost+found" folder
|
7
|
+
* received mails are resent with the same id
|
8
|
+
* no more strange backgrounds in IE
|
9
|
+
* short lines (formatted lines in email for exemple), are now wrapped correctly
|
10
|
+
* permanent redirect header if an inexistant element is requested
|
11
|
+
* rails 1.1
|
12
|
+
* plugins now linked to their respective svn
|
13
|
+
* elements now in a list (ul/li)
|
14
|
+
* simplifications for w3m display
|
15
|
+
* yahoo and google footers now hidden
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Our constitution
|
2
|
+
|
3
|
+
<span style="float:right">
|
4
|
+
!http://our-constitution.org/img/choose_europe.jpg!:http://our-constitution.org
|
5
|
+
</span>
|
6
|
+
|
7
|
+
Writing the European Constitution and involving the people in the process of
|
8
|
+
Europe's integration.
|
9
|
+
|
10
|
+
A wiki is kept "here":http://our-constitution.org
|
11
|
+
|
@@ -1,12 +1,10 @@
|
|
1
1
|
top-politics
|
2
2
|
|
3
|
-
This group was
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
(historically here: http://groups.yahoo.com/group/top-politics)
|
12
|
-
|
3
|
+
This "group":http://groups.google.com/group/top-politics was
|
4
|
+
"started":http://groups.yahoo.com/group/top-politics with the goal of creating
|
5
|
+
a network of different initiatives which reside on the *TOP* (Transparent Open
|
6
|
+
Public) principles of political activities.
|
7
|
+
|
8
|
+
We hope that we will soon be able to share concepts, ideas and suggestions
|
9
|
+
about the Internet as a media, OpenSource as a paradigm and Democracy as the
|
10
|
+
ultimate goal.
|
@@ -37,9 +37,11 @@ CREATE TABLE attachments (
|
|
37
37
|
--
|
38
38
|
|
39
39
|
CREATE TABLE choices (
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
id serial NOT NULL,
|
41
|
+
elt_id character varying(255) NOT NULL,
|
42
|
+
person_id character varying(255),
|
43
|
+
created_on timestamp without time zone NOT NULL,
|
44
|
+
value integer DEFAULT 1 NOT NULL
|
43
45
|
);
|
44
46
|
|
45
47
|
|
@@ -48,6 +50,7 @@ CREATE TABLE choices (
|
|
48
50
|
--
|
49
51
|
|
50
52
|
CREATE TABLE delegations (
|
53
|
+
id serial NOT NULL,
|
51
54
|
elt_id text NOT NULL,
|
52
55
|
person_id text NOT NULL,
|
53
56
|
created_on timestamp with time zone DEFAULT now() NOT NULL,
|
@@ -179,7 +182,7 @@ ALTER TABLE ONLY attachments
|
|
179
182
|
--
|
180
183
|
|
181
184
|
ALTER TABLE ONLY choices
|
182
|
-
ADD CONSTRAINT choices_pkey PRIMARY KEY (
|
185
|
+
ADD CONSTRAINT choices_pkey PRIMARY KEY (id);
|
183
186
|
|
184
187
|
|
185
188
|
--
|
@@ -187,7 +190,15 @@ ALTER TABLE ONLY choices
|
|
187
190
|
--
|
188
191
|
|
189
192
|
ALTER TABLE ONLY delegations
|
190
|
-
ADD CONSTRAINT delegations_pkey PRIMARY KEY (
|
193
|
+
ADD CONSTRAINT delegations_pkey PRIMARY KEY (id);
|
194
|
+
|
195
|
+
|
196
|
+
--
|
197
|
+
-- Name: elt_person_key; Type: CONSTRAINT; Schema: public; Owner: manu; Tablespace:
|
198
|
+
--
|
199
|
+
|
200
|
+
ALTER TABLE ONLY choices
|
201
|
+
ADD CONSTRAINT elt_person_key UNIQUE (elt_id, person_id);
|
191
202
|
|
192
203
|
|
193
204
|
--
|
@@ -254,22 +265,6 @@ ALTER TABLE ONLY attachments
|
|
254
265
|
ADD CONSTRAINT attachments_elt_id_fkey FOREIGN KEY (elt_id) REFERENCES elts(id);
|
255
266
|
|
256
267
|
|
257
|
-
--
|
258
|
-
-- Name: choices_elt_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: manu
|
259
|
-
--
|
260
|
-
|
261
|
-
ALTER TABLE ONLY choices
|
262
|
-
ADD CONSTRAINT choices_elt_id_fkey FOREIGN KEY (elt_id) REFERENCES elts(id);
|
263
|
-
|
264
|
-
|
265
|
-
--
|
266
|
-
-- Name: choices_person_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: manu
|
267
|
-
--
|
268
|
-
|
269
|
-
ALTER TABLE ONLY choices
|
270
|
-
ADD CONSTRAINT choices_person_id_fkey FOREIGN KEY (person_id) REFERENCES people(id);
|
271
|
-
|
272
|
-
|
273
268
|
--
|
274
269
|
-- Name: delegations_delegate_to_fkey; Type: FK CONSTRAINT; Schema: public; Owner: manu
|
275
270
|
--
|
@@ -310,6 +305,22 @@ ALTER TABLE ONLY elts
|
|
310
305
|
ADD CONSTRAINT elts_person_id_fkey FOREIGN KEY (person_id) REFERENCES people(id);
|
311
306
|
|
312
307
|
|
308
|
+
--
|
309
|
+
-- Name: fk_elt_id; Type: FK CONSTRAINT; Schema: public; Owner: manu
|
310
|
+
--
|
311
|
+
|
312
|
+
ALTER TABLE ONLY choices
|
313
|
+
ADD CONSTRAINT fk_elt_id FOREIGN KEY (elt_id) REFERENCES elts(id);
|
314
|
+
|
315
|
+
|
316
|
+
--
|
317
|
+
-- Name: fk_person_id; Type: FK CONSTRAINT; Schema: public; Owner: manu
|
318
|
+
--
|
319
|
+
|
320
|
+
ALTER TABLE ONLY choices
|
321
|
+
ADD CONSTRAINT fk_person_id FOREIGN KEY (person_id) REFERENCES people(id);
|
322
|
+
|
323
|
+
|
313
324
|
--
|
314
325
|
-- Name: mails_elt_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: manu
|
315
326
|
--
|
@@ -346,3 +357,4 @@ ALTER TABLE ONLY usersold
|
|
346
357
|
-- PostgreSQL database dump complete
|
347
358
|
--
|
348
359
|
|
360
|
+
INSERT INTO schema_info (version) VALUES (1)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class CreateChoices < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :choices, :force => true do |t|
|
4
|
+
# t.column :name, :string
|
5
|
+
t.column :elt_id, :string, :null => false
|
6
|
+
t.column :person_id, :string
|
7
|
+
t.column :created_on, :datetime, :null => false
|
8
|
+
t.column :value, :integer, :default => 1, :null => false
|
9
|
+
end
|
10
|
+
|
11
|
+
execute 'ALTER TABLE choices ADD CONSTRAINT fk_elt_id FOREIGN KEY ( elt_id ) REFERENCES elts( id ) '
|
12
|
+
execute 'ALTER TABLE choices ADD CONSTRAINT fk_person_id FOREIGN KEY ( person_id ) REFERENCES people( id ) '
|
13
|
+
execute 'ALTER TABLE choices ADD CONSTRAINT elt_person_key UNIQUE ( elt_id, person_id ) '
|
14
|
+
|
15
|
+
execute 'INSERT INTO choices (elt_id, person_id, created_on, value) SELECT id AS elt_id, person_id, created_on, 1 AS value FROM elts '
|
16
|
+
puts "#{Choice.count} choices"
|
17
|
+
|
18
|
+
elts = Elt.find(:all, :conditions => ["body LIKE '%%+1%%' OR body LIKE '%%0%%' OR body LIKE '%%-1%%'"])
|
19
|
+
puts "#{elts.size} potential choices"
|
20
|
+
elts.each { |e| e.parent.vote(Regexp.last_match(1), e.person) if e.body =~ /^\s*(-1|0|\+1)(\s*|$)/ }
|
21
|
+
puts "#{Choice.count} choices"
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.down
|
25
|
+
drop_table :choices
|
26
|
+
end
|
27
|
+
end
|
data/db/schema.sql
CHANGED
@@ -106,18 +106,19 @@ INSERT INTO subscribers(elt_id, person_id)
|
|
106
106
|
VALUES ('ROOT', 'echarp');
|
107
107
|
|
108
108
|
CREATE TABLE choices (
|
109
|
+
id SERIAL PRIMARY KEY,
|
109
110
|
elt_id text NOT NULL REFERENCES elts,
|
110
111
|
person_id text NOT NULL REFERENCES people,
|
111
112
|
created_on timestamp with time zone NOT NULL DEFAULT now(),
|
112
|
-
|
113
|
+
value integer NOT NULL DEFAULT 1
|
113
114
|
);
|
114
115
|
|
115
116
|
CREATE TABLE delegations (
|
117
|
+
id SERIAL PRIMARY KEY,
|
116
118
|
elt_id text NOT NULL REFERENCES elts,
|
117
119
|
person_id text NOT NULL REFERENCES people,
|
118
120
|
created_on timestamp with time zone NOT NULL DEFAULT now(),
|
119
121
|
temporary boolean NOT NULL DEFAULT false,
|
120
|
-
delegate_to text NOT NULL REFERENCES people
|
121
|
-
PRIMARY KEY (elt_id, person_id)
|
122
|
+
delegate_to text NOT NULL REFERENCES people
|
122
123
|
);
|
123
124
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
From manu@leparlement.org Fri Jan 20 20:58:33 2006
|
2
|
+
Return-path: <manu@leparlement.org>
|
3
|
+
Envelope-to: manu@localhost
|
4
|
+
Delivery-date: Fri, 20 Jan 2006 20:58:33 +0100
|
5
|
+
Received: from localhost ([127.0.0.1])
|
6
|
+
by localhost.localdomain with esmtp (Exim 4.60)
|
7
|
+
(envelope-from <manu@leparlement.org>)
|
8
|
+
id 1F02P3-0005yR-JN
|
9
|
+
for manu@localhost; Fri, 20 Jan 2006 20:58:33 +0100
|
10
|
+
Received: from echarp.org [81.66.133.96]
|
11
|
+
by localhost with IMAP (fetchmail-6.2.5.4)
|
12
|
+
for manu@localhost (single-drop); Fri, 20 Jan 2006 20:58:33 +0100 (CET)
|
13
|
+
Received: from manu by vvv with local (Exim 4.60)
|
14
|
+
(envelope-from <manu@leparlement.org>)
|
15
|
+
id 1F02OK-0002EG-DN
|
16
|
+
for manu@localhost; Fri, 20 Jan 2006 20:57:48 +0100
|
17
|
+
From: echarp <manu@leparlement.org>
|
18
|
+
To: mailingList@leparlement.org
|
19
|
+
Subject: test threaded parlement reply
|
20
|
+
Date: Fri, 20 Jan 2006 18:11:00 -0000
|
21
|
+
Content-Type: text/plain; charset="utf-8"
|
22
|
+
Message-Id: <E1F02OK-0002EG-DQ2@vvv>
|
23
|
+
references: <E1F02OK-0002EG-DN@vvv>
|
24
|
+
Status: RO
|
25
|
+
Content-Length: 1007
|
26
|
+
Lines: 18
|
27
|
+
|
28
|
+
+1
|
29
|
+
|
30
|
+
Test d'envoi de mail! Et en même temps test de revote!
|
@@ -19,7 +19,7 @@ class MailNotifyTest < Test::Unit::TestCase
|
|
19
19
|
assert_equal 0, ActionMailer::Base.deliveries.size
|
20
20
|
|
21
21
|
elt = Elt.find('mail')
|
22
|
-
|
22
|
+
elt.save
|
23
23
|
|
24
24
|
assert_equal 1, ActionMailer::Base.deliveries.size
|
25
25
|
end
|
@@ -30,7 +30,7 @@ class MailNotifyTest < Test::Unit::TestCase
|
|
30
30
|
assert_equal 0, ActionMailer::Base.deliveries.size
|
31
31
|
|
32
32
|
elt = Elt.find('mail')
|
33
|
-
|
33
|
+
elt.save
|
34
34
|
|
35
35
|
assert_equal 1, ActionMailer::Base.deliveries.size
|
36
36
|
#puts ActionMailer::Base.deliveries[0]
|