parlement 0.13 → 0.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/CHANGES +15 -0
  2. data/Rakefile +1 -1
  3. data/app/controllers/account_controller.rb +20 -20
  4. data/app/controllers/application.rb +18 -17
  5. data/app/controllers/elt_controller.rb +92 -71
  6. data/app/controllers/subscriber_controller.rb +1 -1
  7. data/app/helpers/elt_helper.rb +2 -1
  8. data/app/models/elt.rb +3 -1
  9. data/app/models/mail.rb +0 -3
  10. data/app/views/_help.rhtml +2 -0
  11. data/app/views/account/_login.rhtml +39 -37
  12. data/app/views/account/_show.rhtml +24 -18
  13. data/app/views/elt/_choice.rhtml +22 -22
  14. data/app/views/elt/_elt.rhtml +73 -64
  15. data/app/views/elt/choices.rhtml +22 -18
  16. data/app/views/elt/list/_byDate.rhtml +71 -0
  17. data/app/views/elt/list/_byVote.rhtml +71 -0
  18. data/app/views/elt/{_list.rhtml → list/_children.rhtml} +3 -3
  19. data/app/views/{subscriber/_list.rhtml → elt/list/_subscribers.rhtml} +0 -0
  20. data/app/views/elt/{_listVisitors.rhtml → list/_visitors.rhtml} +0 -0
  21. data/app/views/elt/{_listByVote.rhtml → list/byVote.rhtml} +3 -2
  22. data/app/views/elt/new.rhtml +26 -11
  23. data/app/views/elt/show.rhtml +32 -31
  24. data/app/views/layouts/_title.rhtml +10 -0
  25. data/app/views/layouts/top.rhtml +41 -23
  26. data/app/views/person/_listElts.rhtml +1 -1
  27. data/app/views/person/show.rhtml +19 -16
  28. data/config/boot.rb +2 -2
  29. data/config/environment.rb +1 -1
  30. data/db/ROOT/perso.txt +214 -0
  31. data/db/development_structure.sql +1 -1
  32. data/public/javascripts/mybehaviour.js +21 -21
  33. data/public/javascripts/prototype.js +1 -1
  34. data/public/javascripts/shadedborder.js +249 -0
  35. data/public/stylesheets/blue.css +471 -0
  36. data/public/stylesheets/default.css +165 -310
  37. data/vendor/plugins/engines/README +2 -0
  38. data/vendor/plugins/engines/Rakefile +18 -0
  39. data/vendor/plugins/engines/lib/engines/testing.rb +0 -1
  40. data/vendor/plugins/engines/tasks/engines.rake +4 -2
  41. data/vendor/plugins/login_engine/app/controllers/user_controller.rb +2 -1
  42. metadata +13 -7
  43. data/app/views/elt/_listByDate.rhtml +0 -76
data/CHANGES CHANGED
@@ -1,5 +1,20 @@
1
1
  - parlement changelog
2
2
 
3
+ == Version 0.14 ==
4
+
5
+ Heavily modified skin where anonymous users can no longer vote. Simplified and
6
+ faster HTML. Shaded border.
7
+
8
+ * protection against some browsers who update too frequently their views
9
+ * no more deprecations and errors
10
+ * moved all elt lists to app/views/elt/list directory
11
+ * skin heavily modified, simplified
12
+ * shaded border script
13
+ * anonymous users are not able to vote anymore
14
+ * results displayed only to those who have voted
15
+ * faster view update
16
+ * anonymous users can write and create their login at the same time, blog like
17
+
3
18
  == Version 0.13 ==
4
19
 
5
20
  Better filtering. Periodical updating of visitors, subscribers and elements
data/Rakefile CHANGED
@@ -180,7 +180,7 @@ end
180
180
  desc "Update pot/po files."
181
181
  task :updatepo do
182
182
  require 'gettext/utils'
183
- GetText.update_pofiles(PKG_NAME, Dir.glob("{app}/**/*.{rb,rhtml}"), "#{PKG_NAME} #{PKG_VERSION}")
183
+ GetText.update_pofiles(PKG_NAME, Dir.glob("{app}/{views,controllers}/**/*.{rb,rhtml}"), "#{PKG_NAME} #{PKG_VERSION}")
184
184
  end
185
185
 
186
186
  desc "Create mo-files"
@@ -23,26 +23,26 @@ class AccountController < UserController
23
23
  @person = Person.new :id => login.gsub(/\s/, '_'), :name => login
24
24
  if @person.save
25
25
  logger.info yellow { bold { "Person: #{@person.name}, id: #{@person.id}" } }
26
- flash.now[:notice] = "Pseudo created"
26
+ flash.now[:notice] = _("Pseudo recorded")
27
27
  session[:person] = @person
28
28
  else
29
- flash.now[:error] = 'Error creating account'
29
+ flash.now[:error] = _('Error creating account')
30
30
  end
31
31
  end
32
32
  rescue Exception => e
33
- flash.now[:error] = 'Error creating account'
33
+ flash.now[:error] = _('Error creating account')
34
34
  logger.error red { e }
35
35
  end
36
36
  end
37
37
 
38
38
  # We record the password or try to authenticate
39
39
  if @person and @person.errors.empty?
40
- if password.empty?
40
+ if password and password.empty?
41
41
  if not @user or not @user.salted_password \
42
42
  or @user.salted_password.empty?
43
43
  session[:person] = @person
44
44
  else
45
- flash.now[:error] = "This pseudo is protected with a password"
45
+ flash.now[:error] = _("This pseudo is protected with a password")
46
46
  end
47
47
  elsif not @user
48
48
  # Record password
@@ -62,7 +62,7 @@ class AccountController < UserController
62
62
  @user.security_token = nil
63
63
  if @user.save
64
64
  logger.info yellow { "Person: #{@person.name} changed its password" }
65
- flash.now['notice 2'] = 'Password successfully modified!'
65
+ flash.now['notice 2'] = _('Password successfully modified!')
66
66
  session[:person] = @person
67
67
  session[:user] = @user
68
68
  else
@@ -71,17 +71,17 @@ class AccountController < UserController
71
71
  end
72
72
  end
73
73
  rescue
74
- flash.now[:error] = 'Wrong check key'
74
+ flash.now[:error] = _('Wrong check key')
75
75
  end
76
76
  else
77
- flash.now[:error] = "Wrong password"
77
+ flash.now[:error] = _("Wrong password")
78
78
  end
79
79
 
80
80
  # Record the email or send a check_key for a password reset
81
81
  if email and not email.empty?
82
82
  if session[:person]
83
83
  if email == @person.email
84
- flash.now['notice 3'] = "Email already recorded and verified"
84
+ flash.now['notice 3'] = _("Email already recorded and verified")
85
85
  else
86
86
  mngEmail
87
87
  end
@@ -166,8 +166,7 @@ class AccountController < UserController
166
166
  end
167
167
 
168
168
  def setAvatar
169
- return render(:text => "Not logged in", :status => 403) \
170
- unless session[:person]
169
+ return render(:text => _("Not logged in"), :status => 403) unless session[:person]
171
170
  logger.info yellow { "Setting up an avatar for person #{session[:person].name}" }
172
171
 
173
172
  @elt = Elt.find_by_id 'people'
@@ -252,19 +251,20 @@ class AccountController < UserController
252
251
  end
253
252
  end
254
253
  rescue Exception => e
255
- flash.now[:notice] = nil
256
- flash.now['notice 2'] = nil
257
- flash.now['notice 3'] = nil
258
- flash.now[:warning] = 'Error creating account: confirmation email not sent'
254
+ flash.now[:notice] = flash.now['notice 2'] = flash.now['notice 3'] = nil
255
+ flash.now[:warning] = _('Error creating account: confirmation email not sent')
259
256
  e.backtrace.each { |m| logger.error m }
260
257
  end
261
258
  end
262
259
 
263
260
  def getAllVotes
264
- return unless @elt
265
- Choice.find_all_by_person_id((session[:person] ? session[:person].id : nil),
266
- :include => 'elt',
267
- :conditions => "elts.lft >= '#{@elt.lft}' AND elts.rgt <= '#{@elt.rgt}'")
261
+ if @elt then
262
+ Choice.find_all_by_person_id((session[:person] ? session[:person].id : nil),
263
+ :include => 'elt',
264
+ :conditions => "elts.lft >= '#{@elt.lft}' AND elts.rgt <= '#{@elt.rgt}'")
265
+ else
266
+ # This should only happen for very new people
267
+ Choice.find_all_by_person_id((session[:person] ? session[:person].id : nil))
268
+ end
268
269
  end
269
270
  end
270
-
@@ -5,15 +5,15 @@ require 'login_engine'
5
5
  require 'term/ansicolor'
6
6
 
7
7
  class ApplicationController < ActionController::Base
8
- helper_method :filter
8
+ helper_method :filter
9
9
 
10
10
  include LoginEngine
11
11
  include Term::ANSIColor
12
12
 
13
- init_gettext "parlement"
13
+ init_gettext "parlement"
14
14
 
15
- before_filter :set_login_from_cookie
16
- after_filter :fix_unicode_for_safari
15
+ before_filter :set_login_from_cookie
16
+ #after_filter :fix_unicode_for_safari
17
17
  after_filter OutputCompressionFilter
18
18
 
19
19
  # automatically and transparently fixes utf-8 bug
@@ -26,8 +26,9 @@ class ApplicationController < ActionController::Base
26
26
  end
27
27
 
28
28
  def set_login_from_cookie
29
- unless session[:person]
30
- if (person = Person.find_by_name(cookies[:person_name])) and \
29
+ unless session[:lastUpdatedView] or session[:person]
30
+ if (cookies[:person_name] and \
31
+ person = Person.find_by_name(cookies[:person_name])) and \
31
32
  ((!person.user and !cookies[:salted_password]) \
32
33
  or (person.user \
33
34
  and person.user.salted_password == cookies[:salted_password]))
@@ -35,20 +36,20 @@ class ApplicationController < ActionController::Base
35
36
  session[:person] = person
36
37
  session[:user] = person.user
37
38
 
38
- person.last_login = Time.now
39
- person.save
39
+ person.last_login = Time.now
40
+ person.save!
40
41
  end
41
42
  end
42
43
  end
43
44
 
44
- def filter
45
- if request.cookies['filter'] && request.cookies['filter'][0]
46
- filter = request.cookies['filter'][0].to_i - 1
47
- filter = nil unless filter >= 0
48
- else
49
- filter = 0
50
- end
51
- filter
52
- end
45
+ def filter
46
+ if request.cookies['filter'] && request.cookies['filter'][0]
47
+ filter = request.cookies['filter'][0].to_i - 1
48
+ filter = nil unless filter >= 0
49
+ else
50
+ filter = 0
51
+ end
52
+ filter
53
+ end
53
54
  end
54
55
 
@@ -25,79 +25,91 @@ class EltController < ApplicationController
25
25
 
26
26
  def list
27
27
  @elt = Elt.find(params[:id]) if @elt == nil
28
- render :partial => '/elt/list', :locals => { :elt => @elt }
28
+ render :partial => '/elt/list/children', :locals => { :elt => @elt }
29
29
  end
30
30
 
31
31
  def listByDate
32
32
  @elt = Elt.find params[:id] unless @elt
33
- render :partial => 'listByDate'
33
+ render :partial => '/elt/list/byDate'
34
34
  end
35
35
 
36
36
  def listByVote
37
37
  @elt = Elt.find params[:id] unless @elt
38
- render :partial => 'listByVote'
38
+ render :partial => '/elt/list/byVote'
39
39
  end
40
40
 
41
41
  def listVisitors
42
42
  @elt = Elt.find params[:id] unless @elt
43
- render :partial => 'listVisitors'
44
- end
43
+ render :partial => '/elt/list/visitors'
44
+ end
45
45
 
46
46
  def listSubscribers
47
47
  @elt = Elt.find params[:id] unless @elt
48
- render :partial => '/subscriber/list'
49
- end
48
+ render :partial => '/elt/list/subscribers'
49
+ end
50
50
 
51
51
  def updateView
52
- session[:lastUpdatedView] ||= Time.now - 10
53
- acts = ""
54
- visits = Visit.count \
55
- :joins => "JOIN elts e1 ON e1.id = '#{params[:id]}' \
56
- JOIN elts e2 ON visits.elt_id = e2.id \
57
- AND ((e1.lft <= e2.lft AND e2.rgt <= e1.rgt) \
58
- OR (e1.lft > e2.lft AND e2.rgt > e1.rgt))",
59
- :conditions => "visits.updated_on >= '#{session[:lastUpdatedView]}'"
60
- acts += "new Ajax.Updater('listVisitors', '/elt/listVisitors/#{params[:id]}', \
61
- {asynchronous:true, evalScripts:true}); \
62
- " if visits > 0
63
-
64
- subscribers = Subscription.count \
65
- :joins => "JOIN elts e1 ON e1.id = '#{params[:id]}' \
66
- JOIN elts e2 ON subscriptions.elt_id = e2.id \
67
- AND ((e1.lft <= e2.lft AND e2.rgt <= e1.rgt) \
68
- OR (e1.lft > e2.lft AND e2.rgt > e1.rgt))",
69
- :conditions => "subscriptions.created_on >= '#{session[:lastUpdatedView]}'"
70
- acts += "new Ajax.Updater('listSubscribers', '/elt/listSubscribers/#{params[:id]}', \
71
- {asynchronous:true, evalScripts:true}); \
72
- " if subscribers > 0
73
-
74
- elts = Elt.count \
75
- :joins => "LEFT JOIN choices ON choices.elt_id = elts.id \
76
- JOIN elts e2 ON elts.lft <= e2.lft AND e2.rgt <= elts.rgt",
77
- :conditions => "elts.id = '#{params[:id]}' \
78
- AND e2.created_on >= '#{session[:lastUpdatedView]}'"
79
- acts += "new Ajax.Updater('listByDate', '/elt/listByDate/#{params[:id]}', \
80
- {asynchronous:true, evalScripts:true});" \
81
- + "new Ajax.Updater('listByVote', '/elt/listByVote/#{params[:id]}', \
82
- {asynchronous:true, evalScripts:true}); \
83
- " if subscribers > 0
84
-
85
- if person = session[:person]
86
- visit = Visit.find_by_person_id_and_elt_id(person, params[:id])
87
- if visit and person.last_login and person.last_login > visit.created_on then
88
- logger.info "New visit"
89
- visit.destroy
90
- visit = nil
91
- end
92
- visit = Visit.new(:person => person, :elt_id => params[:id]) unless visit
93
- visit.filter = filter
94
- visit.save!
95
- end
96
-
97
- logger.info "#{visits} visits, #{subscribers} subscribers, #{elts} elts"
98
- session[:lastUpdatedView] = Time.now
99
- render :inline => " \
100
- <script type=\"text/javascript\">#{acts}</script>"
52
+ if session[:lastUpdatedView] && session[:lastUpdatedView] > Time.now - 9 then
53
+ # Protection against some browsers updating too fast
54
+ logger.info "Too soon"
55
+ render :inline => ""
56
+ return
57
+ end
58
+
59
+ session[:lastUpdatedView] ||= Time.now - 10
60
+
61
+ @elt = Elt.find(params[:id])
62
+ acts = ""
63
+ acts += " \
64
+ <script type=\"text/javascript\"> \
65
+ new Ajax.Updater('listByDate', '/elt/listByDate/#{params[:id]}', \
66
+ {asynchronous:true, evalScripts:true}); \
67
+ new Ajax.Updater('listByVote', '/elt/listByVote/#{params[:id]}', \
68
+ {asynchronous:true, evalScripts:true}); \
69
+ </script> \
70
+ " if @elt.last_activity > session[:lastUpdatedView]
71
+
72
+ if person = session[:person]
73
+ visits = Visit.count \
74
+ :joins => "JOIN elts e1 ON e1.id = '#{params[:id]}' \
75
+ JOIN elts e2 ON visits.elt_id = e2.id \
76
+ AND ((e1.lft <= e2.lft AND e2.rgt <= e1.rgt) \
77
+ OR (e1.lft > e2.lft AND e2.rgt > e1.rgt))",
78
+ :conditions => "visits.updated_on >= '#{session[:lastUpdatedView]}'"
79
+ acts += " \
80
+ <script type=\"text/javascript\"> \
81
+ new Ajax.Updater('listVisitors', '/elt/listVisitors/#{params[:id]}', \
82
+ {asynchronous:true, evalScripts:true}); \
83
+ </script> \
84
+ " if visits > 0
85
+
86
+ subscribers = Subscription.count \
87
+ :joins => "JOIN elts e1 ON e1.id = '#{params[:id]}' \
88
+ JOIN elts e2 ON subscriptions.elt_id = e2.id \
89
+ AND ((e1.lft <= e2.lft AND e2.rgt <= e1.rgt) \
90
+ OR (e1.lft > e2.lft AND e2.rgt > e1.rgt))",
91
+ :conditions => "subscriptions.created_on >= '#{session[:lastUpdatedView]}'"
92
+ acts += " \
93
+ <script type=\"text/javascript\"> \
94
+ new Ajax.Updater('listSubscribers', '/elt/listSubscribers/#{params[:id]}', \
95
+ {asynchronous:true, evalScripts:true}); \
96
+ </script> \
97
+ " if subscribers > 0
98
+
99
+ visit = Visit.find_by_person_id_and_elt_id(person, params[:id])
100
+ if visit and person.last_login and person.last_login > visit.created_on then
101
+ logger.info "New visit"
102
+ visit.destroy
103
+ visit = nil
104
+ end
105
+ visit = Visit.new(:person => person, :elt_id => params[:id]) unless visit
106
+ visit.filter = filter
107
+ visit.save!
108
+ logger.info "#{visits} visit(s), #{subscribers} subscriber(s)"
109
+ end
110
+
111
+ session[:lastUpdatedView] = Time.now
112
+ render :inline => acts
101
113
  end
102
114
 
103
115
  def rss
@@ -127,24 +139,38 @@ class EltController < ApplicationController
127
139
  @elt = Elt.new(params[:elt])
128
140
  @elt.person = session[:person]
129
141
 
130
- if !session[:person] and \
131
- (@elt.subject =~ /([<>\/]|href)/ \
142
+ if !session[:person] \
143
+ and (@elt.subject =~ /([<>\/]|href)/ \
132
144
  or @elt.body =~ /(.*(http|href)(.*\n)*){3}/ \
133
145
  or @elt.body =~ /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i \
134
146
  or @elt.body =~ /([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,}.*){3}/i) then
135
147
  logger.error red { underline { "SPAM! '#{@elt.subject}'" } }
136
148
  logger.error "SPAM! '#{@elt.body}'"
137
- flash[:error] = 'Sorry, to fight spam "<" ">" or "href" are forbidden in the subject, and there can not be more than 3 links in the body, you also can\'t input one simple email or more than 3 emails!'
149
+ flash[:error] = _('Sorry, to fight spam "<" ">" or "href" are forbidden in the subject, and there can not be more than 3 links in the body, you also can\'t input one simple email or more than 3 emails!')
138
150
  headers["Status"] = "404 Post considered as spam"
139
151
  render :controller => 'elt', :action => 'new', :status => 404
140
- elsif params[:submit] == "preview" or (@elt.publish and @elt.parent.add_child(@elt)) then
141
- #headers["Status"] = "201 Created"
142
- render :partial => '/elt/elt', :locals => { :elt => @elt, :eltTop => false }
152
+
143
153
  else
144
- logger.error "Strange error, can't preview or save an element"
145
- puts "Strange error, can't preview or save an element"
146
- flash[:notice] = 'Error'
147
- render :controller => 'elt', :action => 'new'
154
+ if not @elt.person and params[:person] and login = params[:person][:name] and !login.empty? then
155
+ @elt.person = Person.find_by_name(login) || Person.new(params[:person])
156
+ if @elt.person.user
157
+ flash[:warning] = _('This name is password protected, login in top right box')
158
+ @elt.person = nil
159
+ elsif params[:submit] != "preview"
160
+ @elt.person.save!
161
+ end
162
+ elsif params[:person] and email = params[:person][:email] and !email.empty? then
163
+ @elt.person.save!
164
+ end
165
+
166
+ if params[:submit] == "preview" or (@elt.publish and headers["Status"] = "201 Created") then
167
+ render :partial => '/elt/elt', :locals => { :elt => @elt, :eltTop => false, :created => true }
168
+ else
169
+ logger.error "Strange error, can't preview or save an element"
170
+ puts "Strange error, can't preview or save an element"
171
+ flash[:notice] = 'Error'
172
+ render :controller => 'elt', :action => 'new'
173
+ end
148
174
  end
149
175
  end
150
176
 
@@ -185,9 +211,4 @@ class EltController < ApplicationController
185
211
 
186
212
  render :partial => '/elt/choice', :locals => { :elt => @elt }
187
213
  end
188
-
189
- def choices
190
- @elt = Elt.find params[:id]
191
- end
192
214
  end
193
-
@@ -25,7 +25,7 @@ class SubscriberController < ApplicationController
25
25
  #render :inline => "First you need to login... it's easy, type a pseudo with at least 3 characters. Then OK"
26
26
  flash.now[:error] = 'First you need to login!'
27
27
  end
28
- render :partial => 'list'
28
+ render :partial => '/elt/list/subscribers'
29
29
  end
30
30
  end
31
31
 
@@ -17,7 +17,7 @@ module EltHelper
17
17
  #
18
18
  def displayTitle? elt
19
19
  #elt.id and elt.subject.reverse.index(elt.parent.subject.reverse) != 0
20
- elt.id and elt.parent and elt.subject and !elt.subject.empty? \
20
+ elt.parent and elt.subject and !elt.subject.empty? \
21
21
  and elt.subject != elt.parent.subject \
22
22
  and elt.parent.subject \
23
23
  and elt.subject.downcase != elt.parent.subject.downcase \
@@ -76,6 +76,7 @@ module EltHelper
76
76
  if textiled[-4..-1] == "</p>" then textiled = textiled[0..-5] end
77
77
  # Here to push away the choice span
78
78
  textiled += " "+"&#160;"*22
79
+ textiled = "<span>"+textiled+"</span>"
79
80
  end
80
81
 
81
82
  textiled
data/app/models/elt.rb CHANGED
@@ -63,7 +63,7 @@ class Elt < ActiveRecord::Base
63
63
  #(Choice.count("elt_id = '#{self.id}' AND value = 1") \
64
64
  # - \
65
65
  # Choice.count("elt_id = '#{self.id}' AND value = -1"))
66
- Choice.sum(:value, :conditions => "elt_id = '#{self.id}'")
66
+ Choice.sum(:value, :conditions => "elt_id = '#{self.id}'") || 0
67
67
  end
68
68
 
69
69
  # Mail this elt to all subscribers
@@ -83,6 +83,8 @@ class Elt < ActiveRecord::Base
83
83
  else
84
84
  vote if person
85
85
  end
86
+
87
+ parent.add_child(self) unless lft or rgt
86
88
  true
87
89
  end
88
90
 
data/app/models/mail.rb CHANGED
@@ -109,7 +109,6 @@ class Mail < ActiveRecord::Base
109
109
  elt.parent.id = parentId
110
110
  elt.parent.publish
111
111
  elt.save
112
- elt.parent.parent.add_child elt.parent
113
112
  end
114
113
 
115
114
  mngAttachment mail if mail
@@ -127,8 +126,6 @@ class Mail < ActiveRecord::Base
127
126
  elt.person.image = "/attachment/file/#{elt.attachments.first.file_relative_path}"
128
127
  elt.person.save
129
128
  end
130
-
131
- elt.parent.add_child elt
132
129
  self
133
130
  end
134
131
 
@@ -3,6 +3,7 @@
3
3
  visual_effect(:Grow, "help_#{divId}")+
4
4
  visual_effect(:Grow, "help_close_#{divId}_link"),
5
5
  :class => "helpLink",
6
+ :title => "?",
6
7
  :id => "help_#{divId}_link") %>
7
8
 
8
9
  <%= link_to_function("?",
@@ -10,6 +11,7 @@
10
11
  visual_effect(:Shrink, "help_close_#{divId}_link")+
11
12
  visual_effect(:Grow, "help_#{divId}_link"),
12
13
  :class => "helpLinkClose",
14
+ :title => "?",
13
15
  :id => "help_close_#{divId}_link",
14
16
  :style => "display:none") %>
15
17
 
@@ -1,42 +1,44 @@
1
1
  <% form_remote_tag(
2
2
  :update => 'identity',
3
3
  :url => { :controller => 'account', :action => 'login', :elt => @elt },
4
- :before => visual_effect(:BlindUp, 'identity', { :queue => 'login' })+";resetChoices();",
5
- :loaded => visual_effect(:BlindDown, 'identity', { :queue => 'login' })+visual_effect(:BlindDown, 'subscriptionLink')) do %>
6
-
7
- <div class="login"><%= _('Please, choose a pseudo') %></div>
8
-
9
- <label for="person_name"><%= _('Pseudo') %>:
10
- <%= text_field "person", "name", :size => 10 %>
11
- <script type="text/javascript">Form.focusFirstElement(document.forms[0]);</script>
12
- </label>
13
-
14
- <%= link_to_function('<span class="icon">&gt;&gt;</span>',
15
- "Element.toggle(this);" \
16
- +visual_effect(:Grow, 'user_password_identity') \
17
- +"Form.focusFirstElement(document.forms[0])") %>
18
-
19
- <span id="user_password_identity" style="display: none">
20
- <br/>
21
- <label for="user_password"><%= _('Password') %>:
22
- <%= password_field "user", "password", :size => 10 %>
23
- </label>
24
-
25
- <%= link_to_function('<span class="icon">&gt;&gt;</span>',
26
- "Element.toggle(this);" \
27
- +visual_effect(:Grow, 'person_email_identity') \
28
- +"Form.focusFirstElement(document.forms[0])") %>
29
- </span>
30
-
31
- <span id="person_email_identity" style="display: none">
32
- <br/>
33
- <label for="person_email"><%= _('Email (or check key)') %>:</label>
34
- <%= text_field "person", "email", :size => 20 %>
35
- </span>
36
-
37
- <%= submit_tag 'OK' %>
38
-
39
- <%= render :partial => '/help',
40
- :locals => { :divId => 'login', :content => _('<p>You can participate with:</p> <ul><li>no pseudo</li> <li>an unprotected pseudo</li> <li>a password protected pseudo (click on "<span class="icon">&gt;&gt;</span>")</li> <li>a password protected and email verified pseudo</li></ul> <p> The last method is the only secure way to protect a nickname on <strong>this</strong> server.</p> <p>If a pseudo is not protected <strong>and</strong> verified, anybody else can protect it for themselves if they at least supply a password <em>and</em> an email.</p> <p>A login must contain [3..40] characters, a password [5..40].</p>') } %>
4
+ :before => visual_effect(:BlindUp, 'identity', { :queue => 'login' }) \
5
+ +";resetChoices();",
6
+ :loaded => visual_effect(:BlindDown, 'identity', { :queue => 'login' }) \
7
+ +visual_effect(:BlindDown, 'subscriptionLink')) do %>
8
+
9
+ <fieldset>
10
+ <label for="person_name"><%= _('Pseudo') %>:</label>
11
+ <%= text_field "person", "name", :size => 10 %>
12
+ <script type="text/javascript">Form.focusFirstElement(document.forms[0]);</script>
13
+
14
+ <%= link_to_function('<span class="icon">&gt;&gt;</span>',
15
+ "Element.toggle(this);" \
16
+ +visual_effect(:Grow, 'user_password_identity') \
17
+ +"Form.focusFirstElement(document.forms[0])") %>
18
+
19
+ <span id="user_password_identity" style="display: none">
20
+ <br />
21
+ <label for="user_password"><%= _('Password') %>:</label>
22
+ <%= password_field "user", "password", :size => 10 %>
23
+
24
+ <%= link_to_function('<span class="icon">&gt;&gt;</span>',
25
+ "Element.toggle(this);" \
26
+ +visual_effect(:Grow, 'person_email_identity') \
27
+ +"Form.focusFirstElement(document.forms[0])") %>
28
+ </span>
29
+
30
+ <span id="person_email_identity" style="display: none">
31
+ <br />
32
+ <label for="person_email"><%= _('Email (or check key)') %>:</label>
33
+ <%= text_field "person", "email", :size => 20 %>
34
+ </span>
35
+
36
+ <%= submit_tag 'OK' %>
37
+
38
+ <%= render :partial => '/help',
39
+ :locals => {
40
+ :divId => 'login',
41
+ :content => _('<p>You can participate with:</p> <ul><li>no pseudo</li> <li>an unprotected pseudo</li> <li>a password protected pseudo (click on "<span class="icon">&gt;&gt;</span>")</li> <li>a password protected and email verified pseudo</li></ul> <p> The last method is the only secure way to protect a nickname on <strong>this</strong> server.</p> <p>If a pseudo is not protected <strong>and</strong> verified, anybody else can protect it for themselves if they at least supply a password <em>and</em> an email.</p> <p>A login must contain [3..40] characters, a password [5..40].</p>') } %>
42
+ </fieldset>
41
43
  <% end %>
42
44
 
@@ -9,23 +9,31 @@
9
9
 
10
10
  <% if choices ||= false %>
11
11
  <!-- Here are updated all choices, watch out, javascript! -->
12
- <span class="choicesToUpdate" title="choicesToUpdate">
13
- <%= choices.size %>
14
- <script language="JavaScript">
15
- var choices_to_update = {
16
- <%= choices.collect { |c| "'elt_#{ c.elt_id }' : '#{ c.value }'" }.join(', ') %>
17
- };
18
- updateChoices(choices_to_update);
12
+ <span class="choicesToUpdate">
13
+ <script type="text/javascript">
14
+ updateChoices(
15
+ {<%= choices.collect { |c| "'elt_#{ c.elt_id }' : '#{ c.value }'" }.join(', ') %>}
16
+ );
19
17
  </script>
20
18
  </span>
21
19
  <% end %>
22
20
 
23
21
  <% if @person = session[:person] %>
24
- <script language="JavaScript">
25
- if ($('subscriptionLink')) {
26
- Element.show($('subscriptionLink'));
27
- }
28
- </script>
22
+ <script type="text/javascript">
23
+ if ($('subscriptionLink')) {
24
+ Element.show($('subscriptionLink'));
25
+ }
26
+ Element.addClassName(document.body, "logged");
27
+ Element.removeClassName(document.body, "anon");
28
+ </script>
29
+
30
+ <span class="author">
31
+ &lt;<%= link_to session[:person].name,
32
+ :controller => 'person',
33
+ :action => 'show',
34
+ :id => session[:person] %>&gt;
35
+ </span>
36
+
29
37
  <span class="logout">
30
38
  <%= link_to_remote('[X]',
31
39
  { :update => 'identity',
@@ -36,12 +44,6 @@
36
44
  :loaded => visual_effect(:BlindDown, 'identity', { :queue => 'login' }) },
37
45
  { :href => url_for(:controller => 'account', :action => 'logout') }) %>
38
46
  </span>
39
- <span class="author">
40
- &lt;<%= link_to session[:person].name,
41
- :controller => 'person',
42
- :action => 'show',
43
- :id => session[:person] %>&gt;
44
- </span>
45
47
 
46
48
  <div>
47
49
  <%= image_tag (@person.image ? @person.image : "/javascripts/blank.gif"),
@@ -80,6 +82,10 @@
80
82
 
81
83
  <iframe id="avatar" name="avatar" style="display: none"></iframe>
82
84
  <% else %>
85
+ <script type="text/javascript">
86
+ Element.removeClassName(document.body, "logged");
87
+ Element.addClassName(document.body, "anon");
88
+ </script>
83
89
 
84
90
  <%= render :partial => '/account/login' %>
85
91
  <% end %>