parlement 0.4 → 0.5

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.
@@ -4,10 +4,12 @@
4
4
 
5
5
  <%= error_messages_for 'elt' %>
6
6
 
7
- <div id="author_<%= @elt.parent_id %>">
7
+ <!--
8
+ <span id="author_<%= @elt.parent_id %>">
8
9
  <%= render :partial => 'account/show',
9
10
  :locals => { :divId => 'author_'+@elt.parent_id } %>
10
- </div>
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
- <p style="margin-top:0px;text-align:right">
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
- <div style="display:none" class="eltNew" id="eltNewPreview_<%= @elt.parent_id %>">
96
- &nbsp;
97
- </div>
98
- </p>
98
+ <span class="eltNew" id="eltNewPreview_<%= @elt.parent_id %>"/>
99
99
 
100
100
  <!--[eoform:elt]-->
101
101
  <%= end_form_tag %>
@@ -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
 
@@ -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" target="_blank">
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="boxLine">
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)
@@ -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 style="float:right;margin-right:0.5em;font-size:smaller;">
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 %>
@@ -64,7 +64,7 @@ require 'rails_file_column'
64
64
  require 'jcode'
65
65
  $KCODE = 'u'
66
66
 
67
- PARLEMENT_VERSION='0.4'
67
+ PARLEMENT_VERSION='0.5'
68
68
 
69
69
  # How many elements are displayed at once
70
70
  PAGE_ELT_LENGTH = 10
@@ -1,4 +1,4 @@
1
- DIRECT DEMOCRACY
1
+ Direct Democracy
2
2
 
3
3
  <img style="float: left; padding-bottom: 1em" src="http://www.acthum.net/directdemocracy/images/dd-sml.gif"/>
4
4
 
@@ -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,3 @@
1
+ Version 0.5
2
+
3
+ Voting. Mails containing -1,0 or +1 trigger a vote
@@ -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 started with the goal of creating a network of different
4
- initiatives which reside on the TOP (Transparent Open Public) principles of
5
- political activities. We hope that we will soon be able to share concepts,
6
- ideas and suggestions about the Internet as a media, OpenSource as a paradigm
7
- and Democracy as the ultimate goal.
8
-
9
- http://groups.google.com/group/top-politics
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
- elt_id text NOT NULL,
41
- person_id text NOT NULL,
42
- created_on timestamp with time zone DEFAULT now() NOT NULL
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 (elt_id, person_id);
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 (elt_id, person_id);
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
- PRIMARY KEY (elt_id, person_id)
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,13 @@
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
@@ -26,3 +26,10 @@ Lines: 18
26
26
 
27
27
  Test d'envoi de mail!
28
28
  je teste en même temps les accents unicode!
29
+
30
+ Et ici de faux votes qui ne devraient pas être pris en compte:
31
+
32
+ . -1
33
+ 1
34
+ + 1
35
+
@@ -25,4 +25,6 @@ Status: RO
25
25
  Content-Length: 1007
26
26
  Lines: 18
27
27
 
28
- Test d'envoi de mail!
28
+ -1
29
+
30
+ Test d'envoi de mail! Et en même temps test de vote!
@@ -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!
@@ -8,4 +8,7 @@ another:
8
8
  mail:
9
9
  elt_id: 'mail'
10
10
  person_id: 'echarp'
11
+ first_mail:
12
+ elt_id: 'mail'
13
+ person_id: 'first'
11
14
 
@@ -0,0 +1,10 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class ChoiceTest < Test::Unit::TestCase
4
+ #fixtures :people, :users, :elts, :mails, :attachments, :subscribers, :choices
5
+
6
+ # Replace this with your real tests.
7
+ def test_truth
8
+ assert true
9
+ end
10
+ end
@@ -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
- assert elt.save
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
- assert elt.save
33
+ elt.save
34
34
 
35
35
  assert_equal 1, ActionMailer::Base.deliveries.size
36
36
  #puts ActionMailer::Base.deliveries[0]