parlement 0.7 → 0.8
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.
- data/CHANGES +9 -0
- data/app/controllers/elt_controller.rb +2 -2
- data/app/models/mail.rb +2 -2
- data/app/views/account/_login.rhtml +8 -14
- data/app/views/elt/_choice.rhtml +8 -7
- data/app/views/elt/_elt.rhtml +10 -9
- data/app/views/elt/_list.rhtml +2 -2
- data/app/views/elt/_listByDate.rhtml +1 -1
- data/app/views/elt/_listByVote.rhtml +10 -8
- data/app/views/elt/rss.rxml +1 -1
- data/app/views/elt/show.rhtml +15 -5
- data/app/views/elt/vote_rss.rxml +1 -1
- data/app/views/layouts/top.rhtml +11 -7
- data/app/views/person/_listElts.rhtml +2 -2
- data/app/views/person/show.rhtml +2 -2
- data/config/environment.rb +5 -3
- data/db/ROOT/{parlement/Parlement_fr.txt → fr.txt} +10 -8
- data/db/ROOT/parlement/news/Version_08.txt +9 -0
- data/db/ROOT/parlement.txt +1 -1
- data/lib/data_import.rb +2 -4
- data/public/javascripts/mybehaviour.js +72 -0
- data/test/functional/elt_controller_test.rb +9 -0
- data/vendor/plugins/responds_to_parent/lib/responds_to_parent.rb +2 -1
- metadata +4 -3
data/CHANGES
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
- parlement changelog
|
2
2
|
|
3
|
+
== Version 0.8
|
4
|
+
|
5
|
+
Users can now filter elements according to an acceptation's threshold
|
6
|
+
|
7
|
+
* icons >> now move the user to the opened panel
|
8
|
+
* correcting a bug concerning the preview
|
9
|
+
* filter (which reuses the close/open knobs)
|
10
|
+
* knobs now more proeminent
|
11
|
+
|
3
12
|
== Version 0.7
|
4
13
|
|
5
14
|
Avatars
|
@@ -68,7 +68,7 @@ class EltController < ApplicationController
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def preview
|
71
|
-
render :inline =>
|
71
|
+
render :inline => format(params[:elt][:body])
|
72
72
|
end
|
73
73
|
|
74
74
|
def create
|
@@ -83,7 +83,7 @@ class EltController < ApplicationController
|
|
83
83
|
render :controller => 'elt', :action => 'new', :status => 404
|
84
84
|
elsif params[:submit] == "preview" or (@elt.publish and @elt.parent.add_child(@elt)) then
|
85
85
|
headers["Status"] = "201 Created"
|
86
|
-
render :partial => '/elt/elt', :
|
86
|
+
render :partial => '/elt/elt', :locals => { :elt => @elt, :eltTop => false }
|
87
87
|
else
|
88
88
|
flash[:notice] = 'Error'
|
89
89
|
render :controller => 'elt', :action => 'new'
|
data/app/models/mail.rb
CHANGED
@@ -92,7 +92,7 @@ class Mail < ActiveRecord::Base
|
|
92
92
|
elt.parent.parent.add_child elt.parent
|
93
93
|
end
|
94
94
|
|
95
|
-
mngAttachment
|
95
|
+
mngAttachment mail if mail
|
96
96
|
|
97
97
|
elt.person = Person.find_by_email(mail.from) \
|
98
98
|
|| Person.find_by_name(unquote(mail.friendly_from)) \
|
@@ -202,7 +202,7 @@ class Mail < ActiveRecord::Base
|
|
202
202
|
file << attachment.body
|
203
203
|
elt.attachments.build :file => file, :content_type => attachment.content_type
|
204
204
|
}
|
205
|
-
elsif attachment.content_type.match(/text\/plain/) \
|
205
|
+
elsif (attachment.content_type and attachment.content_type.match(/text\/plain/)) \
|
206
206
|
or (!attachment.content_type and attachment.parts.size == 0)
|
207
207
|
charset = attachment.type_param 'charset'
|
208
208
|
if charset and !charset.empty?
|
@@ -5,22 +5,19 @@
|
|
5
5
|
:loaded => visual_effect(:BlindDown, divId)) %>
|
6
6
|
|
7
7
|
<%= hidden_field 'elt', 'id' if @elt %>
|
8
|
+
<input type="hidden" id="divId" name="divId" value="<%= divId %>"/>
|
8
9
|
|
9
10
|
<div class="login">
|
10
|
-
<
|
11
|
-
|
11
|
+
<label for="person_name">Pseudo:
|
12
|
+
<%= text_field "person", "name", :size => 10 %>
|
13
|
+
</label>
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
<%= link_to_function('+',
|
18
|
-
"Element.toggle(this);"+visual_effect(:Grow, 'user_password_'+divId.to_s),
|
19
|
-
:class => "subscribeLink") %>
|
20
|
-
</span>
|
15
|
+
<%= link_to_function('+',
|
16
|
+
"Element.show(this);"+visual_effect(:Grow, 'user_password_'+divId.to_s),
|
17
|
+
:class => "subscribeLink") %>
|
21
18
|
|
22
19
|
<span style="display: none;" id="user_password_<%= divId %>">
|
23
|
-
|
20
|
+
<br/>
|
24
21
|
<label for="user_password">Password:
|
25
22
|
<%= password_field "user", "password", :size => 10 %>
|
26
23
|
</label>
|
@@ -32,9 +29,6 @@
|
|
32
29
|
|
33
30
|
<span style="display: none;" id="person_email_<%= divId %>">
|
34
31
|
<br/>
|
35
|
-
<!--
|
36
|
-
<%= password_field "user", "password_confirmation", :size => 10 %>
|
37
|
-
-->
|
38
32
|
<label for="person_email">Email (or check key):</label>
|
39
33
|
<%= text_field "person", "email", :size => 20 %>
|
40
34
|
</span>
|
data/app/views/elt/_choice.rhtml
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
<%
|
2
2
|
choice = Choice.find_by_elt_id_and_person_id elt.id, (session[:person] ? session[:person].id : nil)
|
3
|
+
result = elt.result
|
3
4
|
%>
|
4
5
|
|
5
6
|
<label class="con <%= choice and choice.value == -1 ? "selected" : "" %>"
|
@@ -11,13 +12,13 @@ choice = Choice.find_by_elt_id_and_person_id elt.id, (session[:person] ? session
|
|
11
12
|
:onclick => "this.form.commit.click()" %>
|
12
13
|
</label>
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
<%= link_to_remote("%+d" % result,
|
16
|
+
{ :update => 'result_'+elt.id,
|
17
|
+
:position => :top,
|
18
|
+
:url => { :action => 'choices', :id => elt } },
|
19
|
+
{ :class => 'result', :id => "result_#{ elt.id}",
|
20
|
+
:href => url_for(:controller => 'elt', :action => 'choices', :id => elt) }) %>
|
21
|
+
<script>setKnob($('elt_<%= elt.id %>'), <%= result %>);</script>
|
21
22
|
|
22
23
|
<label class="pro <%= choice and choice.value == 1 ? "selected" : "" %>"
|
23
24
|
title="+1" for="choice_<%= elt.id %>_pro">
|
data/app/views/elt/_elt.rhtml
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
|
4
4
|
<!-- The form is here to make sure a text browser can see it all on one line -->
|
5
5
|
<%= form_remote_tag(
|
6
|
-
:update => 'eltChoice_'+elt.id,
|
6
|
+
:update => 'eltChoice_'+elt.id.to_s,
|
7
7
|
:url => { :action => 'vote', :id => elt },
|
8
|
-
:before => visual_effect(:DropOut, 'eltChoice_'+elt.id, { :queue => 'end' }),
|
9
|
-
:loaded => visual_effect(:Grow, 'eltChoice_'+elt.id, { :queue => 'end' })) %>
|
8
|
+
:before => visual_effect(:DropOut, 'eltChoice_'+elt.id.to_s, { :queue => 'end' }),
|
9
|
+
:loaded => visual_effect(:Grow, 'eltChoice_'+elt.id.to_s, { :queue => 'end' })) %>
|
10
10
|
|
11
11
|
<% if !elt.new_record? %>
|
12
12
|
<span class="eltQuickAdd" id="eltQuickAdd_<%= elt.id %>" title="<%= elt.created_on %>">
|
@@ -15,7 +15,8 @@
|
|
15
15
|
:url => { :controller => 'elt', :action => 'new', :id => elt },
|
16
16
|
:loading => visual_effect(:SwitchOff, 'eltQuickAdd_'+elt.id.to_s),
|
17
17
|
:loaded => visual_effect(:BlindDown, 'eltNew_'+elt.id.to_s)+
|
18
|
-
visual_effect(:BlindDown, 'eltSubsClose_'+elt.id.to_s)
|
18
|
+
visual_effect(:BlindDown, 'eltSubsClose_'+elt.id.to_s)+
|
19
|
+
"Element.scrollTo('eltNew_#{elt.id.to_s}')"},
|
19
20
|
{ :href => url_for(:controller => 'elt', :action => 'new', :id => @elt)}) %>
|
20
21
|
</span>
|
21
22
|
|
@@ -81,8 +82,8 @@
|
|
81
82
|
visual_effect(:BlindDown, "eltSubs_#{elt.id.to_s}")+
|
82
83
|
visual_effect(:BlindDown, "eltSubsClose_#{elt.id.to_s}") },
|
83
84
|
{ :href => url_for(:controller => 'elt', :action => 'show', :id => elt) }) %>
|
84
|
-
|
85
|
-
<%= link_to_remote('
|
85
|
+
-
|
86
|
+
<%= link_to_remote('Write <span class="icon">>></span>',
|
86
87
|
{ :update => "eltNew_#{elt.id.to_s}",
|
87
88
|
:url => { :controller => 'elt', :action => 'new', :id => elt },
|
88
89
|
:loaded => visual_effect(:BlindDown, "eltNew_#{elt.id.to_s}")+
|
@@ -104,12 +105,12 @@
|
|
104
105
|
id="eltSubsClose_<%= elt.id %>" title="<%= elt.created_on %>"
|
105
106
|
class="eltSubsClose">
|
106
107
|
<%= link_to_function('<span class="icon"><<</span> Close',
|
107
|
-
visual_effect(:BlindUp, "eltSubs_#{elt.id}")+
|
108
108
|
visual_effect(:BlindUp, "eltNew_#{elt.id}")+
|
109
109
|
visual_effect(:BlindUp, "eltSubsClose_#{elt.id}")+
|
110
|
+
visual_effect(:BlindUp, "eltSubs_#{elt.id}")+
|
110
111
|
visual_effect(:BlindDown, "eltMore_#{elt.id}")) %>
|
111
|
-
|
112
|
-
<%= link_to_remote('
|
112
|
+
-
|
113
|
+
<%= link_to_remote('Write <span class="icon">>></span>',
|
113
114
|
{ :update => "eltNew_#{elt.id.to_s}",
|
114
115
|
:url => { :controller => 'elt', :action => 'new', :id => elt },
|
115
116
|
:loading => visual_effect(:BlindDown, "eltNew_#{elt.id.to_s}")+
|
data/app/views/elt/_list.rhtml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<%e_pages = ActionController::Pagination::Paginator.new(
|
2
|
-
self, elt.elts_count,
|
2
|
+
self, elt.elts_count, PAGE_LENGTH, @params['page'])
|
3
3
|
elts = Elt.find(:all,
|
4
4
|
:conditions => "parent_id = '#{elt.id}'",
|
5
5
|
:order => 'position, elts.created_on DESC',
|
@@ -7,7 +7,7 @@
|
|
7
7
|
:limit => e_pages.items_per_page,
|
8
8
|
:offset => e_pages.current.offset) %>
|
9
9
|
|
10
|
-
<% if e_pages.length > 1 %>
|
10
|
+
<% if e_pages.length > 1 && e_pages.current.to_i != 1 %>
|
11
11
|
<li class="pager">
|
12
12
|
<%= link_to_remote('|<',
|
13
13
|
{ :update => 'eltSubs_'+elt.id.to_s,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%e_pages = ActionController::Pagination::Paginator.new(
|
2
|
-
self, (@elt.rgt-@elt.lft-1)/2,
|
2
|
+
self, (@elt.rgt-@elt.lft-1)/2, LIST_LENGTH, @params['page'])
|
3
3
|
elts = Elt.find :all,
|
4
4
|
:conditions => "lft > #{@elt.lft} AND rgt < #{@elt.rgt}",
|
5
5
|
:order => 'elts.created_on DESC',
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%e_pages = ActionController::Pagination::Paginator.new(
|
2
|
-
self, (@elt.rgt-@elt.lft-1)/2,
|
2
|
+
self, (@elt.rgt-@elt.lft-1)/2, LIST_LENGTH, @params['page'])
|
3
3
|
elts = Elt.find :all,
|
4
4
|
:select => 'SUM(value) AS resultLocal, elts.id, parent_id, elts.created_on, parent_id,' \
|
5
5
|
+'elts_count, position, elts.person_id, subject, body, lft, rgt',
|
@@ -45,13 +45,15 @@
|
|
45
45
|
<ul>
|
46
46
|
<% elts.each do |elt| %>
|
47
47
|
<li class="boxLine elt" title="<%= elt.created_on.strftime('%d/%m %H:%M') %>">
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
48
|
+
<span>
|
49
|
+
<%= link_to_remote("%+d" % elt.resultlocal,
|
50
|
+
{ :update => 'resultList_'+elt.id,
|
51
|
+
:position => :top,
|
52
|
+
:url => { :action => 'choices', :id => elt } },
|
53
|
+
{ :class => 'result', :id => "resultList_#{ elt.id}",
|
54
|
+
:href => url_for(:controller => 'elt', :action => 'choices', :id => elt) }
|
55
|
+
) if elt.resultlocal %>
|
56
|
+
</span>
|
55
57
|
|
56
58
|
<% if elt.person %>
|
57
59
|
<span class="author">
|
data/app/views/elt/rss.rxml
CHANGED
@@ -7,7 +7,7 @@ xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do
|
|
7
7
|
Elt.find(:all,
|
8
8
|
:conditions => "lft > #{@elt.lft} AND rgt < #{@elt.rgt}",
|
9
9
|
:order => 'created_on DESC',
|
10
|
-
:limit =>
|
10
|
+
:limit => LIST_LENGTH).each do |item|
|
11
11
|
xml.item do
|
12
12
|
xml.title item.subject
|
13
13
|
#xml.category(@elt.subject)
|
data/app/views/elt/show.rhtml
CHANGED
@@ -1,10 +1,20 @@
|
|
1
|
+
<% voters = Choice.count :select => 'person_id', :distinct => true %>
|
1
2
|
<div class="sidebar">
|
2
|
-
<h3 class="boxTitle">
|
3
|
+
<h3 class="boxTitle">Filter</h3>
|
3
4
|
<div class="box">
|
4
|
-
All voters:
|
5
|
-
<
|
6
|
-
|
7
|
-
|
5
|
+
<div>All voters: <span class="result"><%= voters %></span></div>
|
6
|
+
<form id="filterForm" name="filterForm">
|
7
|
+
<a onclick="return decrementFilter()" href="#" accesskey="<"><</a>
|
8
|
+
<select id="filter" name="filter"
|
9
|
+
onchange="setFilter(this.options[this.selectedIndex].value)">
|
10
|
+
<option value="-<%= voters %>"></option>
|
11
|
+
<option selected="selected">0</option>
|
12
|
+
<% (1..voters).each { |v| %> <option><%= v %></option> <% } %>
|
13
|
+
</select>
|
14
|
+
<a onclick="return incrementFilter()" href="#" accesskey=">">></a>
|
15
|
+
<%= submit_tag 'Ok' %>
|
16
|
+
</form>
|
17
|
+
<script>setFilterFromCookie();</script>
|
8
18
|
</div>
|
9
19
|
|
10
20
|
<h3 class="boxTitle">Identity</h3>
|
data/app/views/elt/vote_rss.rxml
CHANGED
@@ -11,7 +11,7 @@ xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do
|
|
11
11
|
:order => 'SUM(value) IS NULL, SUM(value) DESC, created_on DESC',
|
12
12
|
:group => 'elts.id, parent_id, elts.created_on, parent_id, elts_count,' \
|
13
13
|
+'position, elts.person_id, subject, body, lft, rgt',
|
14
|
-
:limit =>
|
14
|
+
:limit => LIST_LENGTH,
|
15
15
|
:joins => "LEFT JOIN choices ON elt_id = elts.id").each do |item|
|
16
16
|
|
17
17
|
xml.item do
|
data/app/views/layouts/top.rhtml
CHANGED
@@ -19,14 +19,18 @@
|
|
19
19
|
|
20
20
|
<link rel="shortcut icon" href="/images/world.png" type="image/png"/>
|
21
21
|
|
22
|
-
<meta name="
|
22
|
+
<meta name="description" content="Parlement, a mix between direct and representative democracy, in the shape of a website. A mailing list, forum, chat. Democratic mailing list and forum"/>
|
23
23
|
<meta name="author" content="Emmanuel Charpentier"/>
|
24
|
-
<meta name="
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
24
|
+
<meta name="subject" content="Parlement, democratic mailing list and forum"/>
|
25
|
+
<meta name="robots" content="index, follow"/>
|
26
|
+
<meta name="keywords" content="collaborative writing, democracy, direct democracy, representative democracy, forum, mailing list, chat, delegable proxy, Ruby on Rails, PostgreSQL"/>
|
27
|
+
|
28
|
+
<META NAME="DC.title" CONTENT="Parlement" LANG="en"/>
|
29
|
+
<META NAME="DC.title" CONTENT="Parlement" LANG="fr"/>
|
30
|
+
<meta name="DC.description" content="Parlement, a mix between direct and representative democracy, in the shape of a website. A mailing list, forum, chat. Democratic mailing list and forum"/>
|
31
|
+
<META NAME="DC.subject" CONTENT="Parlement, democratic mailing list and forum"/>
|
32
|
+
<meta name="DC.keywords" content="collaborative writing, democracy, direct democracy, representative democracy, forum, mailing list, chat, delegable proxy, Ruby on Rails, PostgreSQL"/>
|
33
|
+
|
30
34
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
31
35
|
</head>
|
32
36
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%
|
2
2
|
e_pages = ActionController::Pagination::Paginator.new(
|
3
|
-
self, person.elts.count,
|
3
|
+
self, person.elts.count, PAGE_LENGTH, @params['page'])
|
4
4
|
e = Elt.find_all("person_id = '#{person.id}'",
|
5
5
|
'created_on DESC', e_pages.current.to_sql)
|
6
6
|
%>
|
@@ -23,7 +23,7 @@ e = Elt.find_all("person_id = '#{person.id}'",
|
|
23
23
|
:url => { :action => 'list', :id => person, :page => e_pages.current.previous },
|
24
24
|
:complete => visual_effect(:BlindDown, 'personElts_'+person.id.to_s)) if e_pages.current.previous %>
|
25
25
|
|
26
|
-
<% for elt in e.reverse[0...
|
26
|
+
<% for elt in e.reverse[0...PAGE_LENGTH] %>
|
27
27
|
<div class="elt">
|
28
28
|
<span class="result"><%= sprintf("%+d", elt.result) %></span>
|
29
29
|
<%= elt.created_on.strftime('%d/%m %H:%M') %>
|
data/app/views/person/show.rhtml
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
<% end %>
|
10
10
|
|
11
11
|
<div class="box">
|
12
|
-
<% for elt in @person.subscribed_elts.reverse[0...
|
12
|
+
<% for elt in @person.subscribed_elts.reverse[0...PAGE_LENGTH] %>
|
13
13
|
<div class="boxLine">
|
14
14
|
<span class="result"><%= sprintf("%+d", elt.result) %></span>
|
15
15
|
<%= link_to(elt.subject, :controller => 'elt', :action => 'show', :id => elt) %>
|
@@ -28,7 +28,7 @@
|
|
28
28
|
<%
|
29
29
|
# TODO get the count from the parent element call
|
30
30
|
e_pages = ActionController::Pagination::Paginator.new(
|
31
|
-
self, @person.elts.count,
|
31
|
+
self, @person.elts.count, PAGE_LENGTH, @params['page'])
|
32
32
|
e = Elt.find_all("person_id = '#{@person.id}'",
|
33
33
|
'created_on DESC', e_pages.current.to_sql)
|
34
34
|
%>
|
data/config/environment.rb
CHANGED
@@ -64,10 +64,12 @@ require 'rails_file_column'
|
|
64
64
|
require 'jcode'
|
65
65
|
$KCODE = 'u'
|
66
66
|
|
67
|
-
PARLEMENT_VERSION='0.
|
67
|
+
PARLEMENT_VERSION='0.8'
|
68
68
|
|
69
|
-
# How many elements are displayed at once
|
70
|
-
|
69
|
+
# How many elements are displayed at once in a page
|
70
|
+
PAGE_LENGTH = 10
|
71
|
+
# How many elements are displayed at once in a sidebar list
|
72
|
+
LIST_LENGTH = 10
|
71
73
|
|
72
74
|
# What is the name of a quick anonymous poster
|
73
75
|
ANONYMOUS_POSTER = 'anon'
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
fr
|
2
|
+
|
3
|
+
!/images/ParlementLogo.png!
|
2
4
|
|
3
5
|
Forum, liste de diffusion, blog, page personnelle, salon de discussion,
|
4
6
|
journal.
|
@@ -19,14 +21,14 @@ Avec _Internet_ nous pouvons voter:
|
|
19
21
|
* n'importe où
|
20
22
|
* n'importe quel sujet
|
21
23
|
|
22
|
-
C'est une révolution,
|
23
|
-
|
24
|
-
|
25
|
-
|
24
|
+
C'est une révolution, remettant en cause des règles datant de la Grèce antique.
|
25
|
+
Des règles qui certainement contribuent au sentiment d'émerveillement que l'on
|
26
|
+
peut ressentir les jours d'élections, mais qui aussi restreignent nos libertés
|
27
|
+
de participation en politique.
|
26
28
|
|
27
|
-
|
28
|
-
|
29
|
-
|
29
|
+
Maintenant nous pouvons acquérir trois nouvelles libertés: liberté de temps, de
|
30
|
+
lieu et d'objet. Nous pouvons voter depuis chez nous, au milieu de la nuit ou
|
31
|
+
sur les petits problèmes donc nous nous préoccupons.
|
30
32
|
|
31
33
|
There are consequences. For example if you can vote anytime, why not also
|
32
34
|
_change your vote_ if you so wish? If votes are permanent, why have dates and
|
data/db/ROOT/parlement.txt
CHANGED
@@ -25,7 +25,7 @@ probably contribute to the feeling of awe one can resent when comes election
|
|
25
25
|
day, but which also restrict our ability to participate in politics.
|
26
26
|
|
27
27
|
Now we can acquire three new freedoms: freedom of time, of place and of object.
|
28
|
-
|
28
|
+
We can vote from our home, in the middle of the night and on the small issues
|
29
29
|
that we care about.
|
30
30
|
|
31
31
|
There are consequences. For example if you can vote anytime, why not also
|
data/lib/data_import.rb
CHANGED
@@ -28,10 +28,7 @@ def inputFile(d, fileName)
|
|
28
28
|
puts 'Loading: '+File.basename(fileName).gsub(/.txt/, '')
|
29
29
|
|
30
30
|
elt = Elt.find_by_id File.basename(fileName).gsub(/.txt/, '')
|
31
|
-
|
32
|
-
unless elt
|
33
|
-
elt = Elt.new :id => File.basename(fileName).gsub(/.txt/, ''), :created_on => nil
|
34
|
-
end
|
31
|
+
elt ||= Elt.new :id => File.basename(fileName).gsub(/.txt/, ''), :created_on => nil
|
35
32
|
|
36
33
|
file = File.new fileName
|
37
34
|
|
@@ -45,6 +42,7 @@ def inputFile(d, fileName)
|
|
45
42
|
elt.body = format(ICONV.iconv(file.gets('\n')))
|
46
43
|
puts "subject: #{elt.subject} (created_on: #{elt.created_on.to_s})"
|
47
44
|
elt.save
|
45
|
+
elt.parent.add_child elt unless elt.lft or elt.rgt
|
48
46
|
end
|
49
47
|
end
|
50
48
|
|
@@ -13,6 +13,7 @@ var myrules = {
|
|
13
13
|
|
14
14
|
//Behaviour.register(myrules);
|
15
15
|
|
16
|
+
/* Called for each element to set its knobs */
|
16
17
|
function setKnobs(elt) {
|
17
18
|
var knobOpened = document.createElement("a");
|
18
19
|
Element.addClassName(knobOpened, "knobOpened");
|
@@ -31,6 +32,21 @@ function setKnobs(elt) {
|
|
31
32
|
knobClosed.onclick = function() { return openElt(elt); }
|
32
33
|
}
|
33
34
|
|
35
|
+
/*
|
36
|
+
* Called for each element as it is displayed, to set its status according to
|
37
|
+
* the filter
|
38
|
+
*/
|
39
|
+
function setKnob(elt, result) {
|
40
|
+
var f = document.filterForm.filter;
|
41
|
+
var filter = parseInt(f.options[f.selectedIndex].value);
|
42
|
+
|
43
|
+
Element.removeClassName(elt, 'opened');
|
44
|
+
if (filter == 'null' || result >= filter) {
|
45
|
+
Element.removeClassName(elt, 'closed');
|
46
|
+
} else if (result < filter) {
|
47
|
+
Element.addClassName(elt, 'closed');
|
48
|
+
}
|
49
|
+
}
|
34
50
|
|
35
51
|
function closeElt(elt) {
|
36
52
|
Element.addClassName(elt, "closed");
|
@@ -75,12 +91,68 @@ function openElt(elt) {
|
|
75
91
|
return false;
|
76
92
|
}
|
77
93
|
|
94
|
+
|
95
|
+
function getCookie(name) {
|
96
|
+
var start = document.cookie.indexOf(name+"=");
|
97
|
+
var len = start+name.length+1;
|
98
|
+
if ((!start) && (name != document.cookie.substring(0, name.length))) return null;
|
99
|
+
if (start == -1) return null;
|
100
|
+
var end = document.cookie.indexOf(";",len);
|
101
|
+
if (end == -1) end = document.cookie.length;
|
102
|
+
return unescape(document.cookie.substring(len, end));
|
103
|
+
}
|
104
|
+
|
105
|
+
function setCookie(name, value) {
|
106
|
+
var cookieString = name + "=" + escape(value);
|
107
|
+
document.cookie = cookieString;
|
108
|
+
}
|
109
|
+
|
110
|
+
|
111
|
+
function setFilter(filter) {
|
112
|
+
document.getElementsByClassName('result').each( function(result) {
|
113
|
+
//alert(parseInt(result.innerHTML)+', '+filter);
|
114
|
+
Element.removeClassName(result.parentNode.parentNode.parentNode, 'opened');
|
115
|
+
if (filter == 'null' || parseInt(result.innerHTML) >= parseInt(filter)) {
|
116
|
+
Element.removeClassName(result.parentNode.parentNode.parentNode, 'closed');
|
117
|
+
} else if (parseInt(result.innerHTML) < parseInt(filter)) {
|
118
|
+
Element.addClassName(result.parentNode.parentNode.parentNode, 'closed');
|
119
|
+
}
|
120
|
+
});
|
121
|
+
setCookie('filter', document.filterForm.filter.selectedIndex);
|
122
|
+
}
|
123
|
+
|
124
|
+
function setFilterFromCookie() {
|
125
|
+
if (getCookie('filter') != null) {
|
126
|
+
document.filterForm.filter.selectedIndex = getCookie('filter');
|
127
|
+
}
|
128
|
+
}
|
129
|
+
|
130
|
+
function decrementFilter() {
|
131
|
+
document.filterForm.filter.selectedIndex--;
|
132
|
+
document.filterForm.filter.onchange();
|
133
|
+
return false;
|
134
|
+
}
|
135
|
+
|
136
|
+
function incrementFilter() {
|
137
|
+
document.filterForm.filter.selectedIndex++;
|
138
|
+
document.filterForm.filter.onchange();
|
139
|
+
return false;
|
140
|
+
}
|
141
|
+
|
142
|
+
/*
|
143
|
+
* Set all choices to nothing.
|
144
|
+
* Mostly used for login/logout
|
145
|
+
*/
|
78
146
|
function resetChoices() {
|
79
147
|
$A(document.getElementsByClassName('selected', document.body)).each( function(choice) {
|
80
148
|
Element.removeClassName(choice, 'selected');
|
81
149
|
});
|
82
150
|
}
|
83
151
|
|
152
|
+
/*
|
153
|
+
* Set all choices to user's values
|
154
|
+
* Mostly used for login/logout
|
155
|
+
*/
|
84
156
|
function updateChoices(choices) {
|
85
157
|
$A(document.getElementsByClassName('con', document.body)).each( function(choice) {
|
86
158
|
if (choices[choice.parentNode.parentNode.parentNode.id] == "-1") {
|
@@ -15,11 +15,20 @@ class EltControllerTest < Test::Unit::TestCase
|
|
15
15
|
@elt = Elt.find 'ROOT'
|
16
16
|
end
|
17
17
|
|
18
|
+
def test_preview
|
19
|
+
post :preview, :id => @elt.id, :commit => "Propose!",
|
20
|
+
:elt =>{
|
21
|
+
:body => "Un joli test", :subject => "test_create", :parent_id => @elt.id }
|
22
|
+
assert_equal 3, @elt.children_count
|
23
|
+
assert_response :success
|
24
|
+
end
|
25
|
+
|
18
26
|
def test_create
|
19
27
|
post :create, :id => @elt.id, :commit => "Propose!",
|
20
28
|
:elt =>{
|
21
29
|
:body => "Un joli test", :subject => "test_create", :parent_id => @elt.id }
|
22
30
|
assert_equal 4, @elt.children_count
|
31
|
+
assert_response :success
|
23
32
|
end
|
24
33
|
|
25
34
|
def test_create_login
|
@@ -23,7 +23,8 @@ module RespondsToParent
|
|
23
23
|
script = (script || '').
|
24
24
|
gsub('\\', '\\\\\\').
|
25
25
|
gsub(/\r\n|\r|\n/, '\\n').
|
26
|
-
gsub(/['"]/, '\\\\\&')
|
26
|
+
gsub(/['"]/, '\\\\\&').
|
27
|
+
gsub('</script>','</scr"+"ipt>')
|
27
28
|
|
28
29
|
# Clear out the previous render to prevent double render
|
29
30
|
erase_results
|
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.
|
7
|
-
date: 2006-
|
6
|
+
version: "0.8"
|
7
|
+
date: 2006-09-16 00:00:00 +02:00
|
8
8
|
summary: Trusted Direct Democracy on a forum
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -110,6 +110,7 @@ files:
|
|
110
110
|
- db/ROOT/perso
|
111
111
|
- db/ROOT/parlement.txt
|
112
112
|
- db/ROOT/perso.txt
|
113
|
+
- db/ROOT/fr.txt
|
113
114
|
- db/ROOT/parlement
|
114
115
|
- db/ROOT/parleR.txt
|
115
116
|
- db/ROOT/mail.txt
|
@@ -121,7 +122,6 @@ files:
|
|
121
122
|
- db/ROOT/parlement/top-politics.txt
|
122
123
|
- db/ROOT/parlement/ddRing.txt
|
123
124
|
- db/ROOT/parlement/our-constitution.txt
|
124
|
-
- db/ROOT/parlement/Parlement_fr.txt
|
125
125
|
- db/ROOT/parlement/security/anonymity.txt
|
126
126
|
- db/ROOT/parlement/news/Version_03.txt
|
127
127
|
- db/ROOT/parlement/news/Version_04.txt
|
@@ -129,6 +129,7 @@ files:
|
|
129
129
|
- db/ROOT/parlement/news/Version_07.txt
|
130
130
|
- db/ROOT/parlement/news/Version_06.txt
|
131
131
|
- db/ROOT/parlement/news/Version_01.txt
|
132
|
+
- db/ROOT/parlement/news/Version_08.txt
|
132
133
|
- db/ROOT/parlement/news/Version_02.txt
|
133
134
|
- lib/localization.rb
|
134
135
|
- lib/tasks
|