parlement 0.14 → 0.17

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.
Files changed (205) hide show
  1. data/CHANGES +41 -1
  2. data/MEMORY +66 -5
  3. data/README +10 -5
  4. data/Rakefile +15 -23
  5. data/app/controllers/account_controller.rb +48 -43
  6. data/app/controllers/{application.rb → application_controller.rb} +15 -12
  7. data/app/controllers/elt_controller.rb +77 -32
  8. data/app/controllers/subscriber_controller.rb +11 -10
  9. data/app/helpers/application_helper.rb +14 -1
  10. data/app/helpers/elt_helper.rb +9 -7
  11. data/app/models/elt.rb +25 -24
  12. data/app/models/mail.rb +44 -47
  13. data/app/models/person_notify.rb +2 -2
  14. data/app/models/user.rb +128 -2
  15. data/app/models/user_notify.rb +15 -15
  16. data/app/views/account/_login.rhtml +39 -39
  17. data/app/views/account/_show.rhtml +22 -30
  18. data/app/views/account/signup.rhtml +2 -2
  19. data/app/views/elt/_choice.rhtml +6 -6
  20. data/app/views/elt/_elt.rhtml +27 -32
  21. data/app/views/elt/choices.rhtml +16 -18
  22. data/app/views/elt/list/_byDate.rhtml +14 -14
  23. data/app/views/elt/list/_byVote.rhtml +15 -15
  24. data/app/views/elt/list/_children.rhtml +48 -40
  25. data/app/views/elt/list/_subscribers.rhtml +1 -1
  26. data/app/views/elt/new.rhtml +22 -21
  27. data/app/views/elt/rss.rxml +4 -11
  28. data/app/views/elt/show.rhtml +65 -61
  29. data/app/views/elt/vote_rss.rxml +4 -11
  30. data/app/views/layouts/top.rhtml +39 -50
  31. data/app/views/person/_listElts.rhtml +1 -1
  32. data/app/views/person/show.rhtml +1 -1
  33. data/{vendor/plugins/login_engine/app → app}/views/user_notify/change_password.rhtml +0 -0
  34. data/{vendor/plugins/login_engine/app → app}/views/user_notify/delete.rhtml +0 -0
  35. data/{vendor/plugins/login_engine/app → app}/views/user_notify/forgot_password.rhtml +0 -0
  36. data/{vendor/plugins/login_engine/app → app}/views/user_notify/pending_delete.rhtml +0 -0
  37. data/{vendor/plugins/login_engine/app → app}/views/user_notify/signup.rhtml +0 -0
  38. data/config/boot.rb +97 -32
  39. data/config/environment.rb +37 -35
  40. data/config/environments/development.rb +2 -3
  41. data/config/environments/production.rb +3 -0
  42. data/config/initializers/string_ruby_1.8.rb +10 -0
  43. data/config/routes.rb +17 -22
  44. data/db/schema.rb +102 -74
  45. data/lib/tasks/rspec.rake +167 -0
  46. data/public/404.html +25 -7
  47. data/public/500.html +26 -7
  48. data/public/dispatch.cgi +0 -0
  49. data/public/dispatch.fcgi +0 -0
  50. data/public/dispatch.rb +0 -0
  51. data/public/images/live_tree_branch_collapsed_icon.gif +0 -0
  52. data/public/images/live_tree_branch_expanded_icon.gif +0 -0
  53. data/public/images/live_tree_leaf_icon.gif +0 -0
  54. data/public/javascripts/application.js +258 -0
  55. data/public/javascripts/controls.js +544 -414
  56. data/public/javascripts/dragdrop.js +229 -198
  57. data/public/javascripts/effects.js +499 -459
  58. data/public/javascripts/prototype.js +2926 -1121
  59. data/public/javascripts/shadedborder.js +68 -50
  60. data/public/stylesheets/default.css +34 -34
  61. data/public/stylesheets/live_tree.css +0 -0
  62. data/public/stylesheets/scaffold.css +6 -6
  63. data/script/about +0 -0
  64. data/script/autospec +6 -0
  65. data/script/benchmarker +0 -0
  66. data/script/breakpointer +0 -0
  67. data/script/console +0 -0
  68. data/script/dbconsole +3 -0
  69. data/script/destroy +0 -0
  70. data/script/generate +0 -0
  71. data/script/plugin +0 -0
  72. data/script/profiler +0 -0
  73. data/script/runner +0 -0
  74. data/script/server +0 -0
  75. data/script/spec +10 -0
  76. data/script/spec_server +9 -0
  77. data/test/unit/attachment_test.rb +4 -4
  78. data/test/unit/choice_test.rb +1 -1
  79. data/test/unit/elt_test.rb +9 -9
  80. data/test/unit/mail_notify_test.rb +2 -2
  81. data/test/unit/mail_test.rb +18 -11
  82. data/test/unit/person_notify_test.rb +1 -1
  83. data/test/unit/person_test.rb +1 -1
  84. data/test/unit/subscriber_test.rb +1 -1
  85. data/test/unit/user_test.rb +81 -0
  86. data/test/unit/visit_test.rb +6 -6
  87. data/vendor/plugins/activerecord_foreign_key_extensions/init.rb +2 -0
  88. data/vendor/plugins/activerecord_foreign_key_extensions/lib/active_record_extensions.rb +182 -0
  89. data/vendor/plugins/activerecord_text_id_extensions/init.rb +2 -0
  90. data/vendor/plugins/activerecord_text_id_extensions/lib/active_record_extensions.rb +24 -0
  91. data/vendor/plugins/acts_as_nested_set/README +15 -0
  92. data/vendor/plugins/acts_as_nested_set/init.rb +1 -0
  93. data/vendor/plugins/acts_as_nested_set/lib/active_record/acts/nested_set.rb +210 -0
  94. data/vendor/plugins/acts_as_nested_set/test/nested_set_test.rb +269 -0
  95. data/vendor/plugins/acts_as_tree/README +26 -0
  96. data/vendor/plugins/acts_as_tree/Rakefile +22 -0
  97. data/vendor/plugins/acts_as_tree/init.rb +1 -0
  98. data/vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb +96 -0
  99. data/vendor/plugins/{output_compression/CHANGELOG → acts_as_tree/test/abstract_unit.rb} +0 -0
  100. data/vendor/plugins/acts_as_tree/test/acts_as_tree_test.rb +219 -0
  101. data/vendor/plugins/acts_as_tree/test/database.yml +0 -0
  102. data/vendor/plugins/acts_as_tree/test/fixtures/mixin.rb +0 -0
  103. data/vendor/plugins/acts_as_tree/test/fixtures/mixins.yml +0 -0
  104. data/vendor/plugins/acts_as_tree/test/schema.rb +0 -0
  105. data/vendor/plugins/classic_pagination/CHANGELOG +152 -0
  106. data/vendor/plugins/classic_pagination/README +18 -0
  107. data/vendor/plugins/{output_compression/rakefile → classic_pagination/Rakefile} +22 -22
  108. data/vendor/plugins/classic_pagination/init.rb +33 -0
  109. data/vendor/plugins/classic_pagination/install.rb +1 -0
  110. data/vendor/plugins/classic_pagination/lib/pagination.rb +405 -0
  111. data/vendor/plugins/classic_pagination/lib/pagination_helper.rb +135 -0
  112. data/vendor/plugins/classic_pagination/test/fixtures/companies.yml +24 -0
  113. data/vendor/plugins/classic_pagination/test/fixtures/company.rb +9 -0
  114. data/vendor/plugins/classic_pagination/test/fixtures/developer.rb +7 -0
  115. data/vendor/plugins/classic_pagination/test/fixtures/developers.yml +21 -0
  116. data/vendor/plugins/classic_pagination/test/fixtures/developers_projects.yml +13 -0
  117. data/vendor/plugins/classic_pagination/test/fixtures/project.rb +3 -0
  118. data/vendor/plugins/classic_pagination/test/fixtures/projects.yml +7 -0
  119. data/vendor/plugins/classic_pagination/test/fixtures/replies.yml +13 -0
  120. data/vendor/plugins/classic_pagination/test/fixtures/reply.rb +5 -0
  121. data/vendor/plugins/classic_pagination/test/fixtures/schema.sql +42 -0
  122. data/vendor/plugins/classic_pagination/test/fixtures/topic.rb +3 -0
  123. data/vendor/plugins/classic_pagination/test/fixtures/topics.yml +22 -0
  124. data/vendor/plugins/classic_pagination/test/helper.rb +117 -0
  125. data/vendor/plugins/classic_pagination/test/pagination_helper_test.rb +38 -0
  126. data/vendor/plugins/classic_pagination/test/pagination_test.rb +177 -0
  127. data/vendor/plugins/file_column/lib/file_column.rb +1 -1
  128. data/vendor/plugins/file_column/test/file_column_test.rb +0 -0
  129. metadata +151 -197
  130. data/app/helpers/live_tree.rb +0 -238
  131. data/app/views/elt/_form.rhtml +0 -31
  132. data/app/views/elt/show_tree.rhtml +0 -8
  133. data/config/environments/user_environment.rb +0 -1
  134. data/db/ROOT/Titemagli.txt +0 -3
  135. data/db/ROOT/titemagli.txt +0 -9
  136. data/public/javascripts/behaviour.js +0 -254
  137. data/public/javascripts/ie7-load.htc +0 -1
  138. data/public/javascripts/ie7.js +0 -6
  139. data/public/javascripts/live_tree.js +0 -749
  140. data/public/javascripts/mybehaviour.js +0 -225
  141. data/public/javascripts/scriptaculous.js +0 -47
  142. data/public/javascripts/slider.js +0 -283
  143. data/public/stylesheets/blue.css +0 -471
  144. data/vendor/plugins/engines/CHANGELOG +0 -241
  145. data/vendor/plugins/engines/MIT-LICENSE +0 -21
  146. data/vendor/plugins/engines/README +0 -64
  147. data/vendor/plugins/engines/Rakefile +0 -32
  148. data/vendor/plugins/engines/UPGRADING +0 -93
  149. data/vendor/plugins/engines/about.yml +0 -7
  150. data/vendor/plugins/engines/generators/plugin_migration/USAGE +0 -45
  151. data/vendor/plugins/engines/generators/plugin_migration/plugin_migration_generator.rb +0 -79
  152. data/vendor/plugins/engines/generators/plugin_migration/templates/plugin_migration.erb +0 -13
  153. data/vendor/plugins/engines/init.rb +0 -40
  154. data/vendor/plugins/engines/install.rb +0 -32
  155. data/vendor/plugins/engines/lib/engines.rb +0 -323
  156. data/vendor/plugins/engines/lib/engines/deprecated_config_support.rb +0 -135
  157. data/vendor/plugins/engines/lib/engines/plugin.rb +0 -214
  158. data/vendor/plugins/engines/lib/engines/plugin_list.rb +0 -31
  159. data/vendor/plugins/engines/lib/engines/plugin_migrator.rb +0 -60
  160. data/vendor/plugins/engines/lib/engines/rails_extensions.rb +0 -6
  161. data/vendor/plugins/engines/lib/engines/rails_extensions/active_record.rb +0 -19
  162. data/vendor/plugins/engines/lib/engines/rails_extensions/dependencies.rb +0 -143
  163. data/vendor/plugins/engines/lib/engines/rails_extensions/migrations.rb +0 -155
  164. data/vendor/plugins/engines/lib/engines/rails_extensions/public_asset_helpers.rb +0 -116
  165. data/vendor/plugins/engines/lib/engines/rails_extensions/rails.rb +0 -20
  166. data/vendor/plugins/engines/lib/engines/rails_extensions/rails_initializer.rb +0 -86
  167. data/vendor/plugins/engines/lib/engines/rails_extensions/routing.rb +0 -77
  168. data/vendor/plugins/engines/lib/engines/rails_extensions/templates.rb +0 -140
  169. data/vendor/plugins/engines/lib/engines/testing.rb +0 -87
  170. data/vendor/plugins/engines/tasks/engines.rake +0 -149
  171. data/vendor/plugins/login_engine/CHANGELOG +0 -22
  172. data/vendor/plugins/login_engine/README +0 -344
  173. data/vendor/plugins/login_engine/app/controllers/user_controller.rb +0 -262
  174. data/vendor/plugins/login_engine/app/helpers/user_helper.rb +0 -88
  175. data/vendor/plugins/login_engine/app/models/user.rb +0 -7
  176. data/vendor/plugins/login_engine/app/models/user_notify.rb +0 -75
  177. data/vendor/plugins/login_engine/app/views/user/_edit.rhtml +0 -11
  178. data/vendor/plugins/login_engine/app/views/user/_password.rhtml +0 -9
  179. data/vendor/plugins/login_engine/app/views/user/change_password.rhtml +0 -17
  180. data/vendor/plugins/login_engine/app/views/user/edit.rhtml +0 -23
  181. data/vendor/plugins/login_engine/app/views/user/forgot_password.rhtml +0 -18
  182. data/vendor/plugins/login_engine/app/views/user/home.rhtml +0 -7
  183. data/vendor/plugins/login_engine/app/views/user/login.rhtml +0 -17
  184. data/vendor/plugins/login_engine/app/views/user/logout.rhtml +0 -8
  185. data/vendor/plugins/login_engine/app/views/user/signup.rhtml +0 -17
  186. data/vendor/plugins/login_engine/db/migrate/001_initial_schema.rb +0 -25
  187. data/vendor/plugins/login_engine/init_engine.rb +0 -11
  188. data/vendor/plugins/login_engine/install.rb +0 -4
  189. data/vendor/plugins/login_engine/lib/login_engine.rb +0 -62
  190. data/vendor/plugins/login_engine/lib/login_engine/authenticated_system.rb +0 -113
  191. data/vendor/plugins/login_engine/lib/login_engine/authenticated_user.rb +0 -155
  192. data/vendor/plugins/login_engine/public/stylesheets/login_engine.css +0 -81
  193. data/vendor/plugins/login_engine/test/fixtures/users.yml +0 -41
  194. data/vendor/plugins/login_engine/test/functional/user_controller_test.rb +0 -536
  195. data/vendor/plugins/login_engine/test/mocks/mail.rb +0 -14
  196. data/vendor/plugins/login_engine/test/mocks/time.rb +0 -19
  197. data/vendor/plugins/login_engine/test/test_helper.rb +0 -11
  198. data/vendor/plugins/login_engine/test/unit/user_test.rb +0 -114
  199. data/vendor/plugins/output_compression/MIT-LICENSE +0 -20
  200. data/vendor/plugins/output_compression/README +0 -4
  201. data/vendor/plugins/output_compression/init.rb +0 -1
  202. data/vendor/plugins/output_compression/lib/output_compression.rb +0 -84
  203. data/vendor/plugins/output_compression/test/output_test.rb +0 -11
  204. data/vendor/plugins/output_compression/test/test_controller.rb +0 -3
  205. data/vendor/plugins/output_compression/test/test_helper.rb +0 -14
@@ -3,11 +3,11 @@ class PersonNotify < ActionMailer::Base
3
3
  # Email header info MUST be added here
4
4
  @recipients = person.user.email
5
5
  @subject = "[parlement] email verification"
6
- @from = LoginEngine.config(:email_from).to_s
6
+ @from = LOGIN_ENGINE[:email_from].to_s
7
7
 
8
8
  # Email body substitutions go here
9
9
  @body["name"] = person.name
10
10
  @body["url"] = url
11
- @body["app_name"] = LoginEngine.config(:app_name).to_s
11
+ @body["app_name"] = LOGIN_ENGINE[:app_name].to_s
12
12
  end
13
13
  end
@@ -1,7 +1,133 @@
1
1
  class User < ActiveRecord::Base
2
- include LoginEngine::AuthenticatedUser
2
+ attr_accessor :new_password
3
3
 
4
- # all logic has been moved into login_engine/lib/login_engine/authenticated_user.rb
4
+ validates_presence_of :login
5
+ validates_length_of :login, :within => 3..40
6
+ validates_uniqueness_of :login
7
+ validates_uniqueness_of :email
8
+ validates_format_of :email, :with => /^[^@]+@.+$/
5
9
 
10
+ validates_presence_of :password, :if => :validate_password?
11
+ validates_confirmation_of :password, :if => :validate_password?
12
+ validates_length_of :password, { :minimum => 5, :if => :validate_password? }
13
+ validates_length_of :password, { :maximum => 40, :if => :validate_password? }
14
+
15
+ protected
16
+
17
+ attr_accessor :password, :password_confirmation
18
+
19
+ after_save :falsify_new_password
20
+ after_validation :crypt_password
21
+
22
+ public
23
+
24
+ def User.authenticate(login, pass)
25
+ u = find(:first, :conditions => ["login = ? AND verified = 1 AND deleted = 0", login])
26
+ return nil if u.nil?
27
+ find(:first, :conditions => ["login = ? AND salted_password = ? AND verified = 1", login, salted_password(u.salt, hashed(pass))])
28
+ end
29
+
30
+ def User.authenticate_by_token(id, token)
31
+ # Allow logins for deleted accounts, but only via this method (and
32
+ # not the regular authenticate call)
33
+ u = find(:first, :conditions => ["#{User.primary_key} = ? AND security_token = ?", id, token])
34
+ return nil if u.nil? or u.token_expired?
35
+ return nil if false == u.update_expiry
36
+ u
37
+ end
38
+
39
+ protected
40
+
41
+ def self.hashed(str)
42
+ # check if a salt has been set...
43
+ if LOGIN_ENGINE[:salt] == nil
44
+ raise "You must define a :salt value in the configuration for the LoginEngine module."
45
+ end
46
+
47
+ return Digest::SHA1.hexdigest("#{LOGIN_ENGINE[:salt]}--#{str}--}")[0..39]
48
+ end
49
+
50
+ def self.salted_password(salt, hashed_password)
51
+ hashed(salt + hashed_password)
52
+ end
53
+
54
+ public
55
+
56
+ # hmmm, how does this interact with the developer's own User model initialize?
57
+ # We would have to *insist* that the User.initialize method called 'super'
58
+ def initialize(attributes = nil)
59
+ super
60
+ @new_password = false
61
+ end
62
+
63
+ def token_expired?
64
+ self.security_token and self.token_expiry and (Time.now > self.token_expiry)
65
+ end
66
+
67
+ def update_expiry
68
+ write_attribute('token_expiry', [self.token_expiry, Time.at(Time.now.to_i + 600 * 1000)].min)
69
+ write_attribute('authenticated_by_token', true)
70
+ write_attribute("verified", 1)
71
+ update_without_callbacks
72
+ end
73
+
74
+ def generate_security_token(hours = nil)
75
+ if not hours.nil? or self.security_token.nil? or self.token_expiry.nil? or
76
+ (Time.now.to_i + token_lifetime / 2) >= self.token_expiry.to_i
77
+ return new_security_token(hours)
78
+ else
79
+ return self.security_token
80
+ end
81
+ end
82
+
83
+ def set_delete_after
84
+ hours = LOGIN_ENGINE[:delayed_delete_days] * 24
85
+ write_attribute('deleted', 1)
86
+ write_attribute('delete_after', Time.at(Time.now.to_i + hours * 60 * 60))
87
+
88
+ # Generate and return a token here, so that it expires at
89
+ # the same time that the account deletion takes effect.
90
+ return generate_security_token(hours)
91
+ end
92
+
93
+ def change_password(pass, confirm = nil)
94
+ self.password = pass
95
+ self.password_confirmation = confirm.nil? ? pass : confirm
96
+ @new_password = true
97
+ end
98
+
99
+ protected
100
+
101
+ def validate_password?
102
+ @new_password
103
+ end
104
+
105
+
106
+ def crypt_password
107
+ if @new_password
108
+ write_attribute("salt", User.hashed("salt-#{Time.now}"))
109
+ write_attribute("salted_password", User.salted_password(salt, User.hashed(@password)))
110
+ end
111
+ end
112
+
113
+ def falsify_new_password
114
+ @new_password = false
115
+ true
116
+ end
117
+
118
+ def new_security_token(hours = nil)
119
+ write_attribute('security_token', User.hashed(self.salted_password + Time.now.to_i.to_s + rand.to_s))
120
+ write_attribute('token_expiry', Time.at(Time.now.to_i + token_lifetime(hours)))
121
+ update_without_callbacks
122
+ return self.security_token
123
+ end
124
+
125
+ def token_lifetime(hours = nil)
126
+ if hours.nil?
127
+ LOGIN_ENGINE[:security_token_life_hours] * 60 * 60
128
+ else
129
+ hours * 60 * 60
130
+ end
131
+ end
6
132
  end
7
133
 
@@ -3,14 +3,14 @@ class UserNotify < ActionMailer::Base
3
3
  setup_email(user)
4
4
 
5
5
  # Email header info
6
- @subject += "Welcome to #{LoginEngine.config(:app_name)}!"
6
+ @subject += "Welcome to #{LOGIN_ENGINE[:app_name]}!"
7
7
 
8
8
  # Email body substitutions
9
9
  @body["name"] = "#{user.firstname} #{user.lastname}"
10
10
  @body["login"] = user.login
11
11
  @body["password"] = password
12
- @body["url"] = url || LoginEngine.config(:app_url).to_s
13
- @body["app_name"] = LoginEngine.config(:app_name).to_s
12
+ @body["url"] = url || LOGIN_ENGINE[:app_url].to_s
13
+ @body["app_name"] = LOGIN_ENGINE[:app_name].to_s
14
14
  end
15
15
 
16
16
  def forgot_password(user, url=nil)
@@ -22,8 +22,8 @@ class UserNotify < ActionMailer::Base
22
22
  # Email body substitutions
23
23
  @body["name"] = "#{user.firstname} #{user.lastname}"
24
24
  @body["login"] = user.login
25
- @body["url"] = url || LoginEngine.config(:app_url).to_s
26
- @body["app_name"] = LoginEngine.config(:app_name).to_s
25
+ @body["url"] = url || LOGIN_ENGINE[:app_url].to_s
26
+ @body["app_name"] = LOGIN_ENGINE[:app_name].to_s
27
27
  end
28
28
 
29
29
  def change_password(user, password, url=nil)
@@ -36,8 +36,8 @@ class UserNotify < ActionMailer::Base
36
36
  @body["name"] = "#{user.firstname} #{user.lastname}"
37
37
  @body["login"] = user.login
38
38
  @body["password"] = password
39
- @body["url"] = url || LoginEngine.config(:app_url).to_s
40
- @body["app_name"] = LoginEngine.config(:app_name).to_s
39
+ @body["url"] = url || LOGIN_ENGINE[:app_url].to_s
40
+ @body["app_name"] = LOGIN_ENGINE[:app_name].to_s
41
41
  end
42
42
 
43
43
  def pending_delete(user, url=nil)
@@ -48,9 +48,9 @@ class UserNotify < ActionMailer::Base
48
48
 
49
49
  # Email body substitutions
50
50
  @body["name"] = "#{user.firstname} #{user.lastname}"
51
- @body["url"] = url || LoginEngine.config(:app_url).to_s
52
- @body["app_name"] = LoginEngine.config(:app_name).to_s
53
- @body["days"] = LoginEngine.config(:delayed_delete_days).to_s
51
+ @body["url"] = url || LOGIN_ENGINE[:app_url].to_s
52
+ @body["app_name"] = LOGIN_ENGINE[:app_name].to_s
53
+ @body["days"] = LOGIN_ENGINE[:delayed_delete_days].to_s
54
54
  end
55
55
 
56
56
  def delete(user, url=nil)
@@ -61,15 +61,15 @@ class UserNotify < ActionMailer::Base
61
61
 
62
62
  # Email body substitutions
63
63
  @body["name"] = "#{user.firstname} #{user.lastname}"
64
- @body["url"] = url || LoginEngine.config(:app_url).to_s
65
- @body["app_name"] = LoginEngine.config(:app_name).to_s
64
+ @body["url"] = url || LOGIN_ENGINE[:app_url].to_s
65
+ @body["app_name"] = LOGIN_ENGINE[:app_name].to_s
66
66
  end
67
67
 
68
68
  def setup_email(user)
69
69
  @recipients = "#{user.email}"
70
- @from = LoginEngine.config(:email_from).to_s
71
- @subject = "[#{LoginEngine.config(:app_name)}] "
70
+ @from = LOGIN_ENGINE[:email_from].to_s
71
+ @subject = "[#{LOGIN_ENGINE[:app_name]}] "
72
72
  @sent_on = Time.now
73
- @headers['Content-Type'] = "text/plain; charset=#{LoginEngine.config(:mail_charset)}; format=flowed"
73
+ @headers['Content-Type'] = "text/plain; charset=#{LOGIN_ENGINE[:mail_charset]}; format=flowed"
74
74
  end
75
75
  end
@@ -1,44 +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' }) \
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>
4
+ :before => visual_effect(:DropOut, 'identity', { :queue => 'end' }),
5
+ :after => "resetChoices()",
6
+ :loading => visual_effect(:BlindDown, 'identity', { :queue => 'end' }),
7
+ :complete => 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>
43
43
  <% end %>
44
44
 
@@ -11,14 +11,14 @@
11
11
  <!-- Here are updated all choices, watch out, javascript! -->
12
12
  <span class="choicesToUpdate">
13
13
  <script type="text/javascript">
14
- updateChoices(
15
- {<%= choices.collect { |c| "'elt_#{ c.elt_id }' : '#{ c.value }'" }.join(', ') %>}
14
+ updateChoices(
15
+ {<%= choices.collect { |c| "'elt_#{ c.elt_id }' : '#{ c.value }'" }.join(', ') %>}
16
16
  );
17
17
  </script>
18
18
  </span>
19
19
  <% end %>
20
20
 
21
- <% if @person = session[:person] %>
21
+ <% if @person = Person.find_by_id(session[:person_id]) %>
22
22
  <script type="text/javascript">
23
23
  if ($('subscriptionLink')) {
24
24
  Element.show($('subscriptionLink'));
@@ -28,21 +28,19 @@
28
28
  </script>
29
29
 
30
30
  <span class="author">
31
- &lt;<%= link_to session[:person].name,
31
+ &lt;<%= link_to @person.name,
32
32
  :controller => 'person',
33
33
  :action => 'show',
34
- :id => session[:person] %>&gt;
34
+ :id => @person %>&gt;
35
35
  </span>
36
36
 
37
37
  <span class="logout">
38
38
  <%= link_to_remote('[X]',
39
39
  { :update => 'identity',
40
40
  :url => { :controller => 'account', :action => 'logout', :elt => @elt },
41
- :before => visual_effect(:BlindUp, 'identity', { :queue => 'login' }) \
42
- +visual_effect(:BlindUp, 'subscriptionLink', { :queue => 'login' }) \
43
- +"resetChoices();",
44
- :loaded => visual_effect(:BlindDown, 'identity', { :queue => 'login' }) },
45
- { :href => url_for(:controller => 'account', :action => 'logout') }) %>
41
+ :before => { visual_effect(:DropOut, 'identity', { :queue => 'end' }), "resetChoices()" },
42
+ :after => visual_effect(:DropOut, 'subscriptionLink'),
43
+ :loading => visual_effect(:BlindDown, 'identity', { :queue => 'end' }) }) %>
46
44
  </span>
47
45
 
48
46
  <div>
@@ -50,42 +48,36 @@
50
48
  :id => "person_avatar", :class => "avatar" %>
51
49
  </div>
52
50
 
53
- <fieldset id="edit">
54
- <legend><%= _('Edit') %></legend>
55
- <% form_remote_tag(
56
- :update => 'identity',
57
- :url => { :controller => 'account', :action => 'setPassword' },
58
- :before => visual_effect(:BlindUp, 'identity'),
59
- :loaded => visual_effect(:BlindDown, 'identity')) do %>
60
- <label for="user_password"><%= _('Password') %>:</label>
51
+ <fieldset id="identityEdition">
52
+ <legend><%= _('Edit') %></legend>
53
+ <% form_remote_tag(:update => 'identity',
54
+ :url => { :controller => 'account', :action => 'setPassword' }) do %>
55
+ <label for="user_password"><%= _('Password') %>:</label>
61
56
  <%= password_field "user", "password", :size => 12 %>
62
57
  <%= submit_tag 'OK' %>
63
58
  <% end %>
64
59
 
65
- <% form_remote_tag(
66
- :update => 'identity',
67
- :url => { :controller => 'account', :action => 'setEmail' },
68
- :before => visual_effect(:BlindUp, 'identity'),
69
- :loaded => visual_effect(:BlindDown, 'identity')) do %>
70
- <label for="person_email"><%= _('Email') %>:</label>
60
+ <% form_remote_tag(:update => 'identity',
61
+ :url => { :controller => 'account', :action => 'setEmail' }) do %>
62
+ <label for="person_email"><%= _('Email') %>:</label>
71
63
  <%= text_field "person", "email", :size => 16 %>
72
64
  <%= submit_tag 'OK' %>
73
65
  <% end %>
74
66
 
75
67
  <% form_tag( { :controller => "account", :action => "setAvatar"},
76
68
  :multipart => true, :target => "avatar", :class => "setAvatar") do %>
77
- <label><%= _('Avatar') %>:</label>
78
- <%= file_field "person", "image", :onchange => "submit()", :size => 3 %>
69
+ <label><%= _('Avatar') %>:</label>
70
+ <%= file_field :person, :image, :size => 8 %>
79
71
  <%= submit_tag 'OK' %>
80
72
  <% end %>
81
73
  </fieldset>
82
74
 
83
75
  <iframe id="avatar" name="avatar" style="display: none"></iframe>
84
76
  <% else %>
85
- <script type="text/javascript">
86
- Element.removeClassName(document.body, "logged");
87
- Element.addClassName(document.body, "anon");
88
- </script>
77
+ <script type="text/javascript">
78
+ Element.removeClassName(document.body, "logged");
79
+ Element.addClassName(document.body, "anon");
80
+ </script>
89
81
 
90
82
  <%= render :partial => '/account/login' %>
91
83
  <% end %>
@@ -1,4 +1,4 @@
1
- <%= start_form_tag :action=> "signup" %>
1
+ <% form_tag "signup" do %>
2
2
 
3
3
  <div title="Account signup" id="signupform" class="form">
4
4
  <h3>Signup</h3>
@@ -13,5 +13,5 @@
13
13
 
14
14
  <input type="submit" value="Signup &#187;" class="primary" />
15
15
 
16
- <%= end_form_tag %>
16
+ <% end %>
17
17
 
@@ -1,5 +1,5 @@
1
1
  <%
2
- choice = Choice.find_by_elt_id_and_person_id elt.id, session[:person].id if session[:person]
2
+ choice = Choice.find_by_elt_id_and_person_id elt.id, session[:person_id]
3
3
  result = elt.result
4
4
  %>
5
5
 
@@ -9,12 +9,12 @@
9
9
  { :update => 'eltChoice_'+elt.id.to_s,
10
10
  :url => { :action => 'vote', :id => elt, 'choice[value]' => '-1' },
11
11
  :before => visual_effect(:DropOut, 'eltChoice_'+elt.id.to_s, { :queue => 'end' }),
12
- :loaded => visual_effect(:Grow, 'eltChoice_'+elt.id.to_s, { :queue => 'end' }) },
12
+ :complete => visual_effect(:Grow, 'eltChoice_'+elt.id.to_s, { :queue => 'end' }) },
13
13
  { :href => url_for(:controller => 'elt', :action => 'vote', 'choice[value]' => '-1') }) %>
14
14
 
15
15
  <%= link_to_remote("%+d" % result,
16
- { :update => 'result_'+elt.id,
17
- :position => :top,
16
+ { :update => 'eltChoice_'+elt.id,
17
+ :position => :after,
18
18
  :url => { :action => 'choices', :id => elt } },
19
19
  { :class => 'result' + ((choice and choice.value != 0) ? ' selected' : ''),
20
20
  :id => "result_#{ elt.id}",
@@ -26,7 +26,7 @@
26
26
  { :update => 'eltChoice_'+elt.id.to_s,
27
27
  :url => { :action => 'vote', :id => elt, 'choice[value]' => '+1' },
28
28
  :before => visual_effect(:DropOut, 'eltChoice_'+elt.id.to_s, { :queue => 'end' }),
29
- :loaded => visual_effect(:Grow, 'eltChoice_'+elt.id.to_s, { :queue => 'end' }) },
29
+ :complete => visual_effect(:Grow, 'eltChoice_'+elt.id.to_s, { :queue => 'end' }) },
30
30
  { :href => url_for(:controller => 'elt', :action => 'vote', 'choice[value]' => '1') }) %>
31
31
 
32
32
  <script type="text/javascript">setKnob($('elt_<%= elt.id %>'), 0<%= result %>);</script>
@@ -35,7 +35,7 @@
35
35
  <%= link_to_remote(image_tag('write.png'),
36
36
  { :update => 'eltNew_'+elt.id.to_s,
37
37
  :url => { :controller => 'elt', :action => 'new', :id => elt },
38
- :loaded => visual_effect(:BlindDown, 'eltNew_'+elt.id.to_s)+
38
+ :complete => visual_effect(:BlindDown, 'eltNew_'+elt.id.to_s)+
39
39
  visual_effect(:BlindDown, 'eltSubsClose_'+elt.id.to_s) },
40
40
  { :href => url_for(:controller => 'elt', :action => 'new', :id => elt.id)}) %>
41
41
  </span>