diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 11bcbc2..f648a33 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -27,7 +27,7 @@ class AccountController < ApplicationController def signup begin @terms_of_use = virtual_community.terms_of_use - terms_accepted = params[:user] ? params[:user].delete(:terms_accepted) : false + terms_accepted = params[:terms_accepted] @user = User.new(params[:user]) return unless request.post? if @terms_of_use and !terms_accepted diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index dab64ba..6a1fdfa 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -153,7 +153,7 @@ module ApplicationHelper # returns the current profile beign viewed. # # Make sure that you use this helper method only in contexts where there - # should be a currnt profile (i.e. while viewing some profile's pages, or the + # should be a current profile (i.e. while viewing some profile's pages, or the # profile info, etc), because if there is no profile an exception is thrown. def profile @profile || raise("There is no current profile") @@ -167,4 +167,23 @@ module ApplicationHelper content_tag('div', content_tag('div', content_tag('label', label)) + html_for_field, :class => 'formfield') end + def labelled_form_for(name, object = nil, options = {}, &proc) + object ||= instance_variable_get("@#{name}") + form_for(name, object, { :builder => NoosferoFormBuilder }.merge(options), &proc) + end + + class NoosferoFormBuilder < ActionView::Helpers::FormBuilder + include GetText + + (field_helpers - %w(hidden_field)).each do |selector| + src = <<-END_SRC + def #{selector}(field, *args, &proc) + column = object.class.columns_hash[field.to_s] + "
+
<%= text_field_tag 'login' %>
diff --git a/app/views/account/signup.rhtml b/app/views/account/signup.rhtml
index 5a07b58..8e48b3f 100644
--- a/app/views/account/signup.rhtml
+++ b/app/views/account/signup.rhtml
@@ -1,23 +1,17 @@
-<%= f.text_field :login %>
-<%= f.text_field :email %>
-<%= f.password_field :password %>
-<%= f.password_field :password_confirmation %>
<%= @terms_of_use %>
-<%= check_box_tag 'user[terms_accepted]' %> -
+<%= @terms_of_use %>
+<%= check_box_tag 'terms_accepted' %> +
<% end %><%= submit_tag 'Sign up' %>
-- libgit2 0.21.2