parlement 0.2 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. data/CHANGES +14 -4
  2. data/README +25 -5
  3. data/Rakefile +21 -21
  4. data/app/controllers/account_controller.rb +5 -1
  5. data/app/controllers/elt_controller.rb +7 -10
  6. data/app/controllers/person_controller.rb +9 -0
  7. data/app/controllers/subscriber_controller.rb +21 -0
  8. data/app/helpers/elt_helper.rb +25 -13
  9. data/app/helpers/mailman.rb +9 -92
  10. data/app/helpers/subscriber_helper.rb +2 -0
  11. data/app/models/attachment.rb +2 -0
  12. data/app/models/elt.rb +64 -2
  13. data/app/models/mail.rb +198 -0
  14. data/app/models/mail_notify.rb +63 -0
  15. data/app/models/person.rb +8 -1
  16. data/app/views/account/_login.rhtml +31 -28
  17. data/app/views/account/_show.rhtml +4 -4
  18. data/app/views/elt/_elt.rhtml +23 -28
  19. data/app/views/elt/_list.rhtml +6 -2
  20. data/app/views/elt/new.rhtml +1 -1
  21. data/app/views/elt/show.rhtml +32 -10
  22. data/app/views/layouts/top.rhtml +16 -10
  23. data/app/views/mail_notify/publish.text.html.rhtml +46 -0
  24. data/app/views/mail_notify/publish.text.plain.rhtml +2 -0
  25. data/app/views/person/_listElts.rhtml +33 -0
  26. data/app/views/person/show.rhtml +21 -19
  27. data/config/boot.rb +2 -0
  28. data/config/environment.rb +19 -13
  29. data/config/environments/development.rb +3 -1
  30. data/config/environments/production.rb +2 -0
  31. data/config/environments/test.rb +2 -0
  32. data/config/routes.rb +5 -2
  33. data/db/ROOT/mail.txt +2 -0
  34. data/db/ROOT/parlement/news/release0.2.txt +8 -0
  35. data/db/ROOT/parlement/news/release0.3.txt +11 -0
  36. data/db/ROOT/parlement/test.txt +6 -1
  37. data/db/ROOT/parlement.txt +23 -30
  38. data/db/ROOT/perso.txt +17 -18
  39. data/db/development_structure.sql +133 -217
  40. data/db/schema.rb +83 -0
  41. data/db/schema.sql +11 -15
  42. data/lib/data_import.rb +3 -1
  43. data/public/attachment/file/architecture.png +0 -0
  44. data/public/attachment/file/architecture.svg +8972 -0
  45. data/public/attachment/file/security.svg +8960 -0
  46. data/public/images/Sleep-Deprivation-5.JPG +0 -0
  47. data/public/images/eltBackground.png +0 -0
  48. data/public/images/eltBackground.svg +89 -0
  49. data/public/images/orange_by_darren_Hester_350o.jpg +0 -0
  50. data/public/images/rails.png +0 -0
  51. data/public/images/smile.png +0 -0
  52. data/public/images/smile.svg +257 -0
  53. data/public/images/world.png +0 -0
  54. data/public/images/world.svg +170 -0
  55. data/public/javascripts/controls.js +30 -1
  56. data/public/javascripts/dragdrop.js +210 -145
  57. data/public/javascripts/effects.js +261 -399
  58. data/public/javascripts/ie7.js +6 -0
  59. data/public/javascripts/prototype.js +131 -72
  60. data/public/oldindex.html +270 -71
  61. data/public/stylesheets/default.css +189 -215
  62. data/script/about +1 -1
  63. data/script/breakpointer +1 -1
  64. data/script/console +1 -1
  65. data/script/destroy +1 -1
  66. data/script/generate +1 -1
  67. data/script/performance/benchmarker +1 -1
  68. data/script/performance/profiler +1 -1
  69. data/script/plugin +1 -1
  70. data/script/process/reaper +1 -1
  71. data/script/process/spawner +1 -1
  72. data/script/process/spinner +1 -1
  73. data/script/runner +1 -1
  74. data/script/server +1 -1
  75. data/test/fixtures/elts.yml +2 -0
  76. data/test/fixtures/mail/mail_ruby +27 -0
  77. data/test/fixtures/mail/mail_rubyChild +28 -0
  78. data/test/fixtures/mail/mail_rubyWithAttachment +7932 -0
  79. data/test/fixtures/mail/mail_rubyWithSubject +27 -0
  80. data/test/fixtures/mails.yml +7 -1
  81. data/test/fixtures/people.yml +5 -0
  82. data/test/fixtures/subscribers.yml +11 -0
  83. data/test/functional/account_controller_test.rb +38 -37
  84. data/test/functional/subscriber_controller_test.rb +128 -0
  85. data/test/test_helper.rb +44 -0
  86. data/test/unit/attachment_test.rb +1 -1
  87. data/test/unit/elt_test.rb +3 -2
  88. data/test/unit/mail_notify_test.rb +37 -0
  89. data/test/unit/mail_test.rb +124 -1
  90. data/test/unit/notifier_test.rb +0 -14
  91. data/test/unit/person_test.rb +2 -1
  92. data/test/unit/subscriber_test.rb +35 -0
  93. data/test/unit/user_test.rb +3 -3
  94. data/vendor/plugins/file_column/CHANGELOG +64 -0
  95. data/vendor/plugins/file_column/README +54 -0
  96. data/vendor/plugins/file_column/Rakefile +36 -0
  97. data/vendor/plugins/file_column/TODO +6 -0
  98. data/vendor/plugins/file_column/init.rb +12 -0
  99. data/vendor/plugins/file_column/lib/file_column.rb +719 -0
  100. data/vendor/plugins/file_column/lib/file_column_helper.rb +145 -0
  101. data/vendor/plugins/file_column/lib/file_compat.rb +28 -0
  102. data/vendor/plugins/file_column/lib/magick_file_column.rb +188 -0
  103. data/vendor/plugins/file_column/lib/validations.rb +112 -0
  104. data/vendor/plugins/file_column/test/abstract_unit.rb +90 -0
  105. data/vendor/plugins/file_column/test/connection.rb +17 -0
  106. data/vendor/plugins/file_column/test/file_column_helper_test.rb +97 -0
  107. data/vendor/plugins/file_column/test/file_column_test.rb +630 -0
  108. data/vendor/plugins/file_column/test/fixtures/entry.rb +32 -0
  109. data/vendor/plugins/file_column/test/fixtures/invalid-image.jpg +1 -0
  110. data/vendor/plugins/file_column/test/fixtures/kerb.jpg +0 -0
  111. data/vendor/plugins/file_column/test/fixtures/mysql.sql +25 -0
  112. data/vendor/plugins/file_column/test/fixtures/schema.rb +10 -0
  113. data/vendor/plugins/file_column/test/fixtures/skanthak.png +0 -0
  114. data/vendor/plugins/file_column/test/magick_test.rb +251 -0
  115. data/vendor/plugins/file_column/test/magick_view_only_test.rb +21 -0
  116. data/vendor/plugins/guid/README.TXT +19 -0
  117. data/vendor/plugins/guid/init.rb +23 -0
  118. data/vendor/plugins/guid/lib/usesguid.rb +37 -0
  119. data/vendor/plugins/guid/lib/uuid22.rb +43 -0
  120. data/vendor/plugins/guid/lib/uuidtools.rb +565 -0
  121. metadata +83 -15
  122. data/db/ROOT/CV.txt +0 -166
  123. data/lib/file_column.rb +0 -263
  124. data/lib/file_column_helper.rb +0 -45
  125. /data/{lib → vendor/plugins/file_column/lib}/rails_file_column.rb +0 -0
data/app/models/mail.rb CHANGED
@@ -1,4 +1,202 @@
1
+ #
2
+ # Receive a mail from which an elt is created.
3
+ #
4
+ # An associated mail is kept to make sure we don't lose any data. Attachments
5
+ # are also created in an associated table
6
+ #
1
7
  class Mail < ActiveRecord::Base
8
+ usesguid
9
+
2
10
  belongs_to :elt
11
+
12
+
13
+
14
+ """ _
15
+ _ __ ___ ___ ___(_)_ _____
16
+ | '__/ _ \/ __/ _ \ \ \ / / _ \
17
+ | | | __/ (_| __/ |\ V / __/
18
+ |_| \___|\___\___|_| \_/ \___| """
19
+ #
20
+ # Receive a mail that will be stored as an elt.
21
+ #
22
+ # The algorithm to define its parent is simple:
23
+ # - header "references"
24
+ # - or any subject between []
25
+ # - the "to" part before @#{ActionMailer::Base.server_settings[:domain]}
26
+ # - in a "mail/lost+found" thread
27
+ #
28
+ def receive(mail)
29
+ logger.info "Receive mail #{mail.message_id}"
30
+ elt.created_on = mail.date
31
+ elt.subject = unquote(mail.subject)
32
+
33
+ elt.body = ''
34
+
35
+ elt.person = Person.find_by_email(mail.from)
36
+ elt.person = Person.find_by_name(unquote(mail.friendly_from)) if not elt.person
37
+ elt.person = Person.new if not elt.person
38
+ elt.person.name = unquote(mail.friendly_from)
39
+ elt.person.email = mail.from.first
40
+
41
+ # Try to find its mail parent in the db
42
+ if mail.references
43
+ for parent in mail.references
44
+ m = Mail.find_by_message(parent.to_s)
45
+ elt.parent = m.elt if m
46
+ end
47
+ end
48
+
49
+ # No reference matching an existing parent, let's try a mailing list we
50
+ # deduce from an eventual [subject]
51
+ if not elt.parent and elt.subject.match(/\[\w*\]/)
52
+ parentId = elt.subject.match(/\[\w*\]/)
53
+ parentId = parentId[0].gsub(/[\[\]]/, '') if parentId
54
+
55
+ begin
56
+ elt.parent = Elt.find(parentId)
57
+
58
+ rescue ActiveRecord::RecordNotFound
59
+ elt.parent = elt.build_parent
60
+ elt.parent.parent_id = 'mail'
61
+ elt.parent.subject = parentId
62
+ elt.parent.body = ''
63
+ elt.parent.save
64
+ end
65
+ end
66
+
67
+ # No reference matching an existing parent, let's try the "to" field
68
+ if not elt.parent and mail.to.to_s.match(/\w*@#{ActionMailer::Base.server_settings[:domain]}/)
69
+ parentId = mail.to.to_s.match(/\w*@#{ActionMailer::Base.server_settings[:domain]}/)[0] \
70
+ .gsub(/@#{ActionMailer::Base.server_settings[:domain]}/, '')
71
+
72
+ begin
73
+ elt.parent = Elt.find(parentId)
74
+
75
+ rescue ActiveRecord::RecordNotFound
76
+ elt.parent = elt.build_parent
77
+ elt.parent.parent_id = 'mail'
78
+ elt.parent.subject = parentId
79
+ elt.parent.body = ''
80
+ elt.parent.save
81
+ end
82
+ end
83
+
84
+ if not elt.parent
85
+ parentId = "lost+found"
86
+
87
+ begin
88
+ elt.parent = Elt.find(parentId)
89
+
90
+ rescue ActiveRecord::RecordNotFound
91
+ elt.id = parentId
92
+ elt.parent = elt.build_parent
93
+ elt.parent.parent_id = 'mail'
94
+ elt.parent.subject = parentId
95
+ elt.parent.body = ''
96
+ elt.parent.save
97
+ end
98
+ end
99
+
100
+ #elt.parent = Elt.find('mail') if not elt.parent
101
+ mngAttachment(mail) if mail
102
+
103
+ self.message = mail.message_id
104
+ self.mail_parents = mail.references
105
+ self.file = mail.encoded
106
+ end
107
+
108
+
109
+ """ _ _ _ _
110
+ _ __ _ _| |__ | (_)___| |__
111
+ | '_ \| | | | '_ \| | / __| '_ \
112
+ | |_) | |_| | |_) | | \__ \ | | |
113
+ | .__/ \__,_|_.__/|_|_|___/_| |_|
114
+ |_| """
115
+ #
116
+ # An elt has just been saved, and needs to be published as a mail
117
+ #
118
+ def publish
119
+ logger.info "Publish mail"
120
+
121
+ if message and not message.blank? and file
122
+ mail = TMail::Mail.parse(file)
123
+ else
124
+ mail = MailNotify::create_publish(elt)
125
+ self.mail_parents = mail.references
126
+ self.file = mail.encoded
127
+ end
128
+
129
+ mail['Precedence'] = 'list'
130
+ mail['X-Loop'] = ActionMailer::Base.server_settings[:domain]
131
+ mail['List-Archive'] = "http://"+ActionMailer::Base.server_settings[:domain]
132
+ mail['Errors-To'] = "errors@"+ActionMailer::Base.server_settings[:domain]
133
+
134
+ mail.bcc = elt.all_recipients \
135
+ .select { |i| i.email and not i.email.blank? } \
136
+ .collect { |i| i.email } \
137
+ .uniq \
138
+ .join(', ')
139
+
140
+ #
141
+ # Redefine the recipients used when delivering the mail to the local smtp server
142
+ #
143
+ # In fact, only send the mail to the bcc recipients, the to and/or cc are
144
+ # just here for information
145
+ #
146
+ def mail.destinations(default = nil)
147
+ ret = []
148
+ %w( bcc ).each do |nm|
149
+ if h = @header[nm]
150
+ h.addrs.each {|i| ret.push i.address }
151
+ end
152
+ end
153
+ ret.empty? ? default : ret
154
+ end
155
+
156
+ # Added to make sure it is not lost, but not modified if already existant
157
+ mail['X-Message-Id'] = mail.message_id if not mail['X-Message-Id']
158
+
159
+
160
+ MailNotify::deliver(mail) if not mail.destinations.empty?
161
+
162
+ # Do it after sending, to get the actual message id as generated by the MTA
163
+ # Note that the id of a resent mail is regenerated, but we don't record it,
164
+ # we record the initial id
165
+ self.message = mail.message_id if not self.message or self.message.blank?
166
+
167
+ logger.info "Published with id \"#{message}\""
168
+ end
169
+
170
+
171
+ private
172
+
173
+ #
174
+ # This is to make sure we only have utf-8, no iso-8859
175
+ #
176
+ def unquote(text)
177
+ text.gsub(/\=\?.*?\?\=/) do |m|
178
+ TMail::Unquoter.unquote_and_convert_to(m, 'utf-8')
179
+ end
180
+ end
181
+
182
+ #
183
+ # Get and store the attachments
184
+ #
185
+ def mngAttachment(attachment)
186
+ if attachment.content_type == 'text/plain'
187
+ elt.body += attachment.body
188
+
189
+ elsif attachment.multipart?
190
+ attachment.parts.each { |part| mngAttachment(part) }
191
+
192
+ elsif attachment.type_param('name')
193
+ file = File.new('/tmp/'+attachment.type_param('name'), 'w')
194
+ file << attachment.body
195
+ file.flush
196
+
197
+ attach = elt.attachments.build
198
+ attach.file = file
199
+ end
200
+ end
3
201
  end
4
202
 
@@ -0,0 +1,63 @@
1
+ #
2
+ # Send a publication email whenever an elt is saved
3
+ #
4
+ # Important:
5
+ # the bcc, which is actually used for sending, is setup in the Mail class
6
+ #
7
+ class MailNotify < ActionMailer::Base
8
+ def publish(elt)
9
+ @subject = elt.subject
10
+ # Try to render the element as html
11
+ #@body = elt.body
12
+ @body[:elt] = elt
13
+
14
+ @recipients = (mailing_list(elt.parent).subject.blank? ? '' : mailing_list(elt.parent).subject ) \
15
+ + ' <' \
16
+ + mailing_list(elt.parent).id + '@' + ActionMailer::Base.server_settings[:domain] \
17
+ + '>'
18
+
19
+ @from = ((elt.person and elt.person.name) ? elt.person.name : ANONYMOUS_POSTER) \
20
+ + ' <' \
21
+ + ((elt.person and elt.person.email) \
22
+ ? elt.person.email : ANONYMOUS_POSTER + '@' + ActionMailer::Base.server_settings[:domain]) \
23
+ + '> '
24
+
25
+ # This is the essential of a mailing list, you reply to the mailing list,
26
+ # where every body sends their mail.
27
+ # This very mail can be a mailing list all by itself...
28
+ @headers['Reply-to'] = mailing_list(elt).id + '@' + ActionMailer::Base.server_settings[:domain]
29
+
30
+ @headers['In-Reply-To'] = elt.parent.mail.message if elt.parent \
31
+ and elt.parent.mail and elt.parent.mail.message
32
+
33
+ @sent_on = elt.created_on
34
+
35
+ parentMsg = elt.parent.mail
36
+ if parentMsg
37
+ @headers['references'] = ''
38
+ @headers['references'] << parentMsg.mail_parents if parentMsg.mail_parents
39
+ @headers['references'] << parentMsg.message if parentMsg.message
40
+ end
41
+
42
+ @content_type = 'multipart/alternative'
43
+
44
+ @headers['X-Mailer'] = ActionMailer::Base.server_settings[:domain] + " v" + PARLEMENT_VERSION
45
+ end
46
+
47
+ private
48
+
49
+ #
50
+ # Try to fine, define, the mailing list id this elt is part of
51
+ #
52
+ # The algo used is simple: find a parent id smaller than the usually auto
53
+ # generated ids
54
+ #
55
+ def mailing_list(elt)
56
+ e = elt
57
+ while e.id.size > 21 and e.parent_id != 'ROOT'
58
+ e = e.parent
59
+ end
60
+ e
61
+ end
62
+ end
63
+
data/app/models/person.rb CHANGED
@@ -1,9 +1,16 @@
1
1
  class Person < ActiveRecord::Base
2
+ usesguid
3
+
2
4
  has_many :elts
3
5
 
4
6
  validates_presence_of :name, :on => :create
5
7
  validates_length_of :name, :within => 3..40, :on => :create
6
8
  validates_uniqueness_of :name, :on => :create
7
- validates_uniqueness_of :email, :on => :create
9
+ validates_uniqueness_of :email, :on => :create,
10
+ :if => Proc.new { |p| p.email and p.email.length > 0 }
11
+
12
+ has_and_belongs_to_many :subscribed_elts,
13
+ :class_name => "Elt",
14
+ :join_table => "subscribers"
8
15
  end
9
16
 
@@ -1,57 +1,60 @@
1
- <div class="login">
2
- <%= form_remote_tag(
3
- :update => divId,
4
- :url => { :controller => 'account', :action => 'login' },
5
- :interactive => visual_effect(:BlindDown, divId)) %>
6
- <!--:position => 'after',-->
1
+ <%= form_remote_tag(
2
+ :update => divId,
3
+ :url => { :controller => 'account', :action => 'login' },
4
+ :complete => visual_effect(:BlindDown, divId)) %>
7
5
 
8
- <input type="hidden" id="divId" name="divId" value="<%= divId %>"/>
6
+ <div class="login">
7
+ <span>
8
+ <input type="hidden" id="divId" name="divId" value="<%= divId %>"/>
9
9
 
10
- <label for="person_name">Pseudo:</label>
11
- <%= text_field "person", "name", :size => 10 %>
10
+ <label for="person_name">Pseudo:</label>
11
+ <%= text_field "person", "name", :size => 10 %>
12
12
 
13
- <%= link_to_function('+',
14
- "Element.toggle(this);"+visual_effect(:Grow, 'user_password_'+divId.to_s)) %>
13
+ <%= link_to_function('+',
14
+ "Element.toggle(this);"+visual_effect(:Grow, 'user_password_'+divId.to_s)) %>
15
+ </span>
15
16
 
16
- <span style="display:none" id="user_password_<%= divId %>">
17
+ <span style="display: none;" id="user_password_<%= divId %>">
17
18
  &nbsp;
18
19
  <label for="user_password">Password:</label>
19
20
  <%= password_field "user", "password", :size => 10 %>
20
21
 
21
- <%= link_to_function('email? >',
22
+ <%= link_to_function('email? &gt;',
22
23
  "Element.toggle(this);"+visual_effect(:Grow, 'person_email_'+divId.to_s)) %>
23
24
  </span>
24
25
 
25
- <span style="display:none" id="person_email_<%= divId %>">
26
+ <span style="display: none;" id="person_email_<%= divId %>">
26
27
  <br/>
27
28
  <!--
28
- <label for="user_password_confirmation">Confirm password:</label>
29
29
  <%= password_field "user", "password_confirmation", :size => 10 %>
30
- &nbsp;
31
30
  -->
32
31
  <label for="person_email">Email (or check key):</label>
33
- <%= text_field "person", "email", :size => 30 %>
32
+ <%= text_field "person", "email", :size => 20 %>
34
33
  </span>
35
34
 
36
35
  <%= submit_tag 'Ok' %>
37
36
 
38
37
  <%= render :partial => '/help',
39
38
  :locals => { :divId => 'login'+divId.to_s, :content => '
40
- <ul>You can propose an element
39
+ <p>You can propose an element</p>
40
+ <ul>
41
41
  <li>with no pseudo</li>
42
42
  <li>with an unprotected pseudo</li>
43
43
  <li>with a password protected pseudo (click on the "+")</li>
44
44
  <li>with a password protected and email verified pseudo (TODO)</li>
45
45
  </ul>
46
- The last method is the only secure way to protect a nickname on
47
- <strong>this</strong> server.
48
- <br/>
49
- If a nick is not protected and verified, anybody else can protect it for
50
- themselves if they at least supply a password <em>and</em> an email.
51
- <br/>
52
- A login must contain [3..40] characters, a password [5..40].
46
+ <p>
47
+ The last method is the only secure way to protect a nickname on
48
+ <strong>this</strong> server.
49
+ </p>
50
+ <p>
51
+ If a nick is not protected and verified, anybody else can protect it for
52
+ themselves if they at least supply a password <em>and</em> an email.
53
+ </p>
54
+ <p>
55
+ A login must contain [3..40] characters, a password [5..40].
56
+ </p>
53
57
  ' } %>
54
- </div>
55
- <%= end_form_tag %>
56
- </div>
58
+ </div>
59
+ <%= end_form_tag %>
57
60
 
@@ -8,18 +8,18 @@
8
8
  <% if @session[:person] %>
9
9
  <% if @session[:person].name and @session[:person].name != '' %>
10
10
  <div class="author">
11
- &lt;<%= link_to(@session[:person].name,
11
+ <%= link_to(@session[:person].name,
12
12
  :controller => 'person',
13
13
  :action => 'show',
14
- :id => @session[:person]) %>&gt;
14
+ :id => @session[:person]) %>
15
15
  </div>
16
16
  <% end %>
17
17
 
18
18
  <div class="logout">
19
- <%= link_to_remote('(X)',
19
+ <%= link_to_remote('[X]',
20
20
  :update => divId,
21
21
  :url => { :controller => 'account', :action => 'logout', :divId => divId },
22
- :loaded => visual_effect(:BlindDown, divId)) %>
22
+ :complete => visual_effect(:BlindDown, divId)) %>
23
23
  </div>
24
24
  <% else %>
25
25
 
@@ -1,25 +1,23 @@
1
1
  <% eltSubsNb = elt.children.count if eltSubsNb == nil %>
2
2
 
3
- <% if elt.id and not elt.subject.include? elt.parent.subject and not eltTop %>
4
- <br />
5
- <% end %>
6
-
7
- <div class="elt" id="elt_<%= elt.id %>">
8
- <div class="author">
9
- <% if elt.person %>
10
- &lt;<%= link_to(elt.person.name,
11
- :controller => 'person', :action => 'show', :id => elt.person) %>&gt;
12
- <% elsif elt.parent_id != 'ROOT' and elt.subject.include? elt.parent.subject %>
13
- &lt;<%= ANONYMOUS_POSTER %>&gt;
14
- <% end %>
15
- </div>
3
+ <div id="elt_<%= elt.id %>" class="elt">
4
+ <% if elt.person %>
5
+ <div class="author">
6
+ <%= link_to(elt.person.name,
7
+ :controller => 'person', :action => 'show', :id => elt.person) %>
8
+ </div>
9
+ <% elsif not displayTitle? elt %>
10
+ <div class="author">
11
+ <%= ANONYMOUS_POSTER %>
12
+ </div>
13
+ <% end %>
16
14
 
17
15
  <div class="eltInfo" title="<%= elt.created_on %>">
18
16
  <!--
19
17
  <= link_to('@', :action => 'raw_elt', :id => elt) if elt.mail != nil >
20
18
  -->
21
19
  <% if elt.id and elt.children.count == 0 %>
22
- <%= link_to_remote('>>',
20
+ <%= link_to_remote('<span class="icon">&gt;&gt;</span>',
23
21
  :update => 'eltNew_'+elt.id.to_s,
24
22
  :url => { :controller => 'elt', :action => 'new', :id => elt },
25
23
  :loaded => visual_effect(:BlindDown, 'eltNew_'+elt.id.to_s)+
@@ -27,13 +25,10 @@
27
25
  <% end %>
28
26
  </div>
29
27
 
30
- <% if elt.parent_id == 'ROOT' or eltTop \
31
- or not elt.subject.include? elt.parent.subject %>
32
- <% if elt.parent_id != 'ROOT' %>
33
- <span class="created_on">
34
- <%= elt.created_on.strftime('%d/%m/%y %H:%M') %>
35
- </span>
36
- <% end %>
28
+ <% if eltTop or displayTitle? elt %>
29
+ <span class="created_on">
30
+ <%= elt.created_on.strftime('%d/%m/%y %H:%M') %>
31
+ </span>
37
32
 
38
33
  <<%= eltTop ? 'h1' : 'h2' %>>
39
34
  <% if elt.id %>
@@ -65,7 +60,7 @@
65
60
  visual_effect(:BlindDown, 'eltSubsClose_'+elt.id.to_s),
66
61
  :loaded => visual_effect(:BlindDown, 'eltSubs_'+elt.id.to_s)) %>
67
62
 
68
- <%= link_to_remote('Add >>',
63
+ <%= link_to_remote('Add <span class="icon">&gt;&gt;</span>',
69
64
  :update => 'eltNew_'+elt.id.to_s,
70
65
  :url => { :controller => 'elt', :action => 'new', :id => elt },
71
66
  :loaded => visual_effect(:BlindDown, 'eltNew_'+elt.id.to_s)+
@@ -87,20 +82,20 @@
87
82
  <div style="display:<%= ((eltTop and eltSubsNb > 0) or eltSubsNb == 1) ? '' : 'none' %>"
88
83
  id="eltSubsClose_<%= elt.id %>" title="<%= elt.created_on %>"
89
84
  class="eltSubsClose">
90
- <%= link_to_function('<< Close',
85
+ <%= link_to_function('<span class="icon">&lt;&lt;</span> Close',
91
86
  visual_effect(:BlindUp, 'eltSubs_'+elt.id.to_s)+
92
87
  visual_effect(:BlindUp, 'eltNew_'+elt.id.to_s)+
93
88
  visual_effect(:BlindUp, 'eltSubsClose_'+elt.id.to_s)+
94
89
  visual_effect(:BlindDown, 'eltMore_'+elt.id.to_s)) %>
95
90
 
96
91
  <% if elt.person %>
97
- &lt;<%= link_to(elt.person.name,
98
- :controller => 'person', :action => 'show', :id => elt.person) %>&gt;
99
- <% elsif elt.parent_id != 'ROOT' and elt.subject.include? elt.parent.subject %>
100
- &lt;<%= ANONYMOUS_POSTER %>&gt;
92
+ <%= link_to(elt.person.name,
93
+ :controller => 'person', :action => 'show', :id => elt.person) %>
94
+ <% elsif not displayTitle? elt %>
95
+ <%= ANONYMOUS_POSTER %>
101
96
  <% end %>
102
97
 
103
- <%= link_to_remote('Add >>',
98
+ <%= link_to_remote('Add <span class="icon">&gt;&gt;</span>',
104
99
  :update => 'eltNew_'+elt.id.to_s,
105
100
  :url => { :controller => 'elt', :action => 'new', :id => elt },
106
101
  :loaded => visual_effect(:BlindDown, 'eltNew_'+elt.id.to_s)+
@@ -6,11 +6,15 @@ e = Elt.find_all("parent_id = '#{elt.id}'",
6
6
  'created_on DESC', e_pages.current.to_sql)
7
7
  %>
8
8
 
9
+ <%
10
+ # TODO There seems to be a problem with firefox when trying to use a visual_effect
11
+ %>
12
+
9
13
  <%= link_to_remote('< Previous',
10
14
  :update => 'eltSubs_'+elt.id.to_s,
11
15
  :url => { :action => 'list', :id => elt, :page => e_pages.current.next },
12
16
  :loading => visual_effect(:BlindDown, 'eltSubsClose_'+elt.id.to_s),
13
- :loaded => visual_effect(:BlindDown, 'eltSubs_'+elt.id.to_s)) if e_pages.current.next %>
17
+ :complete => visual_effect(:BlindDown, 'eltSubs_'+elt.id.to_s)) if e_pages.current.next %>
14
18
 
15
19
  <span style="display:<%= e_pages.length > 1 ? '' : 'none'%>" class="pageCount">
16
20
  (<%= e_pages.length-e_pages.current.to_i+1 %>/<%= e_pages.length %>)
@@ -20,7 +24,7 @@ e = Elt.find_all("parent_id = '#{elt.id}'",
20
24
  :update => 'eltSubs_'+elt.id.to_s,
21
25
  :url => { :action => 'list', :id => elt, :page => e_pages.current.previous },
22
26
  :loading => visual_effect(:BlindDown, 'eltSubsClose_'+elt.id.to_s),
23
- :loaded => visual_effect(:BlindDown, 'eltSubs_'+elt.id.to_s)) if e_pages.current.previous %>
27
+ :complete => visual_effect(:BlindDown, 'eltSubs_'+elt.id.to_s)) if e_pages.current.previous %>
24
28
 
25
29
  <%= render :partial => '/elt/elt',
26
30
  :collection => e.reverse,
@@ -97,6 +97,6 @@
97
97
  </div>
98
98
  </p>
99
99
 
100
- <!--[eoform:elt]-->
100
+ <!--[eoform:elt]-->
101
101
  <%= end_form_tag %>
102
102
 
@@ -1,14 +1,14 @@
1
1
  <div class="sidebar">
2
- <div class="box">
3
- <% if @elt.children.count > 0 %>
4
- <div class="boxTitle">Titres</div>
5
- <% end %>
2
+ <% if @elt.children.count > 0 %>
3
+ <div class="boxTitle">Titres</div>
4
+ <% end %>
6
5
 
7
- <% for elt in @elt.children.reverse[0..9] %>
6
+ <div class="box">
7
+ <% for elt in @elt.children.reverse[0...PAGE_ELT_LENGTH] %>
8
8
  <div class="boxLine">
9
- <span style="float:right;margin-right:0.5em;font-size:smaller;">
9
+ <div style="float:right;margin-right:0.5em;font-size:smaller;">
10
10
  <%= elt.created_on.strftime('%d/%m') %>
11
- </span>
11
+ </div>
12
12
  <%= link_to elt.subject, :id => elt %>
13
13
  </div>
14
14
  <% end %>
@@ -16,7 +16,29 @@
16
16
  <br/>
17
17
 
18
18
  <%= link_to image_tag("/images/webfeed.gif"),
19
- :action => 'rss', :id => @elt %>
19
+ :action => 'rss', :id => @elt %>
20
+ </div>
21
+
22
+ <div class="boxTitle">Subscribe</div>
23
+ <div class="box">
24
+ <div id="author_<%= @elt.id %>">
25
+ <%= render :partial => 'account/show',
26
+ :locals => { :divId => 'author_'+@elt.id } %>
27
+ </div>
28
+
29
+ <div id="subscription">
30
+ <%= link_to_remote(((@session[:person] and @elt.subscribers.include?(@session[:person])) ? 'Unsubscribe!' : 'Subscribe!'),
31
+ :update => 'subscription',
32
+ :url => { :controller => 'subscriber', :action => 'subscribe', :id => @elt },
33
+ :loaded => visual_effect(:BlindDown, 'subscription')) %>
34
+ </div>
35
+
36
+ <div class="boxLine"><%= @elt.subscribers.size %> subscriber(s)</div>
37
+ <div class="boxLine">
38
+ <% @elt.subscribers.each do |i| %>
39
+ <%= link_to(i.name, :controller => 'person', :action => 'show', :id => i) %>
40
+ <% end %>
41
+ </div>
20
42
  </div>
21
43
  </div>
22
44
 
@@ -24,10 +46,10 @@
24
46
  <div class="<%= key %>"><%= value %></div>
25
47
  <% end %>
26
48
 
27
- <% if @elt.parent.subject != '' %>
49
+ <% if @elt.parent and @elt.parent.subject != '' %>
28
50
  <div class="parent">
29
51
  <%= link_to(textilize_without_paragraph(@elt.parent.subject),
30
- :id => @elt.parent) %>
52
+ :id => @elt.parent) %>
31
53
  </div>
32
54
  <% end %>
33
55
 
@@ -4,36 +4,42 @@
4
4
  <html>
5
5
  <head>
6
6
  <title><%= @title %></title>
7
- <%= stylesheet_link_tag 'default' %>
7
+ <%= stylesheet_link_tag 'default.css' %>
8
8
  <%= javascript_include_tag "/javascripts/prototype" %>
9
9
  <%= javascript_include_tag "/javascripts/scriptaculous" %>
10
10
 
11
+ <link rel="shortcut icon" href="/images/world.png" type="image/png"/>
12
+
11
13
  <meta name="ROBOTS" content="ALL"/>
12
14
  <meta name="author" content="Emmanuel Charpentier"/>
13
15
  <meta name="description" content="Parlement, a mix between direct and
14
16
  representative democracy, in the shape of a website. A mailing list,
15
17
  forum, chat."/>
16
- <meta name="keywords" content="collaborative writing, democracy,
17
- participative democracy, direct democracy, representative democracy,
18
- participative internationalisation, web site, ruby on rails,
19
- PostgreSQL"/>
18
+ <meta name="keywords" content="collaborative writing, democracy, direct
19
+ democracy, representative democracy, forum, mailing list, chat, ruby on
20
+ rails, PostgreSQL"/>
20
21
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
21
22
  </head>
22
23
 
23
24
  <body>
24
- <div class="sidebar">
25
+ <div class="links">
25
26
  <a class="title" href="http://leparlement.org">Parlement</a>
26
-
27
27
  <div class="signets">
28
28
  <a href="http://rubyforge.org/projects/parlement">forge</a>
29
- <a href="http://www.gnu.org/copyleft/gpl.html">GPL</a>
29
+ <a href="http://www.gnu.org/licenses/gpl.html">GPL</a>
30
30
  </div>
31
31
  </div>
32
32
 
33
33
  <%= @content_for_layout %>
34
34
 
35
- <a href="<%= url_for :controller => 'elt', :action => 'show', :id => '' %>"
36
- class="version">version <%= PARLEMENT_VERSION %></a>
35
+ <p class="version">
36
+ <a href="<%= url_for :controller => 'elt', :action => 'show', :id => '' %>">
37
+ v<%= PARLEMENT_VERSION %></a>
38
+ <a href="http://validator.w3.org/check?uri=referer">
39
+ <img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict"/>
40
+ </a>
41
+ </p>
42
+
37
43
  </body>
38
44
  </html>
39
45